I was once asked “why bother learning these other languages, if you can’t use them”. It hadn’t occurred to this person that I code off hours. I’ve also been asked “what if you find these other languages actually are better than C++? Won’t you find it depressing having to code in a normal language then?”
It’s a good question. I don’t know if there’s one answer, but I’ve found mine.
Learning Lisp, Haskell, Python, and others has given me a greater appreciation for computer science, for the theory and universe of knowledge that lies underneath the surface of programming. Now when I code, I don’t just solve the problem at hand. I see different ways to solve it. I see other remote problems its related to. I appreciate the aesthetic of it all.
It’s not for everyone, but I find the mathematics underlying it all very beautiful.
And as for my day job in old-school-C++? Well, I hack together a prototype in Python in a couple hours, then spend a week translating it to C++ (adding verbosity, manual error handling, unfolding metaprogramming, etc). My boss doesn’t necessarily understand the whole languages thing, but he’s happy when I get a 2 wk job done in one. I’m happy too; having gotten through the icky bits of the problem in Python, I spend less time working on the boring bits in C++, and can move on to the next project sooner.
There is one last question, that I’m not sure I really have a good answer to. “Won’t you be tempted to use features that don’t exist in a normal language?” I’m hoping this will evaporate. Templates have existed in C++ since ’88 (pdf), various people have hacked lambdas in, and VC10 has added them for real. Short those facilities, it’s not like I have forgotten how to write imperative code. It’s still an option – I just now realize the development expenses of that option.
I’m curious, other answers do you choose for these question?
I have similar answers. Other programming languages and environments have given me tremendous insight into software development. They’ve helped me think of core problems instead of getting caught up in syntax. They’ve been sources of inspiration for solutions in other languages. They’ve helped me write elegant code since it’s possible for elegance to flow between languages. They have value even when you can’t use them, even when you can’t really quantify that value.
It’s somewhat depressing using normal languages, but on the other hand I see it as a challenge to produce elegant code in non-optimal languages. I’ve seen others get so used to complexity and verbosity that they simply accept it without any serious thought about how things can improve. There’s always room for improvement, and with that viewpoint feeling depressed is a good thing. It’s tragic when you’re blissfully unaware.
I really *really* want to find an answer that isn’t tragic.
One positive side I have seen is that the truly naive don’t try to do advanced things in ‘normal languages’ — the entry cost to do anything is so high, they’ll avoid learning anything they can. This sometimes leads to linear searches of arrays where a hash table would have been better. But fixing that is easy. Large monolithic classes? Eh, at least they tried, and it’s no worse (often equivalent to) everything being global.
What happens when you give the truly naive programmer Scheme? They implement 20 data types using lg(20) levels deep nested lambda expressions. Give them Common Lisp? equally hairy macros. Haskell? They write a really pointless yet obfuscating monad, then blog about how it’s like a taco.
I guess my point is that normal languages are so inefficient that they keep the truly naive from messing things up too quickly!
Leave a comment