Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

DRY?


Dont repeat yourself. IF you have code that solves a problem, dont rewrite it at every gig...


Now thats a philosophy I both agree and disagree with.

Agree: omg do i need to write this form again? Seriously just write a library already!

Disagree: this problem is subtly yet incompatibly different to what I've seen and dealt with before. The library would need x,y,z but their IP demands mean I'd lose rights to my closed-source library or be forced to open source it to keep using it elsewhere.


I agree with you. The only absolute is that there are no absolutes. However what the practical application of DRY ends up being for me is that I have a "bag of tricks" I carry with me as well as my own "library o' repetitious programming tasks" that I look into first. Much of the time I can save a lot of time by reusing old code. I may have a bit of code that is too specific for the original purpose and get tired of the technical debt it causes, and re-write it. So in that case I am repeating myself, but its with the benefit of experience. More of a refactor than repeat.


but that's exactly the case where things become an issue. if you were able to write a library, it would be worth the effort to write it once more from scratch and make sure that the copyright of the previous code is not infringed.

instead however, what happens is that you have a problem that looks similar to a previous problem, so you take the old code and modify it to fit the new problem.

NOW you have the additional problem of having reused code that's owned by employer A, for a project at employer B.


Don’t Repeat Yourself, I presume


Think he means DYR, do your research.




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

Search: