Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

JavaScript runs everywhere, and every web browser these days has really good JavaScript dev tools built into it (nothing to install). Python might be a bit easier in terms of syntax but if the kid has an interest in tinkering then learning how to search/parse the text of a website using the browser's Console, that can be the gateway into NodeJS programming.


I concur, which I think is ironic since I think Javascript is a terrible language.

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.


JS is probably one of the worst languages for a beginner

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...


I feel like all of that is secondary compared to the fact that JavaScript lets a kid immediately create something they can see. Sure, if you want to teach CS it's not my first choice, and if you want to interact with things you'll need a library, but once you add in that kind of stuff you're stepping up a complexity level anyway. Anything you need to build something simple is in the language, and along with HTML you can build things cool enough that there's time to learn before you outgrow it. Once you get around to making a real application those issues all apply, but I mean my first brush with programming was Minecraft mods and they're a million times more finicky. I stuck with it even though I was writing in notepad++ and taking 5 minutes to test each change because the end result was something a 12 year old wanted!

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.


I agree that video game modding (Java for Minecraft or Lua for Roblox) is also a great introduction/motivator for learning programming. The key thing is even though these languages may also be as complex as JS, using them for modding usually have a "happy path" to getting started with many complexities abstracted away or completely disabled for obvious security reasons.

Alternatively if they do not play those games, then maybe a visual programming language like Scratch would be suitable.


I can assure you Minecraft modding gravely lacked a happy path. At least, less of a happy path than a simple HTML doc pointing at a script in a local directory.


I program in JS/TS primarily. I’m quite proficient. There are a few little nitpicks I could offer here, but in good conscience I just can’t bring myself to do it. Because I can’t in good conscience recommend anyone start with JS in the current state of its ecosystem.

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.


I disagree - when you start out, just seeing something happening is exciting - with JS, a tiny bit of CSS and HTML, you can have a real website deployed that does something in a few days of learning.

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.


Most languages can be installed with `apt get` or `brew install` nowadays. You may not get the latest versions but it's not like the old days where you have to download and compile from source and then update your PATHs anymore. I think Ubuntu comes preinstalled with python too.

While it's true that you can get started quickly with a <script>, I think you'll encounter inexplicable walls much quicker than other languages.

If you limit yourself to WebAPIs, you'll have a even smaller toolset than node. Not to mention most tutorials are assuming you are executing in node and not a browser e.g. file system access which was only recently available in Chrome and not implemented in Firefox. You also can't interact with most of the web due to CORS (such a common problem that it's pretty much a rite of passage for any JS developer now).


You seem to believe you need to teach a beginner every small detail from the start. You don't. You don't need to teach npm, yarn, pnpm, esm, cjs, transpilers, execution models, webpack, vite, snowpack. None of it.

Start with: console.log('hello')


By that logic, any language is fine. The problem is how do you follow up to keep them interested after some simple stdin/stdout exercises? Trying to accomplish anything interesting beyond solving leetcode questions in JS requires going into the npm ecosystem.


… Or you could script a button to do something interesting!


Really? I'll let my work know.


Indeed, the plain HTML plus JavaScript have been the best option for a kid to get a taste of programming ever since they became available.

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.


Start with a simple HTML template called with 'theirname.html'. Add a JS loader: <script src="theirname.js"></script>. Load that page in browser; bookmark it. (Easy access!) Now whatever they edit into theirname.js will 'run' when they reload the page. e.g. alert('Hello World!') When they're ready to add an image, time to learn a little HTML ;-O


A little interactivity helps to keep the kid engaged. It is amazing to see how much fun emulating a simple desk calculator in HTML can be.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: