[plug] Programming for kids
Chris McCormick
chris at mccormick.cx
Wed Aug 17 13:06:00 AWST 2022
Hi Brad,
On 5/8/22 2:53 pm, Brad Campbell wrote:
> When I was 10 my folks brought home an Apple ][ clone from Hong Kong.
> I learned to program Applesoft BASIC and rapidly progressed to 6502 machine code (we couldn't afford an assembler).
>
> I'm fluent in Pascal, C, Python, and Java bytecode (not the language but the actual byte code) and a number of assembler architectures.
> I hate Java as a language.
>
> Myself and the 8 year old built his first computer tonight, and we're talking about programming.
>
> What do I start with? My gut says Python (write in one window and run in another), but is there something better for kids that I can come up to speed on?
The modern equivalent of Apple ][ Basic's developer experience is
probably JavaScript running in the web browser.
There are a number of online editors that let you write code directly in
the browser and see the results immediately. I made one myself a while
back called Slingcode. Here's a quick primer:
1. Visit slingcode.net/slingcode.html
2. Click the "+" button on the bottom right and choose "New app"
3. Click the "Run" button at the top and choose "Next to code"
4. Choose "File -> Save" or press Ctrl-S and you will see "Hello World"
appear.
5. Where it says "put your code here" write some simple JavaScript like
this:
document.writeln("Hello again.");
6. Press ctrl-S to save and you will see "Hello again." on the right
hand side.
Some other things kids can try:
1. alert("hello world!")
2. document.writeln("<div id=block>Hello</div>");
block.style.backgroundColor="red";
3. document.writeln("<button id=msg>Message</div>"); msg.onclick = () =>
alert("hi!");
4. document.writeln("<input id=msg placeholder=Name><div
id=out></div>"); msg.onkeyup = () => out.innerHTML="Hello, "+msg.value+".";
Remember to press ctrl-S after each change to reload the page/app.
Have fun!
Chris.
--
https://mccormick.cx/
More information about the plug
mailing list