6
$\begingroup$

There is a school of thought that it couldn't matter less which programming language is chosen as one's first programming language. The official position of a well known internet community dedicated to programming is that:

  • No programming language is designed to be beginner friendly.
  • One will not use their first language to develop things worthy to be published, instead one will only use it to learn basic concepts, therefore arguments such as "to do X you may use Y, but A is instead used to do B" only provide cognitive overload for beginners.
  • There is no reason to believe that the choice of the first programming language impacts the effects of learning in any way, so the whole discussion is groundless. (Mods say they will only consider differing opinions on this point if scientific papers are brought to support them)

Therefore, the said online community bans asking questions like "Which programming language should I pick to learn how to program?" and if such a question is asked then it bans giving any answer other than "It does not matter; pick absolutely any, flip a coin if you like, and stick to this choice".

Intuitively I find this position surprising? I would say that:

  • Some languages have significantly more gotchas than others. C or C++, in particular, have numerous unobvious rules which, if violated, result in UB. It can easily happen that a program starts misbehaving after a seemingly innocous modification in code is made because of hard to spot UB introduced somewhere else. This seems to be a horrible and a very frustrating experience for beginners.
  • A person interested in doing a particular thing might want to be able to scratch their first, even very rudimentary programs in this field. For example, contrary to what is claimed above, a person interested in doing gamedev might be far more interested to scratch their first simplistic games in Unity3D than learn lots of stuff that is too abstract and too unintersting for them because due to the lack of domain knowledge they chose ASM as their first language (since they were not told which lang is good for gamedev, but instead they were told to pick any random language).

Is there any reason to believe that the choice of one's first programming language matters at all?

$\endgroup$
10
  • 3
    $\begingroup$ Re, "...no programming language is designed to be beginner friendly." Who said that? What did they mean? There are a number of programming languages that were created specifically to fill a perceived need for a "beginner friendly" language. $\endgroup$ May 15, 2022 at 19:34
  • $\begingroup$ @SolomonSlow indeed - BASIC apparently stands for Beginners' All-purpose Symbolic Instruction Code $\endgroup$ May 15, 2022 at 20:59
  • $\begingroup$ 'Therefore, the said online community bans asking questions like "Which programming language should I pick to learn how to program?" and if such a question is asked then it bans...' If you're referring to Stack Overflow, the reason the question is off-topic and "banned" (closed) is because it's opinion-based. "It does not matter; pick absolutely any, flip a coin if you like, and stick to this choice" isn't a community/moderator/official consensus at all, just someone's opinion. Gorilla vs Shark is worth a read. $\endgroup$
    – ggorlen
    May 16, 2022 at 18:52
  • $\begingroup$ @ggorlen I'm not refering to StackOverflow. $\endgroup$
    – gaazkam
    May 16, 2022 at 18:57
  • 1
    $\begingroup$ Side note: you probably want to clarify if you consider LISP/Haskell/F# as "languages" - all posts so far are about non-functional languages and it probably means "is functional of procedural languages better as first one" should be separate question. $\endgroup$ May 19, 2022 at 17:01

6 Answers 6

4
$\begingroup$

I don't believe that there is any real research on the question, so what you will get here is essentially philosophy and guesswork, buttressed by informal observations.

I know that there are others in this site who feel strongly in the affirmative, and I will let them argue their own points of view.

For myself, I suspect that it doesn't matter much. At the end of the day, we must learn about (and integrate) so very many abstractions, so very many mechanisms, and so many paradigms of thinking before we are professionally competent. Essentially all of our current professionals began in one of four ways: with imperative programming, with procedural programming, with object oriented programming, or with functional programming.

All of them proceeded and became professionals.

Within our own four-year program, we have experimented with objects first, procedural first, and imperative first. (We teach FP, but we have not tried it at the outset of the program.) I have not noticed any discernable difference in the quality of our seniors, other than the general rise in quality you'd expect from a faculty that is becoming more experienced and constantly making changes and tweaks together.

That said, we have over time gravitated towards objects-early, typically in about month 4 of study. What we found was that, in general, libraries are high-abstraction, so when we ordered things from higher-abstraction to lower-abstraction (such as Java ArrayLists before arrays), it enables kids to work on fun personal projects a little earlier, and that that can be highly rewarding.

Even if we haven't found giant qualitative differences in the results of students several years in, that in itself is a worthwhile reward.

$\endgroup$
3
  • $\begingroup$ I think objects early suits some students and objects late suit others, some students are happy with programming as an abstract activity, whereas some are more practically minded. The average performance probably doesn't change, it is just a different sub-population of students that is advantaged/disadvantaged. I prefer objects late(ish) because objects early can be a hurdle that some students can't manage, so it seems to reduce the number of students that don't learn to program adequately. $\endgroup$ May 15, 2022 at 13:18
  • $\begingroup$ @DikranMarsupial, I'm pretty sure that what you describe is a function of teaching, not student preference or ability. Teachers often have clear views (even prejudices) on object early v late. $\endgroup$
    – Buffy
    May 15, 2022 at 19:04
  • $\begingroup$ @Buffy, I think it does extend to students, at least it did when I was one. Objects first would have been a stumbling block for me - it only really clicked when I found out about v-tables and knew how it all worked (and I had the advantage of having written programs where it would have been useful). I find abstraction difficult if I don't understand what is being abstracted (and still do). Not everybody is like me though (thankfully). I try and take an approach that works either way, hence "late-ish" rather than "late". $\endgroup$ May 15, 2022 at 20:15
3
$\begingroup$

The choice of starting language is relevant in its ability to keep a students interest. In the early days of the micro computer BASIC developed itself as the ultimate learning language. It was ubiquitous, part of all of the early micro computers. Popular dialects such as MS BASIC, Apple BASIC, Commodore BASIC all were easy to start with providing quick and impressive feedback almost immediately. Once you got rolling you could build nearly anything with BASIC that the computer was capable of. I doubt I would have become a professional programmer if not for BASIC. You could get your start easily on your own, and without switching languages accomplish something truly impressive.

On the flip side BASIC was reviled by most of industry and academia because of the "bad habits" it taught. If you want to be simultaneously impressed and horrified pick up a back issue of "Creative Computing" or the book "Games in BASIC" by David Ahl.

Most modern languages are both a hit and a miss when it comes to learning how to program.

Block languages will get you started, but are rarely flexible enough to do anything real. You can do anything in C/C++ but pointer notation is incomprehensible to most newbies. Java eliminates the need for memory management, but the cross platformness of it make doing anything impressive problematic. Javascript is straight forward and ubiquitous, but is overly focused on the web. Python comes close, but its syntax encourages incomprehensible one liners that can scare even practiced coders away.

The language you start off with matters... but it won't really make a difference. All programming languages are both perfect and horrible.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks for the link to Creative Computing, I magazine I didn't know. The first article in the first edition there was a review of my first ever computer (Jupiter Ace). Some of Ahl's games (e.g. Hamurabi) make nice exercises or mini-projects for introductory programming courses. Unfortunately "someone" is making a website of translations of the programs into more modern languages, which rather detracts from that (github.com/coding-horror/basic-computer-games). $\endgroup$ May 16, 2022 at 14:46
3
$\begingroup$

My 2cents on this topic. I certainly do not know if the first programming language has life long impacts (as an old guy whose first programming language was COBOL I sincerely hope there is none :-)

But there are measurable effects of the programming language in relation to students outcomes in a CS1 course. Let me unashamedly plug in my own research https://dl.acm.org/doi/abs/10.1145/3152894 (this is behind pay wall - there is a non pay-walled version here

Copying from the abstract:

We performed a controlled experiment comparing a C and a Python Introductory Programming course. Three faculty members at University of Campinas, Brazil, taught the same CS1 course for the same majors in two different semesters, one version in Python and one in C, with a total of 391 students involved in the experiment. We measured the dropout rate, the failure rate, the grades on the two exams, the proportion of completed lab assignments, and the number of submissions per completed assignment. ...

We observed no difference in the dropout rate, and the difference in the failure rate was in favor of Python but not significant. All others were significant in favor of using Python.

We did not measure why Python is better, but one can list some reasonable possibilities:

  • simpler syntax
  • no need for type declaration (which may be a problem later in the student's carreer)
  • Python lists as a container type with a simpler semantics and syntax than C arrays (including bound checks, syntactic representation, extensibility)
  • lack of call by reference
  • lack of pointers
  • interactive environment

I have another research (still unpublished) that Python as a first language does not negatively impact student's outcomes in a C based CS2 (data structures) course.

So Python is better than C for a CS1 course and has no nagative effect in a CS2 course. How does it impact the rest of the student's programming/CS career, we do not know.

I also think that the third programming language in a student's learning experience should be a functional programming. Unfortunately not only I do not have experiments regarding that, but in my department I can only teach a functional programming as their fourth language (after Python, C and Java) Not that there is a big loss of being the fourth language instead of the third, but I fear that after a semester of Java and OO development we lost some of those young minds - some of them will never see programming as fun again!! :-)

$\endgroup$
0
2
$\begingroup$

When teaching more or less anything it is best if students are able to understand what they are doing as fully as possible. "Doing without understanding" is a particularly bad approach to programming and unfortunately is very common these days because the amount of on-line tutorial material and overly-helpful (from a learning perspective) tools that make it easy to do typical pedagogical/andralogical exercises without any real fundamental understanding of what is actually going on. The choice of programming language can encourage or discourage this. C++ is (these days) a particularly bad choice of first programming language as the students will be using a lot of advanced techniques whenever they use the libraries (e.g. std::string is a template) and the error messages they get from the compiler will only be understandable if you know those techniques. Understanding compiler messages is a very important skill to learn. Similarly, IDEs encourage you to use things like move semantics (static analyser) and the students will often put them in without knowing what they are doing. Much as I love C++, Java is a better choice of programming language.

So if you have a choice, choose a language with the features you need, and which can be explained in a progressive way, always building on things that the student is able to understand well at the time when they first introduced.

$\endgroup$
0
2
$\begingroup$

Logically the answer to your question is "yes it matters". Teaching machine code as a first language is probably not a great idea. But what are the considerations on why it matters?

  • Feedback and the ability to create small working projects quickly. Being able to create working (and even graphical) examples is incredibly motivating and helpful. JavaScript would be a good example.

  • Similarity to widely used imperative languages. It will give the student a clearer idea and perspective on what programming is about, which is definitely within the purview of education. Sure, they'll figure it out through time and experience, but why not help them? Lisp might be a bad choice here.

  • Simplicity and elegance of the language. Beginners should be focusing their time on learning fundamentals, not in figuring out esoteric shell quoting rules.

  • Well established and supported language. Don't use the newest shiniest language for teaching (or anything else). Having access to resources, debuggers, forums, libraries, source code examples, etc is vital for beginners and old people alike.

$\endgroup$
0
1
$\begingroup$

Of course it is highly relevant. Optimally, you would prefer to start teaching with a more high-level language like Python, not low level one as C or assembler, nor outright bugged one as C++. Otherwise, you are going to have to flood the beginners' minds with insane amounts of details that are completely irrelevant from a beginner's point of view before they are capable of writing even a simple "Hello World"; the students would get the impression that programming is about memorizing gibberish, magical incantations that most often look like badly misspelled words, like main(int argc, char **argv), scanf("%d",&x) or .globl _start: instead of being about logical algorithmic thinking. Best strategy for satisfying teaching/learning experience is to teach students the most powerful concepts in the context of their current knowledge levels -- otherwise, it is more reminiscent of regurgitating loose pieces of information in the students' general direction, rather than teaching them to do anything useful.

Let's say that all they know is printing and reading from the terminal, and you want to teach them how have a program ask for user's age and name, and then print a personalized greeting message using that age and name. It is much less productive and pleasant if beforehand they are forced to learn a bunch of completely irrelevant details for the time being, like in case of C: the concept of a call stack, the difference between how a computer treats numbers versus lines of text, the fact how the numeric variable is storing the number like one would expect but the variable representing line of text actually only stores an address of a remote location where the line of text begins, difference between passing by value versus passing by reference, the fact that arrays are similar to pointers but also not really that similar -- which is all required before one can fully comprehend why the cryptic gibberish incantation for reading a line of text with "scanf" does not need an ampersand added to the name of variable representing a line of text, while the ampersand is needed in case of reading a number. In such case, students are forced to learn a whole lot of details that won't be actually useful for them until much later in their education, and that is discouraging. Good education is about filtering the information you are passing to students to distill the most relevant pieces, not about regurgitating all the random and unrelated chunks at them.

$\endgroup$
5
  • $\begingroup$ (Not your downvoter, BTW). But when you say "Optimally...", you are expressing a personal choice (which I happen to agree with), but not a law of nature. There are lots of folks who want to teach a purely bottom up curriculum, following the historical development too a large extent. $\endgroup$
    – Buffy
    May 16, 2022 at 20:44
  • 1
    $\begingroup$ As @Buffy said, "optimally" is highly opinionated and unlike Buffy I would doubt that very much. "outright bugged one as C++", ah what? If you are using .global_start: as an example why you shouldn't use C++ as a beginner language you are doing something VERY wrong. It takes about 10 minutes time to turn C++ into a beginner friendly language. I have used cin/cout perfectly fine without any callstack knowledge and I'd argue the difference between numbers and strings is one of the five most fundamental things in CS. Arguably Pythons "I'll do whatever the f*%& you want" approach can produce $\endgroup$
    – Max
    May 17, 2022 at 8:17
  • $\begingroup$ fast result but can be detrimental to actual understanding (as I said arguably, both have pros and cons but you make it seem like anyone who learns the difference between int and char before their fourth year, will be scarred for life). Overall your answer gives off the sentiment of either "CS students must, under no circumstances, be challenged at all" or just an outright rant about a worst possible teaching practice (while twisting arguments in a weired way). $\endgroup$
    – Max
    May 17, 2022 at 8:45
  • $\begingroup$ @Max C++ is indeed heavily bugged and there are a lot of different examples. For instance, would you guess what does cout<<ptr do if p is a pointer to a volatile variable? Legit and totally reasonable behavior -- it's not bug, it's a feature! Another example is buggy std::vector behavior. .globl _start: is a line from assembly language that I listed as one of three examples, it is not C++. "CS students must, under no circumstances, be challenged at all" would suggest that Python is {continues} $\endgroup$ May 18, 2022 at 20:45
  • 1
    $\begingroup$ @Max never challenging, which is puzzling to say at least. $\endgroup$ May 18, 2022 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.