Comment on Real quick question about the "break"
dgriffith@aussie.zone 11 months agoyou’ll see that he doesn’t like functions to be very long. I think his rule is no more than 4 lines.
Four line functions? Sounds like a codebase adhering to that rule would end up as a nice thick function soup. It feels like… I dunno, those database programmers that like normalising databases to the Nth degree.
If you put your loops into functions then you can just use return instead of break.
And that just sounds like abusing the concept of functions to replace standard flow control that your language provides.
But hey, I use C and on the rare occasion I sneak a goto in there, so I’m not qualified to pass too much judgement.
samus7070@programming.dev 11 months ago
Yeah, it’s a bit on the extreme side for me. 10-20 is what I prefer. I find that if I follow that rule the code is easy to come back to later because the things a function does are more clearly defined. I can look at a higher level function and it’s filled with function calls like readX, createY and doThis. I don’t have to look at as many blocks of code and try to remember what the intent was.