Hacker News new | past | comments | ask | show | jobs | submit login

No opinion on SOLID with regard to your comment. But DRY is foundational to any code because it forces you to find the right abstraction.



If code is copied and pasted everywhere that is obviously bad. However, some repeated code is better than none in many cases.


This is the kind of thinking that leads to unmaintainable AbstractFactoriesFactory classes. Sometimes allowing repeat code is good because two functions might drift away from common functionality in the future which would require a major rework of whatever abstraction you put over them to get them under the same roof.


Even in simpler cases it can be problematic. For example, refactoring a tiny bit of repetitive code into a separate function might seem like a good idea. But, over time, things diverge and now additional parameters and branches have to be introduced to support. A small amount of repeated code is optimal.


No, it just forces you to find an abstraction, not necessarily a good one. Badly designed abstractions can be far worse than repetition.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: