3 ms·
In most cases one big method is an increase of complexity (and others will add to it over time). Large methods are usually a failure of imagination, like bad an
by hinkley 7y ago
In most cases one big method is an increase of complexity (and others will add to it over time). Large methods are usually a failure of imagination, like bad and rambling prose.
Code is a set of instructions for the computer, and for the next person who has to maintain it (“ Programs are meant to be read by humans and only incidentally for computers to execute.”)
Cooking instructions are split into steps. Assembly instructions are split into steps. LEGO instructions are split into steps. When drawing instructions aren’t split into steps the Internet turns them into a cultural phenomenon (Step 2: draw the rest of the fucking owl).
Only programmers think they are immune to this ridicule, smash all the steps together, and then get salty when others complain, ignoring a series of luminaries who beg in every format of media available, and for decades, to do otherwise.
Seriously, organize your code, separate the steps. You’re killing us.
- mason55 7y agoNo one disagrees that code needs to work in steps. The conversation is around how much and the answer is going to depend on what you're doing. Why have a function that prints a whole line? Isn't that just smashing together a bunch of small steps to print one character at a time?