I recently finished reading “Outliers the Story of Success”, the latest book from Malcolm Gladwell. This is not a book review. But there are a couple of thought provoking ideas in this book that struck me. It made me think how it is applicable to this world of programming.
In the “Rice Paddies and Math Tests” chapter Gladwell try to present answers to this stereotype: Why are Asians good at math?
Gladwell started by quoting example from Stanislas Dehaene's book "The Number Sense” . He asks reader to try to memorize this sequence of numbers: 4,8,5,3,9,7,6 in twenty seconds. He states that English speakers would have 50% chance of getting it right. However if you speak Chinese, you're almost certain to get it right every time. Why so?
This is where things getting interesting. It’s a fact that people have about two seconds memory span. We can easily retains information that we can fit in two seconds. Here cultural or linguistic background doesn’t matter. What does matter is how many numbers you can comfortably fit into those 2 seconds. Chinese speakers get that numbers sequence right every time because—unlike English speakers—their language allows them to fit all those seven numbers into two seconds.
I’ve observed this with my Chinese friends. They can recite and write down 10 digit phone number easily while I always need the last half to be repeated.
Gladwell further argues that, the numbering system in Chinese is much more logical than in the western languages. It matches nicely with the decimal numbering system that we use in Maths. Chinese, for example say two-tens three for 23. While English speakers say twenty three. Ten two for 12 vs twelve. Math is therefore thought of, spoken and written all in the same way.
It makes learning math a much more logical and much less daunting process. Same thing with the concepts of multiplication, division, and fraction, it fits perfectly with the Chinese language.
How does it relate to programming? I’ve observed, while reading other people code, that their programming language background define the kind of abstractions they will use. It influences how they will solve a particular problem.
For example, while reading Java code written by people with functional programming language background, I’ve found they used anonymous inner classes repeatedly. Which I rarely found in code written by programmers which solely program in Java.
I found myself start to use some anonymous inner classes in Java or lambda expression in C# after learning Ruby, Python, and LISP. I started to use higher order function more in my Javascript code. Why? because the concept of passing a function as parameter by using anonymous inner classes in Java or delegate in C# pre 3.0 is a very remote concept for me. The syntax is clunky. Hence, it doesn’t come intuitively to use this abstraction in my code.
However, when I learned Ruby, or especially LISP, it is used everywhere. The syntax is so much more intuitive. Thus, I started using it more and more.
Joel Spolsky in his article “The Perils of JavaSchools” states:
“Without understanding functional programming, you can't invent MapReduce, the algorithm that makes Google so massively scalable. The terms Map and Reduce come from Lisp and functional programming. MapReduce is, in retrospect, obvious to anyone who remembers from their 6.001-equivalent programming class that purely functional programs have no side effects and are thus trivially parallelizable.”
The point is, your language defines your thought. And real world experience is a big influence to both your thought and language.
As the book itself. It is a great book. It is informative, entertaining, and thought provoking.