i always find this advice to be only applicable to a small amount of code and pretty terrible outside a limited scope:
medium.com/storyblocks-en
Conversation
Replying to
Don't really see how having a bunch of non-reused tiny functions helps if you aren't using any complex control flow or mutable variables.
I don't think that makes the code more readable aside from naming sections of the code, which doesn't require functions.
2
1
Replying to
yeah, that's what i'm critiquing. it's "clean code" gone wrong. and it's common advice, and this shit advice somehow has 17k "claps".
1
Replying to
Needing to pass around variables and in the correct order to non-reused functions just makes things more complicated.
Since they aren't actually going to be an API that's going to be reused, the parameters being passed around also probably won't make much sense. Not a fan of it.
Replying to
yep. i actually bought into this when i started programming and my code was **awful**. i re-wrote a 1k source file into 300 lines afterwards, and i could suddenly understand my own code again.
I'm all for finding ways to reuse code which make things simpler and easier to understand rather than more complicated. Lots of small functions, sure, but they should be used at least twice. I don't see the point of splitting things up into a bunch of ad-hoc functions and files.
1
1
Often I start refactoring and then realize I actually made the code longer and/or harder to understand so I don't bother applying it in the main branch.
Unless the API makes a LOT of sense by itself or returning early simplifies things, I'm not making a single use function.
1
1
Show replies

