Shared publicly  - 
 
Love this quote from the insightful +Coding Horror blog:

"It's painful for most software developers to acknowledge this, because they love code so much, but the best code is no code at all. Every new line of code you willingly bring into the world is code that has to be debugged, code that has to be read and understood, code that has to be supported. Every time you write new code, you should do so reluctantly, under duress, because you completely exhausted all your other options. Code is only our enemy because there are so many of us programmers writing so damn much of it. If you can't get away with no code, the next best thing is to start with brevity.

If you love writing code-- really, truly love to write code-- you'll love it enough to write as little of it as possible."
7
Robert Snyder's profile photoColin Toal's profile photoMarc Cohen's profile photo
5 comments
 
I think this is wrong. DRY is right. Code still has to be written, it just shouldn't be redundant.
 
DRY is the best way I know to avoid writing new code so I think DRY is entirely consistent with the message in this article.
 
+Marc Cohen I just agree more with +Emlyn O'Regan . The article is too dogmatic. I think code evolves and is malleable and impermanent. It can always be changed, refactored and the iteration makes it better and more resilient. Software is great because it is so malleable.

This is why I think DRY is better than DWC. It encourages you to be a good and thoughtful editor and experimenter (as Emlyn suggests) without sacrificing the aesthetic principles of performance, clarity and simplicity that we all cherish.

Software development is a funny thing. We all want it to be an 'engineering' discipline, so there is an urge to make it like engineering. But engineers deal with the physical world, where mistakes that require rework are expensive in terms of materials. It begs perfection before dies are cast, material is cut.

Code is only expense in time. Prototyping and experimentation are valuable. We are fortunate to have this luxury in our art. This is not to say that we should be cavalier or careless, but that you can't throw away the best thing about coding - the ink doesn't ever need to dry.
 
+Colin Toal I don't see the dogma - this article is not saying we should never write code, it's saying we shouldn't write code needlessly. One way (IMO, the best way) to achieve that goal is through judicious use of DRY. Another way to avoid writing more code than you need is to keep your design as simple as possible such that it meets the requirements and gets the job done simply and effectively. There's also the 80/20 rule and iterative prototyping and avoiding premature optimization. After many years of writing software, I personally resonate with the message that the best engineers are the ones who manage to avoid the temptation to write more code than they need. To paraphrase Einstein (apocryphally): “Everything should be made as simple as possible, but not simpler."
 
I kind of agree to the not writing much code. But i must specify that i mean production code. Because I write tons of tests first and after i am convinced that this is how it should look then I make the production code to match the tests. This way i know it works, and i think it turns out to be shorter than if i just code on the fly, and I think it also helps to reduce redundancy
Add a comment...