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

A nit; DRY is probably not what you think it is. DRY is basically the same as SRP, framed differently. In SRP, it's totally valid to have the code twice if it has different meaning from a user pov.



Quoted: "You can still not repeat yourself but violate single responsibility"

(https://softwareengineering.stackexchange.com/questions/2207...)


Quoted: "Likewise, you can repeat yourself but classes only have a single (duplicated, but subtly different) responsibility."


I think it's the same thing, but I usually postulate DRY as semantically identical code, not merely syntactically identical.

"Byte for byte equivalent" doesn't necessarily mean it's a copy, if the semantics of it are different.


The problem with definition is that it's subjective and cannot be checked automatically. So my definition was about mechanistic DRY, which is objective and checked by linter.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: