I’ve been programming simulations and algorithms in C++ for several years now, but it’s only been in the last year or so that I’ve really began to appreciate the advantages of diversifying ones language repertoire. My conversion began after reading The Art of Unix Programming by Eric Raymond last year while exploring new material for ECE2524. In the book Raymond lays out a list of design rules making up the Unix philosophy and explains how following these rules has produced clean, powerful, maintainable code and been the reason why Unix has so easily evolved and adapted and flourished in the fast paced world of technology from it’s roots in 1969 running on under-powered hardware, even for the time.
The Rule of Diversity appears towards the end of the list, but is interesting in that I feel it is one of the few rules that few people, curriculums or corporations outside of the Unix community have yet to seriously embrace. I hope that people with a Computer Science background can contribute their own view, but in my experience with the limited software design instruction in my Engineering curriculum, and talking to several other people, the focus has been strictly on Object Oriented Programming (OOP), usually using Java or C++.
As a result of this focus on OOP, programmers (including my past self) are encouraged to adopt a programming paradigm that may work well for some problems, but not well for others. I’ve learned from first hand experience that forcing an OOP framework on a problem that doesn’t really lend itself intuitively to the features of the framework (data encapsulation, inheritance) leads to an impossible-to-maintain mess consisting of many layers of brittle “glue” code and a spiting headache as soon as concurrent processing is thrown into the mix.
Discovering the Rule of Diversity was refreshing to me for many reasons, as I tend to reject dogma of any kind, but hadn’t really been made aware of the alternatives when it came to programming. This process lead to me learning Python, which I now use to do the majority of my data visualization, and becoming interested in Ruby for web development and Haskell to learn about functional programming and how I might employ it to more elegantly implement the mathematical algorithms that are a large part of my field of study (Control Systems).
When a friend of mine recommended Seven Languages in Seven Weeks by Bruce A. Tate I was intregued by the idea of learning 7 different programming languages, along with their strenghts, weaknesses, histories and accompanying programming philosophies. When I found out that two of the languages covered were Ruby and Haskell I was sold.
I have decided to work my way through the book over the next 7 weeks, and write about my experience with each language. So far I really enjoy the structure of the book, the motivations of the author, and in particular his method of associating each language with a unique fictional character:
- Mary Poppins from Mary Poppins (1964) – (Ruby) because unlike other nannies of the time she “made the household more efficient by making it fun and coaxing every last bit of pasion from her charges.” And wasn’t afraid to use a little magic to accomplish her goals.
- Ferris Bueller from Ferris Bueller’s Day Off (1986) – (Io) “He might give you the ride of your life, wreck your dad’s car, or both. Either way, you will not be bored.”
- Raymond from Rain Man (1988) – (Prolog) “He’s a fountain of knowledge, if you can only frame your question in the right way.”
- Edward Scissorhands from Edward Scissorhands (1990) – (Scala) “He was often awkward, was sometimes amazing, but always had a unique expression.”
- Agent Smith from The Matrix (1999) – (Erlang) “You could call it efficient, even brutally so, but Erlang’s syntax lacks the beauty and simplicity of, say, a Ruby.” “Agent Smith … had an amazing ability to take any form and bend the rules of reality to be in many places at once. He was unavoidable.”
- Yoda from Star Wars: Episode V – The Empire Strikes Back (1980) – (Clojure) “His communication style is often inverted and hard to understand”, “he is old, with wisdom that has been honed by time … and tried under fire.”
- Spock from “Star Trek” (1966) – (Haskell) “…embracing logic and truth. His character has a single-minded purity that has endeared him to generations.”
Even though I’ve only began working through the exercises in the Ruby section, I’ve already developed an intuition about the “personality” of each of these languages through Tate’s analogies. He has also chosen the perfect level of detail, not spending any time on the details of the syntax, or building up canonical examples, only focusing on what makes each language unique and powerful and expecting the reader to explore on his or her own to fill in the gaps.
I’ve almost worked through the Ruby section, so expect a post about that soon. In the mean time, how do you feel about the Rule of Diversity? Have you been offput when teachers/mentors/bosses treat a particular idea/framework/concept as “The One True Way”?