Tuesday, September 25, 2012

Teaching Ruby to a 9-Year-Old, Part 1 - Introduction

I Learned This When I Was a Child


I learned how to write computer programs when I was a boy.  This was due to interest as much as necessity.  Our Commodore 64 and Texas Instruments TI-994-A didn't have a mouse, Windows, or any of the other features we currently take for granted.  I wasn't a child prodigy; programming was simply part of the experience of using a computer.  The language was called BASIC, and that word best describes my abilities at the time.


Fast forward more years than I like to acknowledge, and my grasp of computer programming is still nascent, or perhaps adolescent, at best.

Although not required for my daily work, knowing how to program (or "script" as we say now) could be very helpful and lucrative.  So I've set upon the journey of learning, and what an adventure that has been.  Like many computer geeks, my knowledge is fragmented.  I have great understanding of certain advanced subjects and little understanding of others.  Like most people who don't understand programming, when looking at lines of code, such as this simple snippet, I feel like it might as well be written in hieroglyphics. 

A snippet of code I wrote for submission to the metasploit project.

This fragmentation of knowledge is a strange combination.  On certain subjects, I could teach a college-level course.  On others, I need to sit in a class and have an instructor mete out knowledge as if I'm a child.  After many false starts - reading books that quickly traveled beyond my comprehension - I had  the realization that (with respect to computer programming) I need to be taught like a child.  This ultimately led to some measurable advances in my education and understanding.

If this is you - if the words in the picture above seem like complete gibberish - I encourage you to keep reading.

Teaching Ruby to a 9-Year-Old

My son is 9 years old and is interested in math and science.  But for the son of a Digital Forensic Analyst, he's woefully uneducated regarding computers.  I've often heard the expression, "The best way to learn is by teaching," so I've dedicated myself to learning Ruby by teaching him.  Convincing him was easy:   He was hooked the minute he discovered that, with a few lines of code, he could make the computer display the word "butt" on the screen 100,000 times.  I hope he never gets too old to enjoy that experience.

In this series of posts, I will chronicle my method of explanation.   If you're already knowledgeable about computer programming, these posts will drive you crazy with their slow pace and simplistic language.  But if you're like me, wanting to learn this one bite at a time, you may find them helpful.

So, fellow Grownups - set your ego aside and put on your thinking caps.  The bell has rung; class has begun.

Note:  If you want to follow along, you will need to install Ruby and use a programming-friendly text editor like Notepad++.