I'm sure I did understand DRY
Still waiting for a supporting citation.
| [reply] |
| [reply] |
I'm sure I did understand DRY. Still waiting for a supporting citation. Its the same citation you used Um, its exactly the same source as yours, it says every line ... repeating $foo two or three times in one line is not what they're talking about
Perl will catch the typos
Have you read the chapter in the book?
This whole discussion of which is more DRY: foo++; foo++; versus foo = foo + 2; versus foo += 3; ... they're all the same from a DRY perspective, foo is the single canonical source of information, the single canonical reference, they're all equally DRY
Take a look at a very similar question, http://stackoverflow.com/questions/3898862/variable-value-assignment-operation-duplication, OP asks which is more DRY, using this.changed = true; versus dirty(); when this example from the book is about how to violate DRY and limit the scope -- which violation of DRY is more DRY? DRY doesn't care how verbosely you violate it
| [reply] [d/l] [select] |
Eyepops originally said:
> from the perspective of DRY, this one is "better"
DRY is a ideal to avoid redundancy not an absolute rule.
The art of optimizing between somehow contradicting principles shows the good developer.
For instance strictly speaking MVC shouldn't allow any code logic in templates.
That's hardly practical.
Some authors like to propagate their principles like biblical commandments, of course that's naive at best.
| [reply] |