Dijkstra's Letter: Why Programming Learning Should Begin with a Functional Language
The recent translation of the article “It's Time to Replace Python as a Language for Learning” provoked a lot of discussion. Obviously, programmers consider this topic very important. Unfortunately, most of the debate was about imperative languages, and few offered functional languages as a tool for teaching programming.
We at Hexlet recently launched a new version, a key feature of which were practical exercises on programming in the browser. In this regard, we began to receive even more letters from beginning programmers with questions like “where to start”. On the one hand, they want to put the beta version of the application in the app store in a week. On the other hand, we understand that in such a short time, you can probably learn how to code applications, but you cannot learn how to program. And it’s difficult to decide which is better: to teach simple applications as quickly as possible without a real understanding of programming, algorithms and their computational complexity, and then start familiarizing yourself with these important topics, or start “from the beginning” and organically come to the creation of applications and products after development of the foundation.
In 2001, Edsger Dijkstrawrote a letter to the University of Texas Economic Council. In it, the famous scientist encourages council members to think about changing the programming language for an introductory course. Unfortunately, the language has been replaced by Java. Around the same time, MIT changed the language of the course “Structure and Interpretation of Computer Programs” from functional Scheme (LISP dialect) to Python.
Today we are publishing a translation of this letter.
Members of the Economic Council
I am writing to you about a rumor about replacing a language in an introductory programming course from the Haskell functional language to the imperative Java language. I believe that the Council should take responsibility so that the decision is not made at the wrong level.
You see, this is not a small detail. Colleagues from other states (still!) Do not understand how I can survive in a place like Austin, Texas, automatically believing that conservative Texas means mediocrity. I usually reply, “Don't worry. The Department of Computer Science is a rather enlightened place, for example, in the introductory programming course, we introduce students to Haskell. ” At first they do not believe, and then they begin to envy. Usually it turns out that their curriculum has not yet taken off from switching from Pascal to something like C ++ or Java.
A good reason to choose a functional programming language for beginners is that most students are a little familiar with imperative programming. Seeing the novelty of functional programming, they realize that programming is wider than they thought. And students quickly notice the elegance of a functional approach for solutions that are very difficult (or impossible) to formulate familiar with their school tools.
The fundamental reason for choosing is that functional programs are closer to mathematical objects than imperative ones, so it’s easier to explain what rigorous reasoning is when programming. An additional plus of functional programming with “lazy computing” is that it provides an environment that provokes practical reasoning.
Finally, comparing Haskell and Java specifically, I want to say that Haskell, although not perfect, is orders of magnitude better than messy Java (which required a wide advertising campaign and aggressive sales people to become a commercially acceptable product). It is so bad that the whole industry as a whole accepts low-quality design as a de facto standard. Personally, I believe that a university should leave a healthier alternative afloat.
Not only does the cello affect the musician, we are all influenced by the tools we have learned to work with, and in this regard, programming is even trickier: it shapes our thinking process. This fact makes the choice of the first programming language so important.
I would like to use an introductory programming course to create a culture that would be the foundation for the entire educational process. And so that learning does not begin with attempts to forget or unlearn something (if this is possible at all: what has become our past will forever remain). The choice implies a serious responsibility to our students, so it should not be left on the conscience of a random chairman of something. It must be made by the Economic Council. This issue cannot be decided by officials or politicians. Government officials are needed here.
Only registered users can participate in the survey. Please come in.
Programming training should start with
- 22% Functional Language (Haskell, LISP, Scheme, etc) 722
- 26.1% Imperative Language (Java, C / C ++, etc) 858
- 14.2% From the language in which you can make the product (application) as soon as possible, and then study functional languages, mathematics and algorithms 468
- 2.5% Functional languages, mathematics and algorithms do not need to be studied at all if you are only interested in creating a product (applications) 83
- 34.9% From the basics of algorithm theory 1145