3 ms·
Functional abstraction in general is not too clever. This particular code example, though, absolutely is. As mechanical_fish pointed out, it's pretty much illeg
by swombat 17y ago
Functional abstraction in general is not too clever. This particular code example, though, absolutely is. As mechanical_fish pointed out, it's pretty much illegible.
DRY is only one of the principles of good code, and not the highest one. The highest one would be that the code must work. The second highest that the code must be clear to the reader.
I warmly recommend this excellent talk by Marcel Molina Jr at RubyConf 2007, about what makes code beautiful:
http://rubyconf2007.confreaks.com/d1t1p1_what_makes_code_beautiful.html http://rubyconf2007.confreaks.com/d1t1p1_what_makes_code_bea...
He gives a good example of a case where using too many abstractions results in unclear, and hence ugly code.
- weavejester 17y agoHuh? Why is it illegible?
- jrockway 17y agoBecause the reader doesn't know the language it's written in. Note that "illegible" is a property of the reader, in this case, not of the code itself.