
My 7-Year Old Daughter’s First Programming Experience - idancali
http://dancali.io/blog/a-74-step-account-of-my-7-year-old-daughters-first-programming-experience
======
failrate
How young can a child learn to program?

While I'm not ready to indoctrinate my four-year-old into the monkhood of true
geekery while he's getting in his prime running around time, I was curious to
see how logically he could think. My layman's knowledge was that children
began properly interpreting and creating rules around the age of six, while
four was still wild imagination territory.

For my experiment, I created an extremely minimal programming game, like a
very stripped-down version of RoboRally:
[https://dl.dropboxusercontent.com/u/5458223/robot_factory.jp...](https://dl.dropboxusercontent.com/u/5458223/robot_factory.jpg)

The image depicted is doctored. We had already completed four playthroughs the
night before with a similar setup, however. He was able to figure out how to
program the robot to collect all of its pieces (three Duplo blocks comprised
the robot; successful completion of the robot wins the game). I demonstrated
the rules once, and then let him try to play by himself with minimal guidance.
One interesting strategy he discovered was placing the "instructions" (the
cards with arrows) on the game board in order to create a path.
[https://dl.dropboxusercontent.com/u/5458223/robot_factory_re...](https://dl.dropboxusercontent.com/u/5458223/robot_factory_redux.jpg)

A few weeks later, we played it again, and I taught him how to make new
"instruction cards". We're not yet at the place where we've done anything with
variables and abstraction. Apparently he liked the game well enough, because
he independently recreated it at school:

~~~
scoofy
A child using language functionally to get what he or she wants is essentially
a form of programming. Example:

    
    
        1. result = ask_parent_or_candy(mom, nicely)
        2. if result != candy:
        3.     ask_parent_for_candy(dad, nicely)
    

I studied analytic and philosophy of language, and i feel that many people in
CS don't see the forest through the trees when it comes to programming as
such. While some code (e.g. C) handles much more technical aspects of what is
actually happening, scripting languages are much better suited to the human
mind, and i think creating a natural language language (<\-- that seems a bit
redundant) is an achievable goal.

If i had a child, i would start her out on python, because python is
essentially in english, and english is the only code i'd prefer to write,
given the choice if there were a formalized english scripting language.

Even in python there is a bit of jargon that i think is an unfortunate
holdover. Int vs float may be necessary, but "string" is a poor term for what
is essentially text. I'm not saying we should change anything, because coding
is becoming more like natural language organically, but again, if i were to
teach my child coding (and i don't want to step on any cuteness of this
story), i think a child would understand python better than anything with
brackets and semicolons.

Full disclosure: i genuinely like python better than most languages.

~~~
idancali
I actually thought about what I should start with if I were to teach coding
and you're right I would probably start with something that's interpreted
first of all. I was thinking Ruby , perhaps Python, you're right.

But the crazy thing is that I didn't plan the whole thing. It was more of a
"lets build an app together" type of thing. My kids and I have been talking
for a while about building an iPhone game together so that's where the whole
iOS thing came from.

But you raised a good point. If you had a choice, what would be the best
language to start off kids with? And maybe you're right, maybe there should be
a new language built just for this purpose.

Maybe a bunch of us coding dads can create an open-source mini-lang of some
sort with the sole purpose of teaching kids to code.

~~~
scoofy
I figured you didn't start out with the intention, but yes, i agree that
building a simple language for kids would be a very good idea. Perhaps you
wouldn't even need words at all. The entire point of generative grammar, if
i'm not mistaken, is that logic is pre-programmed into the brain.

~~~
idancali
You know a long time ago I used to "code" in this language called LabView and
it was all graphical. It was designed for electrical engineers. I remember
working with electrical engineers that had no idea about coding and they would
be able to build complex systems in LabView. You would drag and drop a box and
attach it to another box with a connector and that would be a loop, etc.
Really awesome. Maybe something visual like that, with colors, animations etc
would work for kids.

------
xendo
I don't have kids, but even if I had this entry would still be totally
worthless for me. It's touching and nice, but can anyone learn anything from
it? I don't really think that there are any useful tips on teaching 7 year old
anything, I would even say that it's quite opposite, how could anyone post
code like this in such context: @property (nonatomic) IBOutlet UILabel* label;
?

~~~
idancali
I hear you, but if you check the timeline of the lesson, I didn't teach her
every step of the code, that would be too much info off the bat. I wrote a bit
of boilerplate code and her lesson - as I mentioned in the post - was just
those 3 lines where we talked about variables mostly.

~~~
xendo
Have you considered that XCode and Objective C may not be the right tools for
the job?

~~~
wlievens
Something like Scheme would be appropriate.

~~~
pubby
Scheme with graphics (i.e. a LOGO module) sounds very good. Kids are much more
impressed by getting pictures to appear than seeing a number output.

------
dgabriel
This has been a super fun thing in our house:
[http://scratch.mit.edu/](http://scratch.mit.edu/) It's also something a 7
year old can use on his or her own to learn concepts and make fun stuff.

~~~
rst
For Android devices, there's also MIT App Inventor, which is a very scratch-
like environment for writing mobile apps, available here:

[http://appinventor.mit.edu](http://appinventor.mit.edu)

In addition to basic I/O and animations, it's able to deal with a lot of the
device capabilities, including SMS, GPS, dealing with the camera, and so
forth.

Unfortunately, I don't know of any similar environment for programming iThings
--- Apple fairly famously rejected a Scratch port from the app store in 2010:

[http://wiki.scratch.mit.edu/wiki/Scratch_Viewer](http://wiki.scratch.mit.edu/wiki/Scratch_Viewer)

although a "Scratch player" for Android is in alpha, and apparently, people
are also working on pure HTML versions.

~~~
dmoo
There is an app called Hopscotch for the iPad which is of similar structure to
scratch. I can't recommend scratch highly enough, the kids at my local
coderdojo really do some great stuff with it.

------
jonalmeida
This is brilliant and amazing to read.

What comes to mind is, we need a list of analogies in the most simplest form
so that we can explain fundamentals like variables to kids. Hell, anyone who
doesn't know how to code really!

75\. HN reads and smiles

~~~
idancali
I think you nailed it my friend. That's exactly what was going through my mind
as I saw myself trying to teach her what a variable is. My boys were playing
with Legos and I was drinking coffee so I'm like alright, let's try that. We
went through other analogies that I didn't blog about but one of them was how
the whole IDE window (XCode) is like a table that you draw on and how a
program is like a drawing you make in art class. So the purpose of coding is
to use an IDE to create programs just like in art class you draw on a table
and create art work. Also, just like you need pencils, colors, etc, in coding
you need variables, methods, etc.

Kids get stuff like this really fast.

~~~
jonalmeida
I'd be interested to see some more examples you come up with if you continue
to teach your kids.

I'm re-learning basic trig right now for drawing OpenGL stuff, and I was
trying to think what I could have told younger-me on why I should be paying
attention in high school for this topic.

When I was in high school, it would have made me more attentive if people
said, "Hey, this stuff that finds circle arcs and radius, you can use this in
real life if you decide to get into gaming, graphics, .. (and other cool
topics that would excite me)."

~~~
idancali
Yeah it'd be interesting for me too to explore this further. Stay in touch via
my twitter @idancali and I'll post stuff as soon as I get a chance. Until
then, check out this post I wrote recently: [http://dancali.io/blog/you-too-
can-become-a-computer-program...](http://dancali.io/blog/you-too-can-become-a-
computer-programmer-heres-your-first-and-most-important-lesson-in-computer-
programming)

It's about how I decided to pursue coding as a career when I was in high-
school.

I think the main thing is to tell younger kids that coding is an art just like
drawing and that there is no right or wrong way of doing stuff. They should
not be afraid to break things and experiment and they should absolutely have
fun building things, seeing things come to life. That's what got me into
coding in the first place and I think that's what makes a world of difference.
The rest, the variables and things like that are secondary.

------
nkuttler
I think it's great that the author found something that worked for him and his
daughter, but this particular example seens a little complex. The first code I
ever wrote was something like

10 PRINT "HELLO"

20 GOTO 10

That's 3 or 4 steps. No IDE, no GUI, no variables. A program I could re-create
completely on my own the next day.

~~~
idancali
Hey I hear you. When I started coding I was 9 and I did something like that in
BASIC. It was awesome. I was actually considering what to start out with and I
just went for iOS off the bat to see what happens. I also think kids these
days pick up stuff way faster than 20-30 years ago. It's insane how fast they
pick up things like touch interfaces, smartphones, tablets, etc for example.

~~~
foobarian
Same here. I have a one year old now, and was just thinking how sad it is that
there isn't an equivalent of a C-64 any more. Turn it on, _bam_ , a BASIC REPL
in less than a second. Give the kid the language manual (all of 10-20 pages)
and off they go.

Today, there is all this cruft they have to be shown (Cmd-R, XCode, etc.). If
they screw up they can't just reboot.

There are benefits of course. Knocking out the power cord doesn't destroy the
work in progress. There are non-volatile media. Screens have colors :-)

------
evolve2k
I wrote a post some time back on teaching my kids to code, thought I'd include
it here in case anyone found it useful.

[http://richiekhoo.com/post/18723300657/coding-with-
kids](http://richiekhoo.com/post/18723300657/coding-with-kids)

------
linuxhansl
Every now and then I do "math" with my son (5 years now).

I just use a terminal and "bc". He loves to type in numbers and + or * and see
the result. And for + we "guess" ahead of time what the result will be.

What amazed me early on: bc has variables. I explained it to him and somehow
he immediately got it. You say A is 5 and B is 1 then A + B is 6.

His attention span is usually around 5 minutes, but each time it's fun.

~~~
idancali
Good stuff and congrats. I'm always amazed to see young kids get into coding
and math. I think that's awesome.

I was so pleasantly surprised when she got the whole variables thing. I think
drawing analogies to real life stuff is a sure way to get kids engaged,
especially if the props you use are toys. About the attention span - yeah I
noticed my 5 (almost) year old wanted to try when he saw his sister having
fun, but then he got bored after a couple of minutes.

------
fit2rule
My 6 year old and I often boot up the old 8-bit machine that I have reserved
in a corner of my lab just for this purpose. I have to say - there is no
better way to teach a 6-year old to code than to fire up a BASIC-running 8-bit
machine from the 80's and let 'em at it. Something so satisfying about hearing
him read out his code .. "10 ... do this .. 20 .. do that .." ;)

------
FD3SA
That's one of doing it...the other would be something like this [1]. Not
ashamed to say I had to beat the whole thing the first time I saw it because
it was so brilliant. And I normally hate pointless puzzle games.

[http://light-bot.com/](http://light-bot.com/)

~~~
bsilvereagle
More apps should have a video showing you the gist of what's going on like
they do.

------
wallflower
Check out Hopscotch:

[https://itunes.apple.com/us/app/hopscotch-coding-for-
kids/id...](https://itunes.apple.com/us/app/hopscotch-coding-for-
kids/id617098629?mt=8)

------
brc
The author correctly says 'pieces of lego' into the cup - but previously says
'playing with their legos'. I'm sure they wouldn't say 'the children were
looking at the sheeps', and then later on say 'the children counted the
sheep'.

For whatever reason, this irks me when reading as a grammar error. It's like a
klaxxon sounding in the middle of the sentence.

~~~
idancali
I know what you're saying, and the funny thing is that when I wrote that, I
actually paused and thought about the proper way of referring to LEGO. So if
you google "playing with legos" there's a ton of articles that use that
expression, such as this one on HuffPost for example:
[http://www.huffingtonpost.com/2014/01/28/google-
legos_n_4681...](http://www.huffingtonpost.com/2014/01/28/google-
legos_n_4681201.html)

So kids 'playing with their legos' is valid given the fact that LEGO has
become a household name and LEGO can refer to the brand, the game itself,
while Legos, or legos can refer to the LEGO blocks themselves. It's sort of
like using Google as a verb
([http://en.wikipedia.org/wiki/Google_(verb)](http://en.wikipedia.org/wiki/Google_\(verb\)))

Thanks for reading btw

PS. English is my third language so a grammatical error here and there
wouldn't be that bad anyways :)

~~~
brc
'Legos' is a very North American term so you may have just picked up an
(incorrect) slang.

This was an interesting discussion if you're genuinely interested:
[http://english.stackexchange.com/questions/10839/legos-
not-l...](http://english.stackexchange.com/questions/10839/legos-not-lego)

Most North Americans will have been brought up with the incorrect usage, and
will defend it strenuously, but they are wrong. The correct plural is Lego,
or, if you want to get specific (as you did in the article), lego pieces or
lego bricks. The company spent many years trying to teach correct usage but
gave up in the end. But correct is still correct, and if english isn't your
first language, there is still time!

Even in the verb usage 'kids playing with their lego' \- you don't pluralize
the term.

------
sideproject
That was totally awesome + cute. I have 5-month old girl and can't wait to
teach her to program! :)

~~~
idancali
Awesome, let me know how that works out :)

------
spacecowboy
I like the focus on variables and values - very cool! congrats!

~~~
idancali
thanks dude, I do believe that's the first fundamental concept that makes most
sense in a 101 course/lesson. If you get that, you can move on, if you don't,
then you have no ground to stand on

