3 ms·
Half an hour? When you're first writing the code, you should know immediately if you're going to need to repeat it and what the abstraction should be. If you do
by DougWebb 10y ago
Half an hour? When you're first writing the code, you should know immediately if you're going to need to repeat it and what the abstraction should be. If you don't, then don't waste your time. Later, if it turns out that you actually do need to repeat the code, it should be clear at that point what the abstraction should be.
Let the actual need for duplication guide you in finding abstractions, so you don't waste your time and produce difficult-to-follow code for no reason.
- cel1ne 10y agoLike I wrote I avoid producing difficult to follow code. I tend to start structuring parts of applications and algorithms on paper, and this half hour with paper and pencil helps a lot.