2 ms·
> the point of short functions is abstraction and comprehensibility If you have clean code style short functions you get nothing of that. There you split funct
by legulere 6y ago
> the point of short functions is abstraction and comprehensibility
If you have clean code style short functions you get nothing of that. There you split functions into more functions just for the sake of it. You end up with function names that describe the code worse than how the code describes itself, similar to comments beginner programmers make. Why is a comment "Increments i by one" for i++ not ok, while a function "incrementIByOne" is supposed to be good style?
Even if you don't make functions clean code-style ridiculous short, abstractions still come with a cost. You have to do weigh costs and benefits each time.
- Someone 6y ago“Why is a comment "Increments i by one" for i++ not ok, while a function "incrementIByOne" is supposed to be good style?” It isn’t, but nextOrderNumber could be, especially if it is used in multiple places. That function could easily evolve into _doing_ “increment i by one, atomically”, “generate a random UUID”, “get a new unique ID from the database”, etc.