4 ms·
That's silly. Javascript requires all kinds of knowledge to get started; what does this code mean, how do you hook it into a page, what is DOM, etc. That's a l
by bdamm 8y ago
That's silly. Javascript requires all kinds of knowledge to get started; what does this code mean, how do you hook it into a page, what is DOM, etc. That's a lot to ask of a 10-yr old.
Meanwhile, any 10-yr old can understand this code:
10 PRINT "Hey there Joe"
20 GOTO 10
Boom. Functional program. Instant gratification. That will be the last program this person ever writes that provides such instant reward, but nevermind, that foundational idea that the computer can bend to your will is planted.
- astrodust 8y agoI can teach someone how to make a button blink in JavaScript in ten minutes. I don't have to explain what line numbers are. I only have to teach some very rudimentary HTML. From there they can absorb more knowledge and do really cool things. That BASIC program is garbage and nobody cares. Seeing your name on a screen doesn't carry the same thrill it did in 1985. Show someone PONG today and they will wonder if you're playing a joke on them. Show someone PONG IN 1972 and you'd blow their mind.
- dvfjsdhgfv 8y agoYou both have a point. When I showed a text-mode adventure to a kid, their reaction was "Really? Why would anyone play such a thing these days?" On the other hand, getting started with toy twoliners involving a question and a simple arithmetic answer can spark some interest. The effect is augmented if what you type can have an immediate effect on hardware like in the case of Duinomite where the inerpreter is running on the MCU itself and doesn't need uploading like on the Arduinos or Mindstorms.
- astrodust 8y agoIf you want to get kids engaged, Minecraft is the best learning environment out there. You can get a computer that runs Lua in the game, and that thing can interact with devices and the environment. You can write a couple of lines of code that spawns pigs. From there anything's possible. Subjecting someone to the ridiculously spartan environment that is the READY prompt is the polar opposite of encouraging.
- bdamm 8y agoInteresting... I had no idea Lua was in Minecraft.
- astrodust 8y agoThere's a number of mods for Minecraft that put Lua into the mix. One I was using (ComputerCraft?) had all the common UNIX commands implemented as things like ls.lua, so typing "ls" actually just ran a Lua script with the corresponding name. You really couldn't get a more hackable computer. These instances can have 4-16MB of memory allocated to them which honestly is way more than is necessary. They can make remote HTTP calls. With the right server settings they can even adjust the in-game weather to match the real world. The possibilities are literally endless. A few lines of code can produce immediate results, and you can iterate and expand on that to make elaborate systems.
- dvfjsdhgfv 8y agoUnfortunately ComputerCraft is no longer developed, even though you can still use it on an older version of the game.
- wilsonthewhale 8y agoOpenComputers is actively developed though, and arguably a more fleshed out Lua mod than CC
- postalrat 8y agoYou want the Lego set with a bunch of custom blocks to make the perfect model. Other people want the generic set of blocks.
- astrodust 8y agoThat's called Minecraft and it's a thousand times more fun than BASIC. It's also scriptable with Lua, so...
- jimbokun 8y agoShow them how to access the Console in Chrome. alert("Hello World!") (Infinite looping it could be annoying, though. Would you have to quit Chrome to make it stop?) I think the browser console for evaluating Javascript is under rated for a quick and dirty introduction to program with an immediate payoff.
- innocentoldguy 8y agoI agree with you. At a fundamental level, I suppose the same code in JavaScript would be a simple for loop and a console.log() statement that could be run from the command line using Node.js. It isn't quite as easy, but it teaches better programming practices and isn't that much harder. The DOM is definitely another story though. Another problem I think JavaScript poses for beginners is the community itself. It seems like nobody is interested in perfecting existing libraries but are rather focused on reinventing their own wheels. For example, just for handling projects we have Grunt, Gulp, Brunch, WebPack, Parcel, etc. This kind of instability and fragmentation within a community creates a problem for new developers, because they don't know which direction to go. I volunteer to teach women and children to write code. I've found that solid communities that embrace and continuously improve a small set of productive libraries and frameworks, such as Elixir, Phoenix, and Mix, make it much easier for beginners to learn and be productive. I do teach JavaScript as well, but I've reduced my focus to just the core language because too many students were overwhelmed by all the libraries and frameworks that solve the exact same problems and complained about that during the courses.
- andrewstuart 8y agoThis is a key point. The cognitive distance between power on and "10 print" is nothing. The cognitive distance between all modern ways to teach programming is vast.
- astrodust 8y agoNot really. $('h1').html('Billy Named Emperor') to hack around with web pages is actually super easy.
- anoncake 8y ago'PRINT "Hey there Joe"' is a lot more obvious than "magic('magic').magic('Billy Named Emperor')"
- astrodust 8y agoIt's all magic until you explain it. How is PRINT any different from console.log()? On those historical platforms you're quickly going to have to explain what GOTO is and how it's different from GOSUB, and then that you'll need to plan out your program in advance so you have enough "lines" to write in what you want, and that if you mess stuff up, you can't easily renumber, so you'll just patch in a bunch of GOTO statements to work around that and... JavaScript, ugly as it can be, is 100x simpler. You want to add a line of code? Add the line. Click run again. You want to write a function? Write a function. You want to do asynchronous programming? Promises aren't that mysterious now that there's await/async. It's all within reach.
- andrewstuart 8y agoSure thing. All you need to understand is jquery, selectors, the DOM, method calls, inner HTML and in fact the entire context of web programming in which this command executes. Pretty much exactly the same as print "hello world"