Hacker News new | ask | show | jobs
by Loveaway 979 days ago
The biggest pitfall is DRY imho. Write generic code, reuse abstractions. It's the most elegant way. Except it always tends to lead to these god classes, super systems, that try to be most flexible and to do everything. Then comes the point where it becomes impossible to understand all the interactions and half of your codebase falls apart if anything changes. All because you were to proud to copy & paste a few lines like it's a deadly sin.
2 comments

DRY also removes an easy opportunity to expose patterns which are things that people are incredibly good at recognising and internalising. I used to religiously apply DRY but now I prefer to leave repetition in unless the git log shows changes being applied to the repeated sections.
There is also more advanced AHA principle (https://en.wikipedia.org/wiki/Don't_repeat_yourself in alternative section) - which is an evolution of DRY and is great for avoiding redundant complexity caused by DRY.