The debate about the first programming language: the final decision

Some relate to the debate about choosing the first programming language something like this:



They say that a million facors affect the choice and there is no point in arguing about this. However, holivars continue.

Vitaly Bragilevsky decided to put an end to it and presented the final decision at Saint AppsConf . After reading the article (or viewing the report), you will know how to respond correctly to relatives or acquaintances who have learned how much they earn in IT and that the remote is not a hindrance, and are now wondering where to start.


Vitaly Bragilevsky works at JetBrains and teaches at St. Petersburg State University at the Faculty of Mathematics and Computer Science, member of the Haskell Committee for Standardization of the Programming Language and the Haskell Glasgow Haskell Compiler Development Committee, author of the book Haskell in Depth.

So, let's figure out how to start learning programming, which tools to use? In fact, this is an important issue.
Dijkstra wrote in 1972: "... the tools we are trying to use and the language or notation we are using to express or record our thoughts are the major factors determining what we can think or express at all!"
Often a programming language (and the language in general) simply does not allow us to do what we want, or it does not do it the way we want. Language is an important tool, and its choice must be taken seriously.

If you make a mistake in this choice (or more often someone makes a choice for the student), then the consequences can be serious. This is how programmers appeared:

  • spoiled by Fortran;
  • affected by BASIC;
  • crushed C ++;
  • strangled Java.

Hence the jokes that a real Fortran programmer can write a Fortran program in any language. Or stories about guys who are in the first year plagued by C ++, and then they are already impossible to become programmers - only they know how <, and >to write.

Since we see such people, it is logical to assume that the first programming language somehow influences .

I have a personal story in this regard. My first programming language was Fortran, except for the unsuccessful trip to a Basic lecture, in which the teacher talked about arrays, and as a beginner, everything was incomprehensible to me and discouraged me from continuing. Then I went to the library, took a Fortran book and began to perform programming exercises on a piece of paper. To be honest, it was even more convenient for me - but the compiler does not swear.

Background


I'll start with the so-called Richard Vekselblat problem. This man is known for being his first PhD in Computer Science. In 1980, he wrote an article on the consequences of choosing the first programming language ( Richard L. Wexelblat. The consequences of one's first programming language. Proceedings of the 3rd ACM SIGSMALL symposium and the first SIGPC symposium on Small systems, 1980 ).

It all started in 1978, when Richard wrote a letter to the magazine with the provocative headline “Mistakes of Youth, or Is BASIC Bad for Your Health?” The answers to this letter served as material for the article.


Based on recurring points of view, Richard Vekselblat made the following conclusions:

  • , (Pascal, PL/C) , (COBOL, FORTRAN). .
  • , . — , .
  • , , . .

Of course, this was a very naive study, without taking into account sociological factors, nevertheless, and it allowed us to draw some conclusions.

Having studied the history of the matter more deeply, I was convinced that there were hundreds of studies devoted to the choice of a programming language. There are even works summarizing the work on the choice of nuclear weapons, for example: Kevin Parker, Bill Davey. The History of Computer Language Selection. (In Arthur Tatnall. Reflections on the History of Computing: Preserving Memories and Sharing Stories, AICT-387, Springer, pp. 166-179, 2012, IFIP Advances in Information and Communication Technology (SURVEY)) .

The authors, relying on an extensive bibliography, identify factors affecting the choice of language, not only for teaching, but also for implementing projects:

  • : , ( ). , .
  • : ( 150 «Hello world!» 500 IDE); problem-solving, ; .
  • : (, 2000- ); .

Many experts are involved in comparing languages, in particular regarding how well they are suitable for initial study. Linda Mannila and Michael de Raadt in their article “An Objective Comparison of Languages ​​for Teaching Introductory Programming” formulated groups of criteria for evaluating PL:

  1. Applicability in training.
  2. Language and development environments.
  3. Support and availability.
  4. Use outside the introductory course.

Armed with these criteria, Linda Mannila and Michael de Raadt compiled a language comparison table.



In the original, each criterion has additional characteristics that are not so important for us. We are interested in the fact that the leaders in the final Authors' score are Python and Eiffel , a language that can hardly be called popular.

At first, I was hoping to rank the YP according to these criteria and draw my own conclusions, but, looking at the Haskell column, I found lies about every item! And he decided that the table has nothing to do with reality - this is such an “objective” comparison.

Upon reflection, I came to the conclusion that such a comparison makes no sense. Suppose I would add a column with Kotlin and put a tick in each item, or not. That would mean absolutely nothing.

Then I decided to see what is used for training in fact. Here the picture is different.


Data source .

The fact that the data for 2014 should not confuse you, because higher education systems are changing very slowly and the overall picture has not changed much by now.

Python is still in first place, Java - reflects requests from Oracle, Sun Microsystems and other companies to learn this language. Among the universities that begin teaching C ++ programming is probably the University of Texas - Björn Straustrup gives an elementary course there and, I think, students do it well.

Many languages ​​of interest to the academic community did not fall into this rating at all, in particular:

  • Functional PLs with static typing of Haskell and ML, popular among researchers.
  • Widely used in web development, with dynamic typing of JavaScript, Ruby, PHP.
  • Platform-specific industrial languages ​​Objective-C and C # / Visual Basic.

With the latter, it’s just understandable that historically universities do not want rigid ties to anything.

Voice of the people


Having studied the history of the issue, I decided to find out the opinion of modern developers through a survey on twitter . The question was formulated as follows: "What property of a programming language do you consider most important when choosing the FIRST language for teaching programming?" And he proposed answer options that are fairly easy to correlate with specific languages.

Given all the technical features of the polls on twitter, the results are as follows.



More than half of the respondents said that simplicity is the main thing. 25% who answered prevalence apparently think that we should immediately think about the demand in the market. A high percentage of people who think that you need to deal with pointers first is alarming. And the fact that only 8% for a rich set of libraries shows that the first language still should not be designed to do something real.

Survey Answers


I will give some interesting opinions from the discussion of the survey.

Dmitry Kovanikov ( @ChShersh ) - an experienced developer and teacher - expressed a number of important considerations, with which I completely agree: “ High level and interactivity. To get the result of the program and to be able to see it, it was possible with a minimum number of steps. Programming is not about creating variables, loops, or recursions, it's about solving problems with the means of PL. ”

Artyom Pelenitsyn ( @ ulysses4ever ) noted the methodological component: “The presence of specialized methodological (textbooks, task books, tutorials, Q&A forums) and technical (simple and intelligible IDEs with a minimalistic interface, steppers / debuggers with GUI) tools.”

Andrei Miskov ( @andreymiskov ) recalled another important factor: “ Predictability : not be distracted by null / undefined and 0.1 + 0.2. Gradual increase in opportunities: no OOP and mutations until you master the data and functions. Like in Racket / HtDP or Pyret / PAPL. "

Defenders of C were found: “Personally, I believe that C was and remains the best for a more fundamental study. In my opinion, the syntax is simple and quite intuitive , and there are many different concepts (memory, pointers, stack, allocations). Only one BUT, by no means C89, at least C99, but better C11. ”

There were references to Scala, and Rust - and in the context of typing and simplicity. Which makes us think that, unfortunately,programming languages ​​as totalitarian sects . They have adherents who, in spite of everything, promote their favorite language and do not want to listen to criticism (and, in general, other people's opinions).

A vivid example of such "sectarianism" is the debate about how to designate the assignment "=" or ": =". This dispute is already over 40 years old, there are articles devoted only to this issue. And this is just one reason out of hundreds of these “important issues”.
Do not holivarit - popularize your language, but do not act as adherents of totalitarian sects.

Differences between industrial and educational language


We have almost come to find the final solution in the problem of choosing the first language. It remains only to determine how the educational language differs from the industrial one.

First, in an industrial language, there are always many ways to achieve the same goal.

Secondly, error messages in industrial languages ​​are aimed at ensuring that the professional quickly understands what the problem is and corrects it. As a result, they contain a lot of useful technical information for a specialist, which a beginner can frighten and confuse. This aspect sometimes makes it impossible to use a professional language for teaching. If you've ever seen error messages in C ++, then you'll understand what I'm talking about.

And finally, the goals are different. For example, speed is important in industrial operation, but it does not matter much when you just master programming.
Learning YP when you know how to program is easy. In the problem with the first language, you have to learn to program, and this is more difficult.
On the issue of teaching programming as such, there are also books, for example such.



In a very classical (just look at the cover) book “The Structure and Interpretation of Computer Programs” one gets the impression of programming as a magical activity, and of programmers as wizards with exceptional abilities. This, of course, is a complete lie.

The cover of the second book, How to design Programs, reflects a completely different approach - engineering. I like it much more, and I believe that you need to learn to program like any other engineering business.

There are several important principles in How to design Programs that you need to learn when learning programming:

  • How to read the statement of the problem and identify what components the solution should consist of.
  • How to transfer a task to the program structure.
  • , , .
  • , .

Beginning Student Language


To implement these principles, the author of the book Matthias Felleisen came up with the idea of ​​languages ​​for learning. These are languages ​​that are gradually expanding their capabilities.

It all starts with BSL - Beginning Student Language - in which there is only the necessary minimum: function definition, function call, conditional operation, arithmetic. And then, along with the tasks, the language gradually grows, such constructions as lists, recursion, and higher-order functions are added. Gradually, with the help of the language, already SL, it becomes possible to solve more complex problems. This chain ends with the Racket language from the Lisp family, which is the closure of all the previous ones and allows the programmer to implement anything.

This is how an elementary program in the DrRacket environment looks like for a beginner student.


Pyret


Another approach to teaching programming was proposed by Shriram Krishnamurthi et al. They created the Pyret language and published the book Programming and Programming Languages, because, I repeat, no one will learn the language without training materials.

Pay attention to the titles of some chapters from this tutorial:

  • Introduction to Tabular Data (4)
  • Interactive Games as Reactive Systems (11)
  • Examples, Testing, and Program Checking (12)
  • Graphs (19)
  • Processing Programs: Parsing (23)
  • Reasoning about Programs: A First Look at Types (27)
  • Objects: Interpretation and Types (32)

In chapter 11 - at the end of the first month of training - they teach to write interactive games as reactive systems. The entire program is designed for about six months and objects and type systems are introduced almost at its very end.

The Pyret language is built in such a way that it is possible to go according to plan without looking ahead. On it, in fact, you can program everything that occurs before the 27th chapter, not knowing that there are types in the language. And in the 27th chapter it turns out that there is static typing and you can use it. This language was created specifically to move from beginning to end, gradually introducing new concepts into circulation.

Below is an example program in Pyret and the environment in which for this language.


For example, tests that are embedded in a program (block where:) are an essential part of the syntax. Documentation is also embedded in the syntax ( doc:). Such useful constructions are top-level in the language and their use is inculcated in the learning process.

Codeworld


The idea of ​​a simple graphics implementation is implemented in the CodeWorld environment. It has its own language, but you can use Haskell and immediately get something beautiful - for beginners it is attractive.


PascalABC.NET


Our answer BSL and Pyret are being developed at SFU in Rostov-on-Don Stanislav Mikhalkovich and his students.

This is a Pascal that is not outdated. It contains, for example: foreach, intra-block variable descriptions, case by lines, long integers, generalized classes and routines, interfaces, operation overloading, lambda expressions, exceptions, garbage collection, extension methods.

Some things from .NET appear there even earlier than in C #. That is, in the familiar Pascal syntax wrapper, it is a superlanguage with full access to the features of the .NET platform. It implements modern concepts from the point of view of the development of nuclear weapons.


Above in the screenshot, the 120-line program beautifully and with animation collects the towers of Hanoi.

Final decision


The astute reader has already guessed that there is no final solution to the question of choosing the first programming language. Neither I nor anyone else has it. And this is good: we in computer science do not need uniform history textbooks that tell the only correct point of view.

At the very beginning of the article we found out what is more important, how to learn, than in what language. Nevertheless, there are ways to begin to study programming more correctly from the point of view of future development.

Better to start with a language that is more suitable for this: Racket, Pyret, Python, PascalABC.NET. The main thing is that the initial stage - this first language - laid the foundation for future development.



From the first level languages ​​in this scheme, it will be easy to switch to some of the basic industrial or academic languages: JavaScript, C, C #, Java, Haskell, OCaml, F #. But if you start right away with JavaScript, you get a Fortran programmer in a new way, who will then write everywhere like in JS, and it will be terrible. And if it is a second language, then such a deformation will not occur.

Further, when the foundation is laid in a certain area, a million opportunities open up. Only some of them are shown in the diagram.

You may not need to know many languages ​​right now. Especially if you are a mobile developer. But all platforms sooner or later become outdated, and when this happens, it turns out that the one with the wider background and who knows more languages ​​from different areas will benefit.

If you go through the languages ​​of the lower level of the scheme, and will roughly represent their device, this will make you the best developer in any language.

If (and how else, you read it on Habré) you already successfully started a career of the developer, have gone deep into any one area and now want to know what is happening outside it and where else to direct your attention - join the RIT festival ++ Online . There, in two days (May 25 and 26), you can get a slice of the entire IT industry, and at the master classes from May 27 to June 10, you can pump out individual skills.

All Articles