Two Mixed Blessings: 'How Small Can You Write It?' and 'Not Invented Here'
Posted: 4 years ago (2007-12-04 20:58:57 UTC ) / Updated: 2 years ago (2009-04-23 21:33:03 UTC )
Imported from WordPress
Originally posted on 2007-12-04 20:58:57
There are two unrelated-looking tendencies that programmers have that can serve a common purpose. Like the Big Ball of Mud Architecture, these apparent anti-patterns are more useful than they appear.
You've probably seen various folks talking about how fewer lines of code are better. Every language partisan wants to prove that their language is more expressive than Blub.
You've probably worked with people who want to reinvent every wheel, and maybe you've reinvented a few as well in your wild youth. We won't tell anybody. But it's easy to look at a random tool and say, "that would be enormously better in (my favorite language)!"
Often different quirks look unrelated, but can share a common cause. This is one such time.
Let's start with "fewer lines is better". While shorter can be more powerful, it's a given that shorter is usually more readable. Not "cram it onto one line" shorter, but shorter in the sense of fewer symbols and operations. As a result, more succinct languages are often more expressive, and express common ideas in a smaller amount of code. An experienced programmer can read and absorb functionality faster in those languages. The tool or library is lexically shorter/smaller, so the programmer reads and absorbs it more quickly.
The second idea that's more useful than you think is "not invented here." By "not invented here", I'm specifically referring to people liking tools written in their own preferred language. Rubyists love tools in Ruby, Pythonistas want everything written in Python, Perl hackers rewrite everything in Perl. I claim that this is not purely about elitism and "whatever I use is better." It's also in the hope that they can understand their tools at a deeper level. Having a tool written in a language that you understand allows you to dig down into it in a way that isn't otherwise possible.
These ideas, together, are a vision of every tool and library, written in the same tremendously terse language -- whichever language that may be. It is the vision of all parts of a solution being readable at high speed. It is the vision of a programmer being able to inhale all of the design, all of the algorithms, all of the underlying quirks, at amazing speed.
We already know that it's silly to spend all your time reimplementing everything in your favorite language... And unless you get some very specific other benefit, it's silly to spend your time finding the shortest, most idiomatic way to express a chunk of code. But sometimes it just feels right to try it. And sometimes there's more underneath that feeling, even when we can't articulate it. Often bad habits come from noble motivations. Break your habits, but think about the goal that underlies them -- you may want it some day.
