3 ms·
This is a horse that’s been beaten to death. Avoid mixing up incidental duplication with harmful duplication. Don’t be afraid to refactor existing abstractions
by jackblemming 3y ago
This is a horse that’s been beaten to death. Avoid mixing up incidental duplication with harmful duplication. Don’t be afraid to refactor existing abstractions if things change. Rule of three and write everything twice are heuristics, not replacements for critical thinking. Almost always decompose or refactor instead of adding Boolean flags, unless it’s unimportant or trivial code. Consider restructuring your code or using a for loop to remove duplication instead of using a function. These things can only be marginally taught, they must be experienced through practice.
And with all art, there’s a good amount of subjectivity. Your reviewer will likely assume their taste is better than yours. Who can blame them?
- sundarurfriend 3y agoThis is an otherwise good comment that starts with an unnecessarily dismissive statement ("This is a horse that’s been beaten to death"). Even assuming this is very common advice (which I don't think it is), there are always new people learning to code and design software, who'll find it useful. And beyond that, John Carmack is also allowed to be one of today's [Ten Thousand](https://xkcd.com/1053/ https://xkcd.com/1053/).