6 ms·
What do you think about teaching JavaScript as the first programming language rather than Python? I know that some think JavaScript is a better choice [1], beca
by mwcampbell 10y ago
What do you think about teaching JavaScript as the first programming language rather than Python? I know that some think JavaScript is a better choice [1], because it's so much easier to produce a real application as opposed to a command-line toy. But the opposing argument would be that JS has so many flaws, or more charitably, it's such a quirky language. Also, any opinions about Khan Academy's platform and lessons for learning to program with JavaScript [2]?
I'm not a parent, but my friend's 10-year-old son has asked me to teach him to program.
[1]: http://prog21.dadgum.com/203.html http://prog21.dadgum.com/203.html
[2]: https://www.khanacademy.org/computing/computer-programming https://www.khanacademy.org/computing/computer-programming
- brianwawok 10y agoI would never inflict JS on a kid I liked
- mwcampbell 10y agoIs that just knee-jerk dislike of JS? If so, that's nothing new. Haters gonna hate. Or are there specific language misfeatures that you think get in the way of learning?
- freehunter 10y agoI think JavaScript is a perfect entry point in a way that Python doesn't seem to even try to be. Sure there are warts and syntax problems and it's a little weird but beginners for the most part won't even run into that. But for that one small, minor downside, all of the upsides far outweigh it. It's used everywhere (almost literally) so it will always be relevant. It's super trivial to get something to print graphics on a screen, where Python graphical frameworks are scattered, outdated, or limited in functionality. Compare PyGame to Phaser and you'll see what I mean. JavaScript is the right way. Python is right for a budding computer scientist who won't care that they're limited to a terminal for months while they learn. Javascript is right for everyone else who wants to see some immediate and modern progress while they're learning.
- ChicagoBoy11 10y agoWhat I find makes teaching programming in JS challenging is that, by its very nature, there is a lack of a single canonical resource that you can go through to build out your understanding from start to finish. This isn't to say that such resources don't exist, but the fact that Javascript is the language of the web will simply make it impossibly difficult to follow a nice coherent pattern and you/the child will instead inevitably slowly drift to other things, and the risk is moving onto other concepts before the necessary scaffolding is in place and before they have a firm grasp of basic programming principles. Since the "web" is right there, it will be hard to fight the urge to start to do "engineering" while the focus should be on basic cs and programming concepts. My advice (former school administrator) therefore is to teach programming to a kid using a canonical resource that they can use as a bible, but one also that will give them the freedom to build interesting things that they can share with others. I think Matthias Felleisen's HTDP is a fantastic book. You simply can't beat it when it comes to talking about patterns, design recipes, and overall how to test and think about an algorithm. And while the syntax may be challenging at first, functional programming and LISP in general actually offers less of a mental leap for kids who are used to algebraic expressions and function composition. If this is a gifted 10-yr old, HTDP with some adult guidance will offer you the best bang for your buck long term. Some of the projects at the end even involve networked games, so there will be plenty there to motivate a hungry youngster.
- mwcampbell 10y agoThanks for sharing your perspective and advice. What do you think of Pyret (http://www.pyret.org/ http://www.pyret.org/) and the accompanying textbook (http://papl.cs.brown.edu/2015/ http://papl.cs.brown.edu/2015/)? That should meet your criterion of a canonical book to work through. And that book is written by one of the authors of HTDP. But Pyret has a more conventional syntax and runs in the browser.
- ChicagoBoy11 10y agoAshamed to admit I don't have any familiarity with it! I can vouch for other content of Shriram's that I came across, most notably some of his labs for his CS class at Brown -- they are absolutely awesome. So, I've got a feeling this is a prob. also an excellent book. EDIT: I forgot to add this: I mentioned that the syntax is challenging to kids at first BECAUSE there are so few rules, there is quite a bit they have to keep in their head as they write even very simple programs. You have to very quickly internalize the idea of function composition or else you are stuck, and that may be challenging for a young child at the beginning. But, at the same time, I think this is also a huge STRENGTH of the syntax. If he/she isn't getting this, it is pretty obvious and you simply cannot go anywhere until this happens, which isn't necessarily a bad thing. And, once they grasp this concept, then it is actually extremely easy because there aren't really any other syntactical rules to memorize and keep in order! This did require a lot of focus of kids, but I think there was something reassuring in the fact that they felt confident they understood all of the necessary principles of how the language was working, and that if they experienced issues, it was either in their own logic or in chasing some rogue parens. YMMV
- tmsam 10y agoAs a former teacher, who ran a programming club at a middle school and taught an advanced 8th-grade math class included programming, I have some perspective on this. I would say, be wary of "fundamentals" and "doing things the right way." Teaching a 10 yo something optional needs to be fun, or else it won't happen. The author of this article nails it: there's nothing quite as motivating as adding "Poop" to the title of a real web page. Also, you can Inspect Element and get what is effectively an IDE. Is JavaScript the best language? No, it's inconsistent and confusing. But, so is English, and a lot of people learn English first - because it is practical to do so. Another option that can be useful are Google Sheets. If they are a certain type of kid, they might like logging all of their toys in a spreadsheet and finding the total of the toys and making charts. Of course, most kids will find this boring... but you can also use Google Scripts to do something like scrape a subreddit and store it in Drive [1], which could be fun. However, why not start with Scratch, or Snap! [2]? They are powerful enough (especially Snap!, I think you can define new data types in it...) and so much less intimidating. [1] http://ctrlq.org/code/19600-reddit-scraper-script http://ctrlq.org/code/19600-reddit-scraper-script [2] http://snap.berkeley.edu/ http://snap.berkeley.edu/
- mwcampbell 10y ago> Teaching a 10 yo something optional needs to be fun, or else it won't happen. That matches my intuition. But the word "fun" brought back to my mind this epigram by Alan Perlis: > It goes against the grain of modern education to teach children to program. What fun is there in making plans, acquiring discipline in organizing thoughts, devoting attention to detail and learning to be self-critical? Unless I have completely misunderstood this epigram, I think the point is that programming, when done well, is not fun; it's work. So maybe if we try to make programming fun so we can teach it to a child, we're setting bad expectations for what it will be like if they pursue it seriously. So I guess that means that when teaching programming to someone of any age, we do need to focus on fundamentals and the things that Perlis mentions in that epigram. Then, if a 10-year-old kid loses interest, we should just let it go. Makes me wonder if I and other self-taught programmers of my generation (I was born in 1980) built our careers on a bad foundation. I started learning to program in BASIC on my family's home computer when I was 8 years old, because when just dabbling in BASIC, it was fun. Even tinkering with assembly language was fun. But the important thing to note is that as far as I can recall, I produced only one truly worthwhile program as a pre-teen, and that was one that a relative asked me to write. And that was a serious project, not a diversion (AFAIK, the latter is the definition of fun, as is apparent from some languages like Spanish). As for Perlis's jab at "modern education", I suppose the take-away is that we need to teach kids early that life isn't fun, rather than trying to make everything fun for them.
- d0vs 10y agoIMO (and I dislike JS) it doesn't really matter. If the kid is really interested, they will go out of their way to learn new languages eventually.
- thesimon 10y agoThis may sound strange, but maybe even Visual Basic or C#? It allows you to easily create GUI applications and I assume thats what's interesting. Switching to other languages is easy enough, but capturing interest is key.