In 2001, Edsger W. Dijkstra wrote a letter to the University of Texas because of the efforts to replace the introductory programming course of its undergraduate curriculum the functional programming language Haskell by the imperative language Java. The full text can be read here.
Moreover, Joel Spolsky wrote the excellent Peril of Javaschool. Paul Graham also wrote about a paradoxical Blub Programmer, which is as interesting to read.
Many of us tend to believe programming languages are merely tools or technology — a medium with which to build software. Many of us would announce lame any discussions regarding programming languages or regard them as another religion war.
According to Graham (and as I’ve recently found out), a programming language is equally a tool and habits of mind which represents how the programmer thinks. That is really slow to change, if at all possible.
I started my programming journey later in life after an unsuccessful career in architecture. At that point I was very interested in interaction and graphic design and entered programming via Processing, a dialect of Java used mainly in interactive media. From then on, as I’ve grown more experienced and the needs changed, I embraced other languages like C++, Python, JavaScript, and recently Go. It’s just natural to program that way, but I always felt something was getting in the way.
Looking from hindsight, all the languages I’ve adopted and learned to use were insignificant to my growth as a programmer. Each of them is more or less good at something and bad at some other things, but all have not taught me anything much more than what Java could have.
My interest in functional programming started well over a year ago even before I learned Go. I dabbled into Erlang and Haskell, but they never caught on. My mind was so trained to thinking in Java-esque ways that I could hardly see any use in learning any new ones (see Blub Programmer paradox). Like many other “practical” programmers, I couldn’t see beyond my language, or a pattern of thought processes I chose to stick to because it was more comfortable for me.
I started to seriously committed to learning functional programming in Ocaml, a notoriously hairy and less popular functional languages according to most programmers. After learning it on the side for a few months, I began to see things differently. It was nothing phenomenal, but it was noticeable. I’ve started to realize that I was moving up beyond the mist that had so clouded my view toward the top and my potential to grow as a programmer for years. My mind opened up with more capacity, and I began to see the flaw in all the Java-esque languages I’ve adopted since my first days in programming.
If you have never seriously programmed in a Lisp or ML language for more than a few months, it is not possible comprehend the power of functional programming beyond the mere superficial marketing quirks like immutability. The truth is functional programming is just a very powerful way of thinking it is hard to unlearn those concepts most programmers picked up from conventional sources in order to start with a fresh mind. Consider this trivial expression in Scheme, a Lisp dialect:
(+ 10 (* 2 (- 5 1)))
If you talked to a Lisper, he’d tell you Lisp has no syntax. The above expression, unlike in any other languages, is already a representation of the Abstract Syntax Tree (AST) which is a grammar structure derived after an interpreter or compiler had parsed code tokens in, say, a language like Python:
10 + (2 * (5 - 1))# AST representation
#
# 18
# / | \
# + 10 8
# / | \
# * 2 4
# / | \
# - 5 1
Can you see the resemblance to the Scheme code? This is sometime referred to as homoiconicity, or data as code.
If I am to be asked to recommend a first programming language for someone to learn programming now, I would recommend Scheme instead of Python, and definitely not C/C++, Go, or JavaScript. I strongly believe anyone who can think in Lisp or ML fluently wouldn’t have much problem transitioning to other programming languages later on.