Criteria I’m working on are:
1) Ease to get to “Hello World”.
2) Kid-friendly, easily available learning resources.
3) Low setup complexity.
It’s been so long since I’ve been there (VB6!) that it’s harder to know in 2022 what the right advice to give is for someone just starting out.
I also thought about steering them to HTML first, but I don’t think the open web as the same excitement factor for someone starting out in 2022 that it did for me back in the day (which is a shame).
What do you folks think?
And I don't say that lightly, because I view most programming languages as being pretty much on par. They're all fine; the differences are more about framework and support than the language in itself. Javascript is one of the few languages so poorly thought out and so badly evolved that I actually say it's a bad language.
And yet it's ubiquitous, easy to learn, and (after decades) has reached a point where you can mostly step around the worst of the landmines. I'd even say that Typescript is pretty good, though it's probably best for a first-timer to be able to skip that.
Its execution model (single threaded, libuv callback scheduling) will be extremely difficult to understand without some OS background knowledge. It's also different than almost every other mainstream language so it's not even transferable
Its tooling beyond the browser console is still awful. Good luck explaining ESM/CJS and transpliers to a beginner
It has a non-existent stdlib compared to other libraries so you have to explain how to use npm/yarn/pnpm, how to pick the right package, how to resolve paths to them, and eventually bundle them with webpack/vite/snowpack/etc...
Obviously there are better purely pedagogical languages (I'm partial to Racket myself), but those are suited more for the classroom. In terms of getting a kid hooked, in this day and age the best option is JavaScript. Back in the day it was Basic, even though Basic sucks and sucked for anything complicated. For me it was a janky Java setup I downloaded off of a shady forum. The execution model or transpilers have nothing to do with it.
Alternatively if they do not play those games, then maybe a visual programming language like Scratch would be suitable.
Part of the reason I’m so proficient in JS is because I’m really stubborn about learning why things break, and have had decades of practice to hone skills around that. But if I were new to programming today and started with web tech, I would have just given up. The amount of shit you have to know just to even start debugging a problem in a common setup is plain bonkers.
I’ll add one more thing to your “good luck” part: good luck building a mental model of client/server. Even if you’re just targeting client, you’re SOL because everything assumes you’re also running Node. Even the stuff that’s ostensibly compatible is either subtly not or built on additional complexities like polyfills with their own respective set of caveats.
I’m even pretty enthusiastic about the direction the ecosystem is going, I think these things are likely to get better over time. But I can’t imagine throwing someone into its current state and expecting anything but sadness and defeat.
Any other language, you'll be stuck in the terminal/figuring out how to install things for days (as a beginner). For a website, you just need a `html` file with a <script> tag!
When learning new things, quick wins and feeling progress is really important, so I always recommend the easiest tool to get started with, not necessarily the one with the best model or fundamentals.
Start with: console.log('hello')
I find Python to be more useful in general (should be taught in high school to everyone, in my opinion), but it is just less fun for a kid.
All 3 in that order, they don't need to go super deep on C, they can spend a couple of weeks on it - you go from programming on a very high level, to programming on a much lower level, and then to a language that takes care of lots of stuff for you (and you get to appreciate it more).
It's what CS50 does, and it's the best for complete beginners, including kids. The point is that they're learning about programming and software, they aren't learning a specifc language. I think that being exposed to more languages early helps with learning because it allows you to grasp overarching concepts instead of thinking that things are done only in the way your first language does them and then having to unlearn stuff much later on.
Just a recently my 14 yr old brother came to me super confused about why does his python code change all the values in the list when he is only changing one, and explaining that one object "lives" in some memory space and the list just points to it multiple times is quite difficult without more low level knowledge.
Lazy Devs on youtube is currently producing a "Making a Shmup" tutorial that is very "from the basics" as well.
https://archive.org/details/simple-basic/mode/2up
I have a feeling my Minecraft infused 7 year old would be immediately bored of it anyway but I wish I still had it to give to him.
for a kid, learning programming might be more compelling if filtered through something fun (just running code in a REPL isn't fun for most people.) I want to suggest Roblox because a lot of kids (like my nephew) apparently learn to code on that (in lua I believe) but I've also heard it's a bit exploitative. There is always also minecraft modding which I think uses java. Also Godot and GameMaker use simplistic programming languages.
Beyond that, I'd say either Javascript or Python, the first just because you need nothing more than a text editor, the second because of pygame.
1) The "Hello World" is just to type "Transcript show: 'Hello World'" in the playground, and then see it printed to the transcript window;
2) It's a Smalltalk family language, with minimalistic syntax, and a environment that makes easy to learn it by exploring, initially developed as a means to teach children;
3) It adopts a image-based development approach, so everything you need in terms of tooling is contained inside the system image, and available out-of-the-box. There's no need to set up a complex set of interlocking dependencies to get proper environment and tooling.
There's a MOOC at https://mooc.pharo.org/ and free books at https://books.pharo.org/
Squeak, the Smalltalk dialect from where Pharo was forked also would be a good alternative.
The documentation is excellent and filled with examples. https://processing.org/reference
It's one IDE to install and "play" button to press to execute code. "The coding train" provides a lot of videos for beginner or intermediate programmers to learn, and Daniel Shiffman is in my opinion an excellent teacher. https://thecodingtrain.com/
Then also if they get a Raspberry Pi Pico (which is only $4 or $5), Arduino, or just about any other microcontroller board, they're already set up to be able to control and program them, too. Lots of branching out potential, and a painless learning curve.
Python is pretty good if they have to handle hairy data structures, or just want to use the huge selection of libraries.
I share this as preamble to why I recommend Swift Playground...it will get them going and be somewhat self directed. They will feel like they are actually achieving a goal rather than just typing text. And, if they take it to the next level they will be able to transfer their knowledge into "real" apps.
Second to this would be Python, because it's a great teaching language. That said, I think it's about the curriculum you put in front of them even more than the language.
In short, Python / JS for quickest to pick up and make something cool. Rust if you’re interested in learning how computers work.
[1] https://blog.basedcount.com/choosing-your-first-language/
Minecraft Education Edition - choose between Scratch, Python, and JS.
Battlesnake - any language with web server capabilities.
Electronics - C++, MicroPython, or Lua with NodeMCU
Love2d - Lua
PyGame - Python
etc.
I hesitate to recommend JS because it seems to introduce really bad habits, but it's hard to beat the feedback loop of writing code and seeing something in a web page. Lots of kids might be motivated to build an io game to share with their friends, for example -- JS on Replit or Glitch is perfect for that.
On youtube, search for autohotkey and filter by new you'll see 75% of them are just that. Find a game he plays and start learning.
Very strong, very deep user community.
(FWIW, Rust seems to be a strong second. Don't know why, don't know anything about Rust).
Maybe there's some low-power device that would let them explore their interests, if only they could program the device.
And that would limit programming language choice to those available for the device.
- Swift
- Python
- C[++]
- Javascript
- NetLogo (maybe)
Go with python, it's very popular plus there are a lot of resources for it. And ultimately it's relatively easy to learn. Once he gets a handle of python then re-survey the situation and go from there.