
How My 10-Year-Old Learned JavaScript - rohmanhakim
https://hackernoon.com/how-my-10-year-old-learned-javascript-d8782b586db7#.gpjilzh62
======
uniclaude
This reads like the author really wants his kid to learn programming, and the
article shows more interest from the parent than from the child.

That's obviously anecdotical but I'm very glad nobody steered me into
programming. It was my private garden, and I enjoyed every single second of
the freedom it gave me. Writing my Delphi programs was funnier to me than
programming books.

I think my point here is that I'm not sure it is in the best interest of
children to push them into our passions. Then again I'm not a parent, so my
opinion doesn't hold much weight!

~~~
neovive
Author here. Thanks for the feedback.

My son's experience has generally been self-driven via Scratch. I introduced
him to Scratch at around age 7 through CoderDojo and he really enjoyed it (I'm
a big fan of Scratch for kids--it's the perfect balance of art, creativity and
logic with programming concepts mixed in.

I introduced Python, then Javascript, after he asked me about what I do (I was
excited that he actually asked, so I ordered the book). I'm more of a web
designer/developer, not a software engineer, so I showed him to the tools I
know (trying to keep things at his level) and set him on his way. The thought
of being able to write his own video game keeps him motivated. He plays with
the examples on phaser.io/examples and sees it as something he might be able
to do after working through the lessons.

My biggest concern is pushing him into something that he doesn't want for
himself. It should never feel like work. He likes the CodeSchool videos,
jingles and exercises, so he does it. He got tired of the books, so he
stopped. There are many long gaps, diversions and pivots, which is totally
fine. If he just wants to play outside, build with Legos, read, watch a movie
or do nothing, I don't bother him. Programming is not his job, it's just a
skill that I think will be useful for him and is something I can actually help
him with.

Side Note: I originally had a section in the post about how in the past it was
more common to pass knowledge and skills down to your children in the form of
trades (farming, sewing, blacksmithing, etc.) and is "computer programming"
something worthy of passing down. I thought it digressed a bit too much, so I
removed it.

~~~
smnplk
Don't overthink it. Just introduce him to something basic. Hell, why not even
BASIC hehe ;) I remember when I was 9, my father enrolled me into some
"bootcamp", I don't know what it was called back then, but it was some comp
programing class for kids, about 3 hours a day for 2 weeks. I remember a
teacher, she would just write little BASIC programs on the blackboard and we
would just copy them into QBASIC. I remember that I understood very little and
the other kids weren't interested much too, we were just eagerly waiting for
recess, so we could play Prince of Persia 1 for 15 minutes.At the end of this
BASIC "bootcamp", I didn't even touch programing again, I just went home and
continued with my mastery of pp and prehistoric 1 & 2 games. But it looks like
it planted a seed in my head, because in high school i started wondering what
we did 5 years ago in those classes and I somehow found a book on basic and
now here I am, writing GOTO statements for profit ;) Just kidding on that last
part :) The moral of the story is - Kids can also develop interest much later
from the time of exposure to new things.

~~~
barbs
This guy installed QBasic through DOSBOX and used it to successfully get his
son into programming:

[http://www.nicolasbize.com/blog/30-years-later-qbasic-is-
sti...](http://www.nicolasbize.com/blog/30-years-later-qbasic-is-still-the-
best/)

Hacker News discussion:

[https://news.ycombinator.com/item?id=11636383](https://news.ycombinator.com/item?id=11636383)

~~~
smnplk
awesome guy ! thanks for posting.

------
mwcampbell
What do you think about teaching JavaScript as the first programming language
rather than Python? I know that some think JavaScript is a better choice [1],
because it's so much easier to produce a real application as opposed to a
command-line toy. But the opposing argument would be that JS has so many
flaws, or more charitably, it's such a quirky language. Also, any opinions
about Khan Academy's platform and lessons for learning to program with
JavaScript [2]?

I'm not a parent, but my friend's 10-year-old son has asked me to teach him to
program.

[1]: [http://prog21.dadgum.com/203.html](http://prog21.dadgum.com/203.html)

[2]: [https://www.khanacademy.org/computing/computer-
programming](https://www.khanacademy.org/computing/computer-programming)

~~~
tmsam
As a former teacher, who ran a programming club at a middle school and taught
an advanced 8th-grade math class included programming, I have some perspective
on this. I would say, be wary of "fundamentals" and "doing things the right
way." Teaching a 10 yo something optional needs to be fun, or else it won't
happen.

The author of this article nails it: there's nothing quite as motivating as
adding "Poop" to the title of a real web page. Also, you can Inspect Element
and get what is effectively an IDE. Is JavaScript the best language? No, it's
inconsistent and confusing. But, so is English, and a lot of people learn
English first - because it is practical to do so.

Another option that can be useful are Google Sheets. If they are a certain
type of kid, they might like logging all of their toys in a spreadsheet and
finding the total of the toys and making charts. Of course, most kids will
find this boring... but you can also use Google Scripts to do something like
scrape a subreddit and store it in Drive [1], which could be fun.

However, why not start with Scratch, or Snap! [2]? They are powerful enough
(especially Snap!, I think you can define new data types in it...) and so much
less intimidating.

[1] [http://ctrlq.org/code/19600-reddit-scraper-
script](http://ctrlq.org/code/19600-reddit-scraper-script) [2]
[http://snap.berkeley.edu/](http://snap.berkeley.edu/)

~~~
mwcampbell
> Teaching a 10 yo something optional needs to be fun, or else it won't
> happen.

That matches my intuition. But the word "fun" brought back to my mind this
epigram by Alan Perlis:

> It goes against the grain of modern education to teach children to program.
> What fun is there in making plans, acquiring discipline in organizing
> thoughts, devoting attention to detail and learning to be self-critical?

Unless I have completely misunderstood this epigram, I think the point is that
programming, when done well, is not fun; it's work. So maybe if we try to make
programming fun so we can teach it to a child, we're setting bad expectations
for what it will be like if they pursue it seriously.

So I guess that means that when teaching programming to someone of any age, we
do need to focus on fundamentals and the things that Perlis mentions in that
epigram. Then, if a 10-year-old kid loses interest, we should just let it go.

Makes me wonder if I and other self-taught programmers of my generation (I was
born in 1980) built our careers on a bad foundation. I started learning to
program in BASIC on my family's home computer when I was 8 years old, because
when just dabbling in BASIC, it was fun. Even tinkering with assembly language
was fun. But the important thing to note is that as far as I can recall, I
produced only one truly worthwhile program as a pre-teen, and that was one
that a relative asked me to write. And that was a serious project, not a
diversion (AFAIK, the latter is the definition of fun, as is apparent from
some languages like Spanish).

As for Perlis's jab at "modern education", I suppose the take-away is that we
need to teach kids early that life isn't fun, rather than trying to make
everything fun for them.

------
mattnewton
I honestly didn't recognize his description of closures. It sounded like
memoization. Closures are probably best understood without metaphors like
that, scoping in JavaScript might be weird but it is consistent everywhere-
only functions have scope, and they carry that scope for their entire life. I
think just thinking of everything in the language as a collection of scopes
really clicked it for me.

The real trip up with javascript I often see even in professionals is
asynchronicitiy, since JavaScript has a run loop.

------
cdevs
Feel like that title needs a tweak..

Learned JavaScript ? Or learned about JavaScript. Maybe "how I kept my kid
interested in programming", "short attention span vs programming", "getting
your child into programming". There's a pretty good click bate video on
YouTube that says "15 year old dreams in code" and it was something along the
lines of he made game where the ball moves to the left and right with your
keyboard and score increments...basically the tutorial for his framework. I
think the problem is the school system not pushing some of these basic
introductions into a few classes. There was a time unix commands were day to
day office needs for almost every employee at certain places...and then _poof_
the GUI killed it.

------
pacaro
I wonder if closures are easier to understand in languages with clearer (or
tighter) scoping rules. I notice that the author doesn't have an analogy for
scope on his article

~~~
pacaro
Ok let me take a stab at it.

Variables are imagined as containers. Those variables/containers exist within
a scope. Let's take an example where a room is the scope. That room is in an
apartment, which is in turn in an apartment building, in a city and so on.
Code whose scope is that room can access containers in that room, or in the
open areas of the apartment (but not in other rooms without special
arrangements being made), or in open areas of the building (but not in other
apartments …) etc.

So code in my room can look inside a container in the hall, but not in a
container in your room. And vice-versa.

A closure allows this special arrangement to look in another room. I can
create a closure in my room. This is code that can access the containers in my
room, but it has the special property that it acts like it is in my room even
when it isn't. So I can give you this closure and you can run it in your room.
When it's running in your room it can't access your containers (except as
arguments) but it can still access the containers in my room.

My daughter is two. I'm looking forward to taking this journey with her

------
kowdermeister
> He just lost motivation. I guess command line output only motivates a kid so
> much these days.

That's why we made text based games and an tkinter based RPG game at a coding
bootcamp where I do mentoring.

~~~
niftich
An anecdote about motivation: when I was in grade school, I made custom maps
and scenarios for Starcraft (the original), with if-then-else conditionals,
and the like.

The official editor had a wizard where you would enter these, but it was
extremely tedious to use, requiring lots of mouse clicks. Alternate editors
were starting to come out that would let you enter these events as a script,
so I turned to scripting instead.

After a while, hand-writing the script was becoming a chore, so I wrote a code
generator. I realized that the browser had a script interpreter and I could
just use checkboxes and form inputs and lots of Javascript to manipulate a
bunch of 'document.write()' statements to produce copy-pastable code.

I had no interest in _programming_ , and yet I using programming as a tool
without realizing it.

------
jtcond13
Cool write-up. Programming is a great thing to learn as a kid.

------
nv-vn
That description of closures is really odd to me and I know for a fact that it
would not have worked on me as a child. After spending some time teaching
programming to middle schoolers/high school freshmen, I think they're really
something that comes more naturally than that. The way scoping works for
closures is almost instinctual in my experience, but the anonymous part is
much harder to understand. Trying to write functions inside of functions is
also fairly natural (although you might have to nudge the kids into that style
of thinking), so you can teach closures with the use of named inner functions.
I still haven't found a great way to teach lambdas that really sticks without
them writing some code first and seeing how they can fit lambdas into there...

------
partycoder
Let's not forget that it was not rare that kids learned Assembly in the 1980s.

~~~
Theodores
...6502 instruction set and things like undocumented Z80 instructions can be
fully memorised as a child, even if some concepts, e.g. a stack, strange
maths, comes later. If only I could remember syntax so well now.

~~~
marisa_kirisame
Z80 assembly was the first 'real' language I learned as a kid (I did some
basic GWBASIC but never got far with it). I wasn't very good at it, but I did
write some programs that did what they were supposed to do.

------
icambron
Like a few people in this thread, I didn't really buy the closure analogies. I
think if that were my first exposure to it, I'd end up with some pretty wrong
ideas about how they work. Specifically, it's _not_ a snapshot.

I was bothered enough that I went and quickly wrote an explanation of closures
in five steps. The language probably needs tightened up a bunch, but I'm
curious if it's useful?

[https://jsfiddle.net/hghgp6x2/](https://jsfiddle.net/hghgp6x2/)

------
tobilg
Thanks for the interesting article! Are there any recommendations for non-
English speakers? I'd be especially interested in German materials. I'd love
to teach my eight year old daughter about computers and programming, but there
are close to none books and resources available if the kid doesn't speak/read
English yet.

------
fiatjaf
Programming is so easy anyone mildly interested can learn it. Specially a kid.
The key point is the interest. Kids will never be interested if they never
hear about programming, but you can also not force interest on them.

------
commentzorro
Should have started him with Haskell so he would learned monads and functors
right from the start with no mutable object baggage to trip him up. Maybe a
few weeks of child level category theory first.

~~~
detaro
Any references for "child-level category theory"? I suspect that would be
helpful for many non-children as well.

~~~
rottingtree
How about this: [https://www.amazon.com/Conceptual-Mathematics-First-
Introduc...](https://www.amazon.com/Conceptual-Mathematics-First-Introduction-
Categories/dp/052171916X/)

------
kampsduac
Congrats on sharing with your son! I would be interested to learn how he
responds to [https://groklearning.com/](https://groklearning.com/)

~~~
neovive
That looks very interesting, especially the competition aspect. He might have
to brush up on his Python a bit. He also enjoys CodeCombat, which I forgot to
mention in the post.

------
iamcreasy
Loved this article. I especially liked the 'Explaining programming concepts to
kids' section.

Please keep us posted about what your kid is building next.

------
sn9
_Realm of Racket_ would likely have been a really good alternative.

Maybe _NAND to Tetris_.

------
nether
Kids should be outside playing and interacting with other kids, not coding.

~~~
stymaar
Why not both ?

~~~
vegabook
because coding can be unhealthily addictive.

~~~
asveikau
Yeah, it might also lead to something called a "career".

~~~
vegabook
like that's what you're supposed to be worried about at age 10. Ridiculous.

~~~
stale2002
And some people just find it fun?

I remember making starcraft custom maps, using "programming", back when I was
10. I didn't care what programming was. I just wanted to do fun stuff with
Starcraft!

------
lttlrck
The closure description sounded more like memoization.

------
aibottle
There is no learning JavaScript. There is only the ability to use
StackOverflow and Google Search. ;)

~~~
fiatjaf
What programming language do you think is different from that?

~~~
aibottle
Everything. Including Brainfuck. JavaScript is a f __king mess.

~~~
fiatjaf
Are you serious? All imperative languages are the same. There are many
different features, but in essence they're exactly equal.

I could argue that is much easier to write something functional in Go than it
is to do the same in Javascript, because the compiler conducts you since the
beginning and you can actually get around with Stack Overflow and Google.

Javascript requires a lot more experience, because it can fail in so many
ways, it has callbacks everywhere etc.

