3 ms·
I think DRY is actually an axiomatic principle of good code. However, there are several axioms and they all conflict, so maximizing one at the expense of the ot
by crdoconnor 9y ago
I think DRY is actually an axiomatic principle of good code. However, there are several axioms and they all conflict, so maximizing one at the expense of the others means you are writing bad code.
- wirrbel 9y agoDo we have the same understanding of code being DRY? Because it is not an axiom. It is a guideline on reducing errors, that are enabled by writing the same information in various places of your code. As opposed to "reduce code duplication at all costs" which does emphasize textual/structural equivalence. https://twitter.com/BonzoESC/status/442003113910603776/photo/1 https://twitter.com/BonzoESC/status/442003113910603776/photo...
- crdoconnor 9y agoWhen I said there are several axiomatic principles and they conflict that's ^^^ precisely what I was talking about. Reducing duplication at all costs is harmful.
- wirrbel 9y agookay, I guess I am nitpicking on the word axiom ^^. DRY-as-in-the-original-sense is not an axiom because you can actually give good and simple reasons from which you can deduct the principle. You are definitely are right in the sense, that treating soft truths as "hard facts" is a problem in software.
- crdoconnor 9y agoNo, I do mean is that properties of good code can all be boiled down to a set of fundamental principles. I think one of the defining features of all of those principles is that they directly conflict with one another. Good code means achieving a local minima, because up to a point, maximizing any one of these principles (e.g loose coupling) will inevitably violate one or more of the other fundamental principles. I.e. maximizing loose coupling often has the side effect of violating DRY or ramping up language complexity (another fundamental principle). I don't think you really can derive DRY from other principles, though I'd be curious to hear what you think it could be derived from.