Dmitry Nikolaev - stock.adobe.co
A while back, TheServerSide tackled the value of teaching Java as an introductory programming language. The author did a nice job of analyzing the language in terms of its features, its complexity and how it compares to other programming languages.
It's a good read, one which I recommend. Yet, the article makes an assumption that I think is arguable: There's a best first programming to learn in the first place. I'd argue, given that the essentials of programming are prevalent in any language, it really doesn't matter which one you learn first.
Let me put it another way. For a newborn child, does it really matter which language she learns first? Is it better to learn Chinese or English? Why not Arabic or Swedish first? The fact is that the child is going to learn a language no matter what. It's part of human development. The real question is: Will the child master the language?
How language works
At a high level, every language has the same building blocks: nouns, verbs, adverbs, conjunctions and so on. What makes a language different are the sounds associated with its words, its grammar and its idioms. Some linguists even go so far as to assert that a human is born with an innate capacity for language.
The same can be said of programming languages. At a high level, they all have the same building blocks: variables, operators, statements, structures, etc. Yes, some programming languages have features that are designed to handle special technologies -- threading, for example. But at the building block level, the ways these "best first programming languages to learn" work are surprisingly similar. If-then-else statements need a condition. Loops need some sort of iteration mechanism. Operators need behavior. You get the picture.
It seems that most of the effort that gets put into teaching programming languages is focused on making the code understandable to the compiler/interpreter. That's the syntax. The semantics you'll have to master way down the line, if at all. There's a good argument to be made that, if we taught English the way we teach computer programming, students would never get past verb-tense agreement.
Syntax matters, but semantics carries the value
As important as syntax is in the use of the language -- and it's very important -- the purpose of language is not to master syntax. I have yet to come across an aspiring programmer who gets excited about learning the format of a print statement. Yet, once that print statement is used to create the initial Hello World program, the lights go off.
Most developers I know want to make code that has meaning. This is not to say that mastering the syntax of a language is just a grueling necessity. There is a certain beauty in the elegant use of syntax. Just ask anybody who's written an extraordinarily complex yet efficient sorting algorithm. You really do need to know how the language works in order to pull off such a feat. But the real value of such code comes from the behaviors the algorithm produces and the ideas it helps express. It's the semantics that gives the code value.
Want to hear a joke?
My first programming language was PL/I. I learned just enough to be able to take some input from the terminal and do some simple math. Also, I learned how to write if-then and print statements in response to input. The first program I wrote told jokes. Here is one example:
> Want to hear a joke? [Enter yes or no]
> Two peanuts were walking down the street. One was assaulted.
That's it. Some would say that the humor is questionable, and my mastery of the syntax was elementary. Yet, the semantics had enormous value for me and, surprisingly, for others. Turns out, people liked the jokes. And, on top of it all, I had found a method of creative expression that was versatile, powerful and interactive. Computer programming provided a type of creative expression that was hard to find elsewhere. It still does.
It would take a decade more for me to take a professional interest in the technology. But to this day, I remember that little joke program. It changed the way I thought. Did it matter that I was starting at PL/I? Should I have started with COBOL? Would that have made me a better programmer in the years to come? I don't think so. I had to begin somewhere, and PL/I was the starting point.
For me, it's never been about the syntax of the language. While I've always placed importance on learning syntax, its mastery has never been the goal. I care about the ideas that the syntax enables me to express. Still, we need to begin somewhere. If you want to know what I think is the best first programming language for a beginner to learn, my answer is this: the one in front of you.