What is the best first programming language?

What do you think is the best first language to recommend to people, and why? This question comes up a lot, and I’m curious what people think.

I usually recommend Python or JavaScript. I think Python is easier because some parts of JavaScript are asynchronous, but many people seem to do fine with JS. It also depends on interests (data science or web development – if people are doing some other kind of programming, they tend to know what language they want to learn).

Another approach would be to start with something like Harvard’s CS50 course, but I haven’t gone through it.

Are there any other languages that might be a good first choice? C? Ruby? Scheme? Perl 6? :slight_smile:

2 Likes

I’m curious to see other people’s thoughts on this question. I’m especially interested in regards to the best first language for kids, as I’m debating that with myself right now. For the most part, it seems hard to beat Python for this, with its very simple and clean syntax (no need to create a class just to print “Hello World,” as with Java for example), its REPL, and the huge variety of available resources and applications.

One possible drawback of Python though is that kids often want to create something graphical right away, especially creating some sort of simple game. Something like this seems much easier with JavaScript (than with pygame, say), especially with something like p5.js. JavaScript also has the advantage of making it very easy to share programs with friends.

But a drawback for JavaScript as a first language, in my opinion, is that it’s so tightly bound with webpages, and having to drag along some HTML, etc. every time seems confusing/distracting for beginners (rather like the required class creation I mentioned above).

So, I sort of go back and forth in my thoughts on these two. But maybe there is a third, better choice?

2 Likes

I think it depends a lot on why someone is interested in programming, and their age.

I got interested in programming because I wanted to make games. I discovered a platform called BYOND that had a proprietary C-derivative called DM. I made a bunch of goofy games.

If someone wants to make a website, they should learn JavaScript, HTML, etc.

If someone wants to get into games, I’d recommend they learn C# (and Unity3D) or C++ (and Unreal Engine).

I’d agree that for general purposes, Python has the lowest barrier to entry.

2 Likes

I wonder how important the first project is when learning programming, maybe as important as the first language? When I took a programming class in high school our term project was to create our own game with a partner, and I have hugely fond memories of that. When I took a programming class in college our term project was to create a line editor (by ourselves), and my memories of that are fairly dismal. I’m thinking that one of the biggest advantages to self-study is the freedom to pick your own project (and I think it helps to have one in mind from the very beginning).

1 Like

Yes! And not just kids. As someone with an arts/music background I gravitated to javascript and p5js, and found the immediate visual feedback super helpful (especially when I compare it to the python course I took in college).

Also, Sonic Pi, which uses ruby, is an awesome way to learn programming concepts while making music. If you have any kind of musical background it is pretty easy to get into it, even without any programming knowledge. As a teacher, I have found it to be an awesome way to introduce programming to kids. As a musician, it opens up a lot of cool possibilities.

2 Likes

I enjoyed learning Ruby first as an easy language but I agree with the visual stuff- I was getting frustrated doing a bunch of basic Ruby programming that all printed to the terminal and didn’t have any visuals. Now though I prefer JavaScript for the way I can easily make interactive websites with images and different forms of user input and whatever else. JavaScript currently for me is easier to be creative with, which is super important in motivating me to start projects and learn new techniques. It was a pretty easy transition from Ruby, but I think js might be more difficult syntactically as a first language.

1 Like

Reading and pondering over people’s thoughts here, I’m thinking p5.js is a good choice for my son to try first. It allows for graphics, animation, user interaction, etc. and it allows him to learn JavaScript syntax while not requiring him to learn much (if any) html, css, etc. at the same time. Their new web editor seems especially helpful for that. So, I think we’ll give it a go.

2 Likes

It would be difficult to beat JavaScript in terms of simplicity as a first programming language with Node JS as the focus. I was teaching at a coding academy last year, for what it’s worth.

For anyone who might suggest that JavaScript is browser-based, that’s what it used to be. It’s evolved a lot over the years.

hello

#!/usr/local/bin/node

console.log('Hello, World!\n');

To run it:

./hello

I spent more time teaching my students how to use their Terminals and installing software than navigating the syntax of the language itself.

1 Like