How do you make a non-trivial program? I can easily make small, trivial scripts...

How do you make a non-trivial program? I can easily make small, trivial scripts, but I get lost trying to make anything larger.

Attached: 1506230994116.gif (500x281, 551K)

Other urls found in this thread:

number-none.com/blow/blog/programming/2014/09/26/carmack-on-inlined-code.html
twitter.com/SFWRedditImages

bad programmers leverage oop. try that

Attached: oop_fags.png (468x300, 17K)

fuck OOP
try the unix philosophy

Make an outline of ALL the components ans unitize the work.

god i wish that were me

what large program did you try to make?

It's not really large, in fact it should be very simple and easy to do, I tried to write a little Tetris clone. I thought it was going fine making little abstractions until one of them didn't work out. The solution seemed simple, just get rid of the parts that don't work and rework the problem, but when try to do this, I just felt lost and couldn't actually rework it for some reason, even though I had an vague idea on how to do it. Something similar happened to be a while ago when I tried to work on a (albeit bigger) project. I think this is what separates a "scripter" from a "programmer".

Learn more computer science theory. It sounds like you don't understand how to modularize and abstract software components. Unit testing and debugging also helps to find exactly where problems are coming from

This OP

Unit testing is especially key.

>Unit testing
It's amazing how on Jow Forums you consistently get the worst advice kek

Attached: lol.gif (290x189, 1014K)

Unit Testing is good for pure functions I think like square_root, test it with some values and see are they correct in your test cases. Trouble is I find in my job as a web dev its a lot more difficult to make tests because most functions perform their actions as side effects and testing the return value is pretty pointless. If you have a sendEmail function you can see if it returned true or false but you can't test if the email actually fucking sent. Same with functions that write to databases and shit you end up having to have loads of special state set up and query it back and shit. Any suggestions on how to deal with this stuff are welcome.

Try using less abstraction.

Attached: 1548170195368.png (760x342, 28K)

Sauce? I wanna read more stuff like that.

It's from an email John Carmack sent out to an unspecified list.
number-none.com/blow/blog/programming/2014/09/26/carmack-on-inlined-code.html

Personally, I like to only use unit tests for those "pure" functions. Anything that has side effects gets integration tested (by for example making the server under test listen on localhost and making the test query it, setting up an in-memory database for DB tests, querying the actual API if I depend on one and so on).

This way I'm actually testing whether my code works with real stuff, not just some small mock that may or may not act like the real thing. This is also why I try to aim for more integration than unit tests - I don't really care how the code works on a low level (returns of individual functions), what I care about is whether the program's external interfaces actually work. This also has the added benefit that you generally need to throw away fewer tests when refactoring (assuming that your app's external behaviour shouldn't change).

Thanks user, I'll do some research on integration testing tools & techniques.

Thanks!

Thanks user, do you have any book recommendations or should I just hit up SICP?

Now I understand what integration testing is. Thanks.

>muh eunuchs philosophy

Unit testing in itself is not a meme, it's actually useful.
The real meme is TDD.

Does anyone actually do that shit? There's no reason to write tests first unless you're retarded.

Same way you learn everything. Try it, see what works, see what doesn't, then try again. People with years of experience don't get it right.

What kind of Software Architecture did you try, in general terms? Something resembling MVC or one of the alternative architectures...

What the fuck, the direction of flow changes when I look at the gif from different angles

Im movimg my head like a reatrd, flow only goes one way