6 ms·
The simple rule is: every line of code has to earn its keep. Sometimes we really do need a one-line function to implement a common interface. Sometimes we nee
by ncmncm 7y ago
The simple rule is: every line of code has to earn its keep.
Sometimes we really do need a one-line function to implement a common interface. Sometimes we need it so that, in the two places it's called, both get the new behavior when it changes.
But abstraction for abstraction's sake is just stalling. The technical term is "ratiocination". It's a filthy habit.
- he0001 7y agoI’m not so sure about this. A one liner may have its merit when you write it at that very precise location right now, but as the code grows the one liner may not have the same merit any more. But that may not always clear when you wrote it.
- ncmncm 7y agoWhen any part of the program stops earning its keep, delete it. Feel proud of every deleted line. Deleting code adds as much value as writing code, but costs much less.