Not short but almost understandable. Given a text editor, save the following text as drawline.html:
<canvas id="myCanvas" width="500" height="300"></canvas>
<script>
const ctx = myCanvas.getContext( "2d" );
// Draw the line
ctx.beginPath();
ctx.moveTo( 50, 50 ); // Starting point
ctx.lineTo( 200, 150 ); // Ending point
ctx.stroke();
document.write( "Hello World" );
</script>
JavaScript is quite forgiving. No need for the HTML preambles. "document.getElementById" is a nicety that can also be ignored.
Nonetheless, I (born 1947) too miss the simplicity of BASIC, the plethora of magazines for beginners, the many shelves of "for dummies books". And, especially, that we were all beginners.
These days, full stack developers and AI are priestly classes that that, currently, do not facilitate the investigation by newbs of the black boxes they create.
Nonetheless, I look forward to AI being able to read aloud Python, Rust, Cobal, Euler notation, Greek or whatever in ways that I may understand.
vekatimest 19 days ago [-]
I had no idea named elements just become globals like that. Seems kind of ridiculous
theoa 19 days ago [-]
I discovered this perhaps ten or more years ago. I have used IDs a global in hundreds (thousand?) of efforts with no issues. Ever.
Of course, I am but a single stack developer, so your experience may vary
blacksmith_tb 19 days ago [-]
id-s do, which is handy here, but sometimes exciting if you aren't expecting it.
ben_w 19 days ago [-]
> "document.getElementById" is a nicety that can also be ignored.
Huh, I did not know that. This makes it a lot nicer for micro-projects.
citelao 18 days ago [-]
What a timely article! I've been thinking about writing something similar for a bit.
I was doom-and-gloomy about how programming is more complicated now, but then friends pointed out a bunch of things to me:
* Arduinos & ESP32s (<$5): program in a simple app, flash over USB, & you're programming bare metal. ESP32s have Wi-Fi & Bluetooth
* Raspberry Pi ($30-$80): program on a real, self-contained Linux OS. If you trash it, just reset the SD card. GPIO, Bluetooth, Wi-Fi.
* Web (free): like theoa points out, you can make apps that work on any modern computer/phone in a single file with no compilation & instant output (and share it on GitHub Pages).
* Go & Rust (free): 2 easy-to-build-and-install languages, & Rust feels "C enough" to sate anyone who wants to learn "low-level" programming.
* Roblox? (free???): make & share games with your friends
IMO, the hardest things in 2024 (hah) are native app development & "modern" web development/anything that includes a login.
I don't have enough context for your points about learning without adult supervision, but I know that all of these options are very well documented; I bet No Starch has some good books for each?
Thoughts?
nuancebydefault 18 days ago [-]
Programming today is more simple, but:
- To me it seems kids/beginners these days are less easily impressed both on the producing and consuming side. So for them to implement something that provides a wow factor, there's needed much more than a mandelbroth set or a simple 2d platform game.
- There's just too much choice. Back in the day, BASIC was an obvious first choice, now to get started, you have at least the ones you mentioned and much more.
- It's too easy to get distracted. Look something up on the internet... 'wow more cool stuff' rabbit holes. Or addictive memes, short videos or songs lead to wasting time in stead of making stuff.
theoa 18 days ago [-]
Being a child today isn't for sissies
michaelhoney 19 days ago [-]
For an accessible and pretty simple sandbox I would point people towards p5js: https://editor.p5js.org/
theoa 18 days ago [-]
Agreed
bryanrasmussen 19 days ago [-]
I sort of disagree with the example of the Python code and the BASIC code - if you have a pretty smart kid who knows the English language who decides to think about things when looking at these two bits of code the one looking at the python code might think "I bet I can learn how to do this" the one reading the BASIC code will not think that intuitively from looking at the code and knowing nothing else.
mrob 19 days ago [-]
You need reference materials to learn both of them. The Python example looks more like English, but anybody who assumes it works like English and tries to modify it will quickly find it doesn't work like that. The experience could be more discouraging than seeing a mysterious BASIC keyword. BASIC has the advantage that you don't need to read so much reference material because it's a simpler language. Well-written printed manuals for BASIC were widely available.
bryanrasmussen 19 days ago [-]
I suppose I did not explain that I know all that, but be reassured - I too am an old person.
However assuming an intelligent youngster familiar with English I don't think such a hypothetical person would assume it works like English because some things might remind them of English - given that there is quite a bit that is obviously different than English.
It would take a very strange intelligence to look at their first programming language and say, huh this thing that makes a computer draw a line has some words like English uses but it is obviously not English, I will try to modify it like English.
After all - Python is not Cobol.
I suppose someone with a desire to learn might do so quicker with BASIC, but I am only supposing that seeing the Python code might make them think I CAN LEARN - and sometimes the idea I can learn is the parent of the desire to learn.
marcus0x62 19 days ago [-]
Hi, author of the original post here. I think I mostly agree with this. My frame of mind when writing this was about starting from scratch, without an existing mental model of computers, or much outside help. Despite the odd syntax (by modern standards,) I just think there was less cognitive load to get started with the old 8 bit BASICs, and they all had the sorts of things kids like to experiment with (sound, graphics) built in.
I also wasn’t thinking about this from the perspective of the tooling discouraging someone from wanting to learn - that just wasn’t a problem my friends and I had, but I can see how the modern tools could be more likely to inspire someone on the fence to continue.
Anyway, thanks for the comment.
rahimnathwani 19 days ago [-]
A smart 8yo with a 10 wpm typing soeed could type in the BASIC program without a problem.
That same smart 8yo would probably make at least one typo trying to type in the Python program. And they would need to read the error message and figure out where in the file they made a mistake.
I'm considering having my son try this Python MOOC: https://programming-24.mooc.fi/
The exercises can be completed inline. I wouldn't just hand him a python book and a computer. Whereas I could totally imagine him learning something with the Acorn Electron and book I had at 10yo or 11yo.
wslh 19 days ago [-]
With all due respect to the author you can create your own Python libs/classes/methods to mimic the BASIC simplicity. I would say that even the Applesoft HGR is unnatural and just drawing a line could be enough. Many times it is about the implicit vs. The explicit balance in code.
fernly 19 days ago [-]
I would think that if you couldn't set up a modern computer so that it launched a BASIC interpreter immediately on completing boot-up, you could at least have the BASIC ready as an obvious icon on the desktop and taskbar/dock, so that a double-click would get it going. Microsoft 365 BASIC is a thing for Win11, and on the Apple App Store there is BestBASIC with an example of it drawing the Mandelbrot set. There are also LOGO interpreters for Win and Mac.
marcus0x62 19 days ago [-]
Of course. That’s all possible. When I wrote this I was thinking about defaults, and what I could do and did do out of the box with nobody knowledgeable around to guide me.
theoa 18 days ago [-]
Bingo!
Now, once out of the box and having responded, willy nilly, to numerous dubious questions, you are presented with a screen full of all sorts of strange things, and nothing happens when you use the keyboard.
Compare and contrast with:
>
incognito124 19 days ago [-]
> If you manage to start a Python REPL – which for most computers is either not pre-installed (Windows) or not obvious to beginners how to start (macOS/Linux) – there aren’t any graphics capabilities
That said, I don't think the next generation needs to have the same or similar education as the generation before. The world changes faster than ever. There are probably resources that are better, that allow faster but more comprehensive learning.
More knowledge about computer internals can't hurt, I guess, but maybe it just might become unimportant in future, and there could be opportunity costs about learning something else.
marcus0x62 15 days ago [-]
Thanks. I updated the original post with an example using the turtle module. I'll admit I don't use Python a lot these days, and didn't know the Tkinter bundling/installation issues had been worked out. In the 2.x days, that was not usually part of the default install.
block_dagger 19 days ago [-]
I also grew up with an Apple IIe and made dungeon games and text adventures in BASIC. But I was limited to a single manual and lived in a rural area with no nerd friends. The Internet, phones, and LLMs fill in all the gaps now, so the added complexity of today’s hardware and software is much more manageable. They are the third wheel on the tricycle or, if you prefer, training wheels on the bike.
invalidator 19 days ago [-]
TempleOS deserves a mention here. It boots up into a simple system with a C-like language featured front and center. It makes it easy to write small programs with simple graphics.
It feels like the Apple IIe and GW-BASIC systems that I cut my teeth on, but with more features (Simple windowing TUI, good editor, extensive help system, many examples) and high performance (compiled code running on modern x86 hardware).
I don't know if I'd give to a kid as their only computer (For better or worse, there's no networking, and I wish it had high res graphics modes and a little more polish), but it's a really cool environment for a curious young mind to explore.
I feel like Claude (or other LLMs) kind of solve this TBH. There's now an incredibly intelligent teacher built into the computer, who you can talk to and who will answer your questions. For getting started with basic web development it can take you a very long way.
walterbell 18 days ago [-]
With potential side effect of profiling the human asking questions.
Nonetheless, I (born 1947) too miss the simplicity of BASIC, the plethora of magazines for beginners, the many shelves of "for dummies books". And, especially, that we were all beginners.
These days, full stack developers and AI are priestly classes that that, currently, do not facilitate the investigation by newbs of the black boxes they create.
Nonetheless, I look forward to AI being able to read aloud Python, Rust, Cobal, Euler notation, Greek or whatever in ways that I may understand.
Of course, I am but a single stack developer, so your experience may vary
Huh, I did not know that. This makes it a lot nicer for micro-projects.
I was doom-and-gloomy about how programming is more complicated now, but then friends pointed out a bunch of things to me:
* Arduinos & ESP32s (<$5): program in a simple app, flash over USB, & you're programming bare metal. ESP32s have Wi-Fi & Bluetooth
* Raspberry Pi ($30-$80): program on a real, self-contained Linux OS. If you trash it, just reset the SD card. GPIO, Bluetooth, Wi-Fi.
* Web (free): like theoa points out, you can make apps that work on any modern computer/phone in a single file with no compilation & instant output (and share it on GitHub Pages).
* Go & Rust (free): 2 easy-to-build-and-install languages, & Rust feels "C enough" to sate anyone who wants to learn "low-level" programming.
* Pico8 ($15): fake 8-bit console w/ dev tools. [Celeste](https://maddymakesgamesinc.itch.io/celesteclassic) was first written for Pico8.
* Unreal Engine/[Unreal Editor for Fortnite](https://www.unrealengine.com/en-US/uses/uefn-unreal-editor-f... (free): make games using the same engines everyone else uses
* Roblox? (free???): make & share games with your friends
IMO, the hardest things in 2024 (hah) are native app development & "modern" web development/anything that includes a login.
I don't have enough context for your points about learning without adult supervision, but I know that all of these options are very well documented; I bet No Starch has some good books for each?
Thoughts?
- To me it seems kids/beginners these days are less easily impressed both on the producing and consuming side. So for them to implement something that provides a wow factor, there's needed much more than a mandelbroth set or a simple 2d platform game.
- There's just too much choice. Back in the day, BASIC was an obvious first choice, now to get started, you have at least the ones you mentioned and much more.
- It's too easy to get distracted. Look something up on the internet... 'wow more cool stuff' rabbit holes. Or addictive memes, short videos or songs lead to wasting time in stead of making stuff.
However assuming an intelligent youngster familiar with English I don't think such a hypothetical person would assume it works like English because some things might remind them of English - given that there is quite a bit that is obviously different than English.
It would take a very strange intelligence to look at their first programming language and say, huh this thing that makes a computer draw a line has some words like English uses but it is obviously not English, I will try to modify it like English. After all - Python is not Cobol.
I suppose someone with a desire to learn might do so quicker with BASIC, but I am only supposing that seeing the Python code might make them think I CAN LEARN - and sometimes the idea I can learn is the parent of the desire to learn.
I also wasn’t thinking about this from the perspective of the tooling discouraging someone from wanting to learn - that just wasn’t a problem my friends and I had, but I can see how the modern tools could be more likely to inspire someone on the fence to continue.
Anyway, thanks for the comment.
That same smart 8yo would probably make at least one typo trying to type in the Python program. And they would need to read the error message and figure out where in the file they made a mistake.
I'm considering having my son try this Python MOOC: https://programming-24.mooc.fi/ The exercises can be completed inline. I wouldn't just hand him a python book and a computer. Whereas I could totally imagine him learning something with the Acorn Electron and book I had at 10yo or 11yo.
Now, once out of the box and having responded, willy nilly, to numerous dubious questions, you are presented with a screen full of all sorts of strange things, and nothing happens when you use the keyboard.
Compare and contrast with:
That's not true. Python has a builtin turtle module which emulates LOGO. https://docs.python.org/3/library/turtle.html
More knowledge about computer internals can't hurt, I guess, but maybe it just might become unimportant in future, and there could be opportunity costs about learning something else.
It feels like the Apple IIe and GW-BASIC systems that I cut my teeth on, but with more features (Simple windowing TUI, good editor, extensive help system, many examples) and high performance (compiled code running on modern x86 hardware).
I don't know if I'd give to a kid as their only computer (For better or worse, there's no networking, and I wish it had high res graphics modes and a little more polish), but it's a really cool environment for a curious young mind to explore.
https://templeos.org/