4 ms·
> Why not set up that structure at the start if you know it’ll be the end result? Precisely because it's an unnecessary amount of code overhead. There's no in
by Arch-TK 5y ago
> Why not set up that structure at the start if you know it’ll be the end result?
Precisely because it's an unnecessary amount of code overhead.
There's no indication at all that IF he needed to expand the code that classes would be necessary UNTIL there were very specific requirements and there's also no reason why he should put that code in place in case of that requirement popping up.
It's always cheaper to write the simplest code you need at the time and then delete it (or rework some of it) and write the more complicated code you need in the future than it is to write more complicated code up front and expand less on some of it in the future.
If the point of the article is effectively "minimising the activation energy required to start automating a task" then surely the code should also be minimal?
- Jtsummers 5y ago> Precisely because it's an unnecessary amount of code overhead. One extra line per step is not a lot of overhead.
- Arch-TK 5y agoIt's more than one line though is it, it's a lot more _text_ even ignoring whitespace it's almost twice as much text. And that's the least important metric! Classes carry a lot more baggage. In the sense that if you see one, your expectations change and expand. The realm of possibilities expands too. This puts extra mental load when anyone new to the codebase has to look at it. The fact that I looked at that code and spent 5 minutes trying to figure out why you would want classes there and what exactly it achieves is precisely what you want to avoid in codebases. I audit code for a living, a lot of it, it takes far more work to audit code where the authors put a lot of unnecessary boilerplate or unnecessarily flexible code in place because it means I have to start figuring out what the authors intentions were. The expanded realm of possibilities means I have to check for more behaviors. It slows down the reading process.