Hello,
I am thinking about teaching my students JavaScript first so that they can start creating websites and make their career, what are your thoughts?
Like a lot of people mentioned, there’s a few good things you could start with, but C is probably not one of them. At my old job I ran a course for software engineer 2s to go over C, and even they had some struggles with it. If professional engineers struggle with C, it’s maybe not the best starting point. Even C++ might be better, but still adds a lot of complexity that isn’t necessary to know as immediately as the beginning.
Whenever people ask me where to start, I say python. It gives you a relatively tame taste of environment setup, and can run code very easily and flexibly. Its type system is flexible enough to make a user aware of it, without it being as rigid as C or as vague as javascript. Because there’s enough libraries that are easy to pull in, even a beginner can start building useful programs without having to know how to build something equivalent to those libraries themselves.
Obviously if you want them to make websites, javascript will be necessary eventually, and isn’t a bad place to start. If you’re going purely for CS knowledge, I do think python is a little better; going from python to JS is probably easier than JS to python.
Probably JS as the fact that every computer has by default everything you need to execute JS. But there is a bunch of browser stuff you have to worry about before you can do anything with it. I’m not sure how you learn JS before html.
With Python you can do simple command line stuff without having to really know anything else. You can learn one concept at a time.
That being said, people have a lot of familiarity with browsers and it might feel less abstract. JS might a better choice for demystifying coding. Python is probably a better choice for accomplishing anything useful.
C teaches a whole variety of low level concepts that are helpful in any comp sci field. That’s my vote. Python holds your hand too much and JS would require more to get started. If they aren’t shooting for a comp sci degree and are just looking for helpful scripts then python would be fine.
If you’re wanting to teach programming concepts, I would start with scratch instead. This can be taught to little kids or older students. It’s what the free comp science class from Harvard starts with
JS for sure.
It has a reputation among programmers as being a bit of a mess, but I think the reasons behind that reputation are largely irrelevant to your use case.
Basically:
- It has some bad decisions about basic stuff, like truthiness, equality, coercion. But those aren’t major stumbling blocks, really. When they run into those situations, they’ll probably already be aware that they’re trying something weird and won’t have the same already-developed intuition about “how it should work” that many of us are bringing to the table.
- Production deployment can easily turn into a Rube Goldberg machine. I think this is mostly what the kneejerk “really? JS?” response is about. Different ES versions, module systems, WASM, dependency hell, transpilers on top of transpilers, and a billion different runtimes. And the fact that everyone and their grandma apparently wants to build a custom DSL on top of JS that requires additional transpiler plugins or codegen steps. But your students won’t have to worry about that shit. Just pick one environment and do that. Maybe warn them that stackoverflow might use different syntax (require vs import) or try to import stuff that doesn’t exist in their environment though.
If there’s a need to introduce students to virtual DOM, I’d choose a library that doesn’t require language extensions or editor plugins, but allows to easily code with just the syntax of JS itself: properties as Plain Old JavaScript Objects, map/reduce with arrow functions, ternary operator, variables as usual, components as functions. Adding Mithril to existing WordPress websites for making dynamic parts such as calculators or quizzes was quite straightforward. On the other hand, its API is somewhat less convenient than what React offers.
Go(lang)
C and python simultaneously.
After reading through some of the comments, here is my opinion.
C would be a good language IF you know your students plan to get into IT, specifically a sector where the low level knowledge is useful. Beyond that, I assume your students probably use windows and I personally always find it a pain to work with C on windows outside of full IDEs like jetbrains and Visual Studio. It’s also a lot more work till you get some results that you are happy about. Unless you start with an Arduino, which I find pretty nice to get students interested in embedded stuff.
I don’t like JavaScript because I find it a mess although it is very useful for anything web related.
Given you said in another comment that this is meant to be a general purpose skill for your students I would strongly recommend python. While I dislike the dynamic type system, it is a very powerful language to get stuff done. You can quickly get results that feel rewarding instead of running into hard to fix issues that turn your students off of programming in general. Also it’s very useful outside of IT as a scripting language for analyzing data in basically any field or for generating nice plots for some document
I would say C first. You need to learn the fundamentals:
- pointers
- allocation
- reference vs value
- recursion
- stack
- panics, errors, error propagation
- data structures
Many devs don’t know it and they are honestly just clueless about anything they are doing. They just want to make it work.
JavaScript is just too high level, and makes you think you are immune to these low level concepts, but you are not.
And not only that, but also good practices, like:
- git
- linting
- types of tests and how to implement them
- working with third party dependencies
Ah, thanks for reminding me about git. I almost forgot that it’s also a thing which new comers struggle with.
I’ve been working as a software engineer for years and not once have those “fundamentals” been relevant to the work I do.
If I question their usefulness then I don’t think it’ll sit well with no experience at all.
If you’ve been working as a software engineer for years and things like error handling and data structures (let alone git and testing!) are not relevant to you, I fear for your employer’s codebase.
Hah! You picked the two of your list that I actually do care about.
- pointers * allocation * reference vs value * recursion * stack * panics, errors, error propagation * data structures
I don’t know what pointers are. I don’t care about memory allocation. Recursion rarely comes up.
That’s not the kind of codebase I work with. I guess I’m not a proper big-boy programmer 😢Anyway, your snide remarks about my abilities aside, that doesn’t address my point at all.
First of all, it’s not my list. Check the usernames of the comments you’re replying to.
Second, you didn’t make any sort of distinction limiting which ones you were talking about before, which means that you expressed that none of them were relevant. You don’t get to move the goalposts and then pretend it doesn’t address your point because of that.
Third, that sloppiness and failure to pay attention is only reinforcing my initial impression.
Calling me out on a clarification when you’re banging on with ad hominem rubbish?
Respond to the point or bugger off. I’m not here to impress you, you’re not my dad.
Third, that sloppiness and failure to pay attention is only reinforcing my initial impression.
A good engineer knows when the details matter and when it’s just wasting everyone’s time. Would you classify responding to someone being needlessly hostile as something other than a waste of time?
If anything you should be criticising me for choosing to spaff more time on this conversation.
You weren’t “clarifying;” you were backtracking and lying about it. That’s a detail that matters.
Respond to the point or bugger off.
I wouldn’t say that pointers and memory allocation is a good thing to start with. I teach programming to students with no prior experience, and sometimes it’s hard to even get them to grasp basic programming in Python. At least in the beginning. You have to start slow.
I think JavaScript and web app development will be among the first programming jobs to be eaten by LLMs, and it’s already a crowded field. I’m skeptical of that being a wise career move for newcomers today.
I don’t know how old your students are, but there is also MIT Scratch.
+1 to scratch, I’ve used it to both teach kids at one of those “stem summer camps” and adults who do recruiting for tech firms. Both groups were able to pick it up pretty quickly
Neither. Teach them Scheme. They need to start by building good habits (functional programming).
“Learn the rules like a pro, so you can break them like an artist.” ― Pablo Picasso
Yeah who teaches JS for compsci?? Scheme and Python are MIT-standards for a reason.
Python. They’ll only learn bad patterns from JS. Please teach bottom-up knowledge, not top-down narrow scope.
The fact that every computer has a browser where they can practice javascript probably makes it the better option. Python would probably require, on Windows, some setup that isn’t what you want to spend time on, and may be a barrier to them trying stuff on their own time at home.
Javascript is a horrible language, but it is ubiquitous. You’ll want to spend a little time on html and css if you expect them to do more than print output.
You could focus on TypeScript, which will help them avoid some of the worst things, but then you spend more time on tooling and it won’t just run in the browser console.
Python is a reasonably popular language with a good standard library. It has fewer bizarre quirks like adding two lists of ints together to get a string.
I wouldn’t teach C to a general audience.






