0

Show HN: My Child's First Program

 1 year ago
source link: https://news.ycombinator.com/item?id=33881857
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Show HN: My Child's First Program

Show HN: My Child's First Program
130 points by FactolSarin 2 hours ago | hide | past | favorite | 50 comments
Last night, I introduced my kid to programming. We'd done some stuff with Mindstorms before, but she never really caught the bug for it. But for some reason, last night when I showed her some simple Python scripting to solve math problems and write to the console, she was enthralled.

After guiding her through a few things, she took the laptop off for a while and then came back with her first program, giggling like a maniac

    you='WOW!!!'
    fart='So many poops!'
    print(you,fart)
I'm pretty proud :D
My son took a coding class in elementary school (MIT scratch), and he came in one day and told his teacher that his Dad was a "pro programmer" and had helped him. The program was a pigeon farting on a man's head. The teacher asked what Dad had helped with, and he said "he recorded the fart sound".
I love the variable names. I definitely had the same naming conventions as a kid :)

Funny story. Sophomore year at college, I worked at a dev shop, and I was the first person to set up version control there (CVS... it was like year 2000.) The next day I reviewed changes that were merged and variables $tit and $ass were all over the place.

I assumed the guy who checked it in was just immature and met w him to "professionalize" him. But turns out these variables referred to Titles and Assignments (it was staffing software). LOL!

s.gif
In a class where we were writing a parser for math expressions, this was my plausible deniability scenario when I named the functions whose job was to analyze characters. Looking back, I'm sure the teachers were not at all amused.
s.gif
As a kid? When writing stupid scripts, I frequently use `fart` as a variable name to this day.

I'm a staunch supporter of naming variables intentionally in software that lives, but I'm definitely not above doing a `fart=True; while fart: ...` in temporary repl work.

Maybe I'm just eternally 10 years old, haha.

s.gif
Nice. I vividly remember the days, sometimes in the 80s, in some university cellar, hacking away at our green-lit vt terminals connected to some vaxens, that one of the other regulars in the room and I used temp variables _hudli_ and _tralla_ as some kind of ritual.
s.gif
In college, usually a few minutes before an assignment was due, I'd frantically Ctrl+F the project for various curse words.
s.gif
I must be old-fashioned! My variable names in throwaway programs tend to be x, y, and z and my iteration variables tend to be i, j, and k.
s.gif
Heck, when I write throwaway scripts most of my variables are different slang terms for feces. Sure, I use foo, bar, baz, bing sometimes too. But I never grew up either. At some point I decided that was a Good Thing, and I have no further plans to mature.
Now to suck the joy out of it for her by giving her a code review and a lecture about I18N :)

I like that the code itself is almost poetic, and is in itself a statement about the problem domain. Knuth would be proud.

So. I made a deal with my kids that they could have a phone if they made an app. There's enough youtube tutorials and they're old enough to follow them. I could have helped them more over the summer, but we didn't get it done.

Now ChatGPT will generate the flutter code for an app in seconds, as well as guide you with 'show me how to install flutter'. It's crazy that all the code is written for you. I tried one of their timer/todo list ideas and it generated the code, I just need to install flutter and run it today. So a summer long project of learning to code has been reduced to copy-paste instructions from an AI chat bot. Crazy times.

s.gif
>they could have a phone if they made an app

I think this is a great way to get your kids to have a habit of self-learning. In my opinions, this is the single most important skill a kid can learn.

Every time my little cousins ask me something they want to learn, I go with "Let's search for the answer together" and guide them on how to do basic research. Sometimes I ask them follow-up questions if they find the topic interesting so it gives them a sense of accomplishment. Takes little time and effort but teaches the most valuable skill.

s.gif
Is the ChatGPT sample code/tutorials much better than the tutorials that can be found on Google?
s.gif
Create me a flutter app that has a list of todo items. Each item has a timer. The list shows one item at the top and when it's timer finishes the next one in the list moves to the top.

That prompt, or something like it, generated Futter code along with the instructions of how to modify a default flutter app for the code to work.

I haven't ran the code yet, but all the other code samples I asked for worked.

Asking for a ruby Student, Teacher application where the student takes multiple courses and the teacher can assign a grade to each course.

After you get that code, you can clarify in your next question.

I want each course to have progress steps.

More generated ruby code..

Can you add a grade for each progress step, and can the teacher have the ability to unlock the next progress steps.

Generates more code.

Then.

Generate me a react front end for this.

Generates React code.

I didn't install/run the code, but it looked accurate and had comments explaining what the lines of code did.

GitHub code works, ChatGPT code works, and does exactly what you want, and you can modify it just by asking.

"Change the progress array to be an object that has a grade, started date, finished date and parent acknowledgement."

That actually works as an example after the bot generated the initial app.

We're in for a world of changes.

s.gif
That is what though, 2 hours of coding for an experienced dev? And the trade off is you have no context over the code running your product?
s.gif
It's more like having an assistant who can do it for you so you need no/little knowledge of GitHub.
What's the license, are you allowed to distribute? Anyway, we already started using this in production, we expect some free support. /s
Hilarious! After a few of those, I taught my son how to open the javascript console and "hack" his favorite cookie clicker. He was so excited to show his friends but the school-provided chromebooks are really locked down.

I was disappointed, thinking that would be the end of it, but his whole class has been trying to find ways around the blocks and filters ever since. They've found some clever workarounds and a lot of things that sort of look like hacks but are not. It's adorable.

s.gif
Poorly implemented device lockdowns by my school were the start of my interest in understanding and manipulating systems, long may they last!
s.gif
Yuuup. My favorite instance in I think 9th grade was opening the computer case while the teacher was out so I could pop out the CMOS battery to disable the BIOS password, boot a live disk without the disk protection software (Deep Freeze), edit the Win95 boot logo screen[1] to put a little smiley face in the corner, and then put it all back together (sans BIOS password, since I never knew what it was originally!). No one ever mentioned it, but I'd see my little smiley every time that PC booted. Later, I spent 13 years working in reverse-engeering-related software :)

[1] https://www.dslreports.com/faq/3880

"One of us! One of us!"

Congrats! What a fun and delightful thing. Props to you, and here's to many more enjoyable programs. Thanks for bringing a little humor to my day.

I started programming as an autodidact in fourth grade, creating programs on an Amstrad with BASIC language, reading the instruction manual (I didn't speak English). I remember the joy when I had the idea that it was possible to add a variable to itself to increase a number A = A + 1 instead of having to use multiple variables and that testing it worked. I felt like a genius.
This is more sophisticated than my first line of code, but maybe reflects some universal underlying truth about how all of humanity is connected.

We kids finally got parents to buy a computer. They brought home a TI 99/4A, plugged it into the TV, kids all gathered around, got to the TI Basic prompt, everyone's full attention, but we didn't know what to do.

Someone typed something, got an error message, and a few more things.

One of us asked whether what we type "goes into the memory of the computer", wide-eyed fascinated.

Then we proceeded to type juvenile naughty things into this memory of the computer, which apparently is the highest form of kid humor.

The first program I ever wrote was in AppleSoft BASIC. It would pick a random location on the screen and print MILK in inverse text at that location. And then GOTO 10. Anyone else remember their first program?
s.gif
Wasn’t quite my first, but one of the earliest I recall on a TI-99/4A was programming the Jeopardy! theme song with frequencies and durations in CALL SOUND statements.
For those with even younger kids (they say ages 5-7), you might enjoy checking out Scratch Jr[1]. Building-block style programming with lots of examples for kids to get started on their own! (No affiliation, I just loved what happened when I gave it to my kid)

[1]: https://www.scratchjr.org/

no tests, no ci, no dockerization, no deploy on the cloud

NO HIRE for me

s.gif
Counterpoint: Good variable names, concise and readable. Really conveys that you fart, I don't think I could escape knowing that having read this. Shows initiative - she did this on her own.

I think we could bring her on as a junior.

Show her how to loop through the print statement and she’ll be hooked forever!
s.gif
I suspect some major portion of computer programmers discovered loops via
   10 PRINT "FARTS"
   20 GOTO 10
s.gif
Hah, I think one of my first computer programs I wrote on my own looked something like this:
    while (true) {
        cout << "Fuck!";
    }
s.gif
Every Commodore 64 in every department store that I went to was running that loop (but with "Hello") after I left.
I'd like to see what instruction could let ChatGPT output such invention.
.... to be honest, fart humour is pretty universal. This could be a 16 year old kid to be honest :D
s.gif
My 30 year old ex blue collar worker buddy who took up programming wrote something like this ... but it's too crude for HN.
s.gif
He never mentioned how old the child is. Could be 23!
Why not rust? /s

That is sweet. Congrats.

s.gif
Because this program requires garbage collection :)
s.gif
hell, get her poop-farting in 6502 assembly and in 10 years she'll be front-paging HN twice a week
I've always said that most kids my age got the programming bug with something like the following:
    10 PRINT "FARTS"
    20 GOTO 10
And it's as good a start as any other. Probably better since it drives home the idea that the computer follows your orders, even to the point of breaking taboos.

There was an intro to computers book from the 80s that was written entirely this way. Its first example Pascal program concatenated the strings FAR, TIN, and G, yielding FARTING. When they wanted to introduce machine language and assembly language, they invented a pretend instruction set and an assembler for it, calling it the Simple, Excellent for You Assembler, or SEXY ASS.

Adorable. Interesting that mindstorms didn’t take while Python did.

I’d kind of assume the opposite, since MS is more tangible and easier to visualize.

s.gif
IMO Mindstorms is a bit more of an all-in proposition; you have to build a thing that does a thing, and then build a "complete" program for it.

I never really got into Mindstorms either, I remember I would build a thing, then use the pre-loaded programs to run stuff, but then because I was starting from zero and didn't really have an understanding of what was going on, I wasn't able to really fiddle around very much.

With Python, it's easy to get something from very little- as is seen here from OP.

Here's to many more joyful moments! Congrats!
Having a 7 yo and 4 yo, this completely tracks.

Nice work.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK