6 ms·
It seems this is aimed at young people learning how to program. My main problem with using Javascript as the first programming language to learn is the asynchro
by lrmunoz 5y ago
It seems this is aimed at young people learning how to program. My main problem with using Javascript as the first programming language to learn is the asynchronous callback paradigm, I believe it's too complicated a concept to teach in the very beginning (and you can't get around that with Javascript).
When I evaluated different languages / environments to start teaching programming to my daughters I decided not to use Javascript because of that, chose Python instead (and now I'm also considering making games with Roblox, which is based on Lua. The dev environment is quite complex but with supervision Lua is a nice & simple programming language)
- hutzlibu 5y agoHm, but how does it work in python? Don't you have asynchronous calls there, too? (my main problem with JS as a programming first language is its C-Style syntax)
- crooked-v 5y agoThe secret of Javascript syntax is that, once you grok how functions are just special objects, it's actually a Lisp with a bunch of weird cruft attached to it.
- hutzlibu 5y agoAnd that is very helpful for a beginner to know ...
- RobertKerans 5y agoYes, but it isn't the core way the language works -- you don't need to approach asynchronicity very early on as you do with JS, and it's not all closures. At some point someone learning Python will have to do something async. But what they can do up until then is just not do anything async, and that's fine (just wait for stuff to complete...). That's not really an option in JS: the great benefit of the language from a learner perspective is that it just runs straightaway in the browser, everywhere. But to actually do anything interesting (click a button, make something happen), that's async. Re. the syntax, anecdata but I've helped beginners through their initial steps for about 6 years now in JS (and Python) and C-type syntax is just not an issue that slows down learning or causes issues. There are only so many different ways syntax can be structured so it's sane for a compiler to parse, they all work basically the same way, and people get used to a syntax really quickly
- tobr 5y agoI’m sure you know about async/await in JavaScript? It sounds like the issue you have is not so much with the traditional paradigm of using callbacks, but the fact that the “default” environment in JavaScript is a GUI rather than a CLI, meaning that you need to figure out things like event handlers pretty early on?
- RobertKerans 5y agoYes, default environment is the browser, that's a given and that's fine: if you are a beginner, making stuff happen there is easy and rewarding. Everyone has easy access to it [I apologise for being a little snippy here]. I don't have an issue here: I don't think you & sibling commenters are really getting that these are beginners I'm talking about. Yes, I am aware of async/await. With the browser being the default environment, a beginner has to understand callback-related programming with JS quickly: they need to be able to say "I want to do this then this". You have do this via callbacks. You can write JS synchronously, but IME this isn't practical. Using async/await isn't some magic bullet here. You can write synchronous-looking asynchronous code, but the level I'm talking about is: what does asynchronous mean? What does synchronous mean? Once they've got that (which is not simple), what's a Promise? That one's fun because you need to explain the concept and how they work first, and generally that's gibberish. Async/await helps, so say I ignore Promises and go straight to that. At which point the learner starts getting errors to do with unresolved values. And back to Promises we go. And so on. I would say that I don't think there's any magic language that makes things easy for learners, and JS has many advantages over any other one, mainly to do with its general accessibility. But it's a fairly weird language in how it works, it isn't the simplest.
- tobr 5y agoI fully respect that these things are not easy for a complete beginner! I might not have expressed it very clearly but that’s what I tried to say; the browser environment requires you to deal with asynchronicity to do almost anything other than log to the console, so that makes it a tough place to start.
- 5y ago
- deepstack 5y agoMaybe try little javascripter would be good for your kid. https://www.crockford.com/little.html https://www.crockford.com/little.html
- z3t4 5y agoJavaScript itself is not async. It's the programs/engines that runs the scripting language that have decided to make it async with callbacks. For example Microsoft JS is not async. * ES2022? do have some garbage collection hook that uses a callback, so if that makes it into the standard you could say that JS/ES is async. JavaScript itself does not (yet) have any async functions.
- zzbzq 5y ago'Async' here refers not only to the keyword but also to what is achieved, in classic javascript, through callback functions
- z3t4 5y agoEven though there is the async keyword and Promise() there are no async functions nor callbacks in JavaScript itself. For example setInterval and setTimeout is not part of the language and needs to be implemented by the runtime/program that runs the JavaScript.
- amasad 5y agoI had a similar concern, that's why we started with Python initially (see my top-level comment). However, Kaboom's programming model is actually quite simple. It doesn't suffer from any callback hell. You should give it a go. It's modeled a bit after the block-like paradigm introduced by Scratch, which I guess you can call "async" but seems really intuitive for kids.