Knowing More Programming Languages Will Make You Smarter
image from http://visual.ly/network-graph-programming-languages-influence
Words as a Conceptual Map
There's a small bit of setup here – bear with me. I relistened to one of my favorite RadioLab podcasts ('Words') this weekend and had my mind blown, once again. They dug into what words mean to us and, according to the show, words are much more than expression vehicles.
Words are the very structure of our higher reasoning.
In other words: if you can't say it, you can't think it. The words themselves are cognitive variables strung together to represent feeling, emotion, memory – abstract things made concrete by the words we put to them.
High-minded stuff and rather than regurgitate the whole show here – go listen if you haven't, it's very good. It left me quite inspired and I wondered if the the ideas in the show could extend to programming languages. Why not? Code is simply syntax laid on top of process that a machine needs to understand… hmmm….
We tell machines how to think – which directly reflects how we think. Writing code always seemed like such a "machine-y" thing to do, but I think that's not the case: Programming languages are true languages written for us to describe problems that a machine can understand.
These languages are stripped of nuance and imbued with functionality (loops, terse conditionals) for a myriad of problems. How well do you speak code?
A Thought Experiment
Code is language, and how we solve problems with a given programming language directly relates to how we think in that language. This doesn't seem like an amazing revelation in and of itself – in fact I think you probably already understood this quite well.
But what if we reversed it? What if you couldn't think any other way – other than what that language allowed you to think. What if your coding language of choice was the abstraction over your programming thought process – that you actually lacked the mental faculties that lie outside of what that language can represent?
Let's say you walk into an interview and you get hit with a classic interview question (no, not FizzBuzz): write a routine that spits out Fibonacci numbers. It's something every dev has had to do at some point.
Now, slow your brain down and rewind. What language are you using to express this? What is that language allowing you to do.
Rubyists out there might do something similar – favoring a more idiomatic approach with blocks/yield rather than a terse one-liner.
Now write it using a Monad.
I'm sure a few of my readers could do all the above (LINQ, callbacks/blocks, Monad and Recursion) but I doubt that most of you can. This is due to the languages you know, the idioms they use, and the way those languages allow you to think about a problem.
Expanding Your Thought Process
I don't know anything about monads but I've done recursive programming in the past (sometimes not-intentionally). When I started using Ruby, I began to value the idiom of passing control back and forth using blocks and yield. You can do this in many languages – but for some reason it wasn't something I routinely did in C#.
I can "think" in these terms and solve problems in ways I could never do when I knew only one language well (C#). At the time I liked the idea of "going deep" – of knowing a language so thoroughly that I could solve any problem with it and not clutter my mind with the different syntaxes of other languages.
I'm glad I didn't. And listening to that Radiolab podcast this last weekend made me understand why. I used to think it was that learning new languages would help me "think differently" but now I know it's more than that: I'm smarter now.
I'm not an egotistical guy and it hurts a bit to write that last paragraph – as if I'm suggesting that I'm smarter than people who know only one programming language – which is clearly not true. My point is only that I'm smarter than I was 4 years ago and the reason I think that is because I can solve problems in more ways than I could before and if my definition of "intellect" is accurate…
… then yeah: I think it's OK to say I'm smarter than I was with respect to programming.
The thing I enjoy most about all of this is that I would never have thought about this until I heard that Radiolab podcast. They put the words to the very idea that words are our higher reasoning.
A lovely bit of recursive fun.
Would I have recognized that recursion a few years ago? Hmmmm….