Skip to main content

Teaching Programming to Children (pt2)

The open source movement and the creative commons revolutions have brought a lot of power to regular people by sharing the underlying code and logic of programs and other knowledge. To take advantage of this freely available knowledge and to truly partake the power of open source, one must be able to code.

Thus began my search for good resources for learning to code, and for good resources to teaching coding or programming to children. This search led me to Ruby, a programming language particularly suited for teaching children code.

But why is Ruby so great? After all learning coding is like learning a new language, a time consuming and challenging proposition, and Ruby is not as famous or as popular as other languages such as Java. The answers lies in what you should teach to children.

Teach something fun to learn.

The first step in making learning fun is not balloons or clowns but a good learning curve. If the student feels his mastery of the subject increasing, it becomes more and more fun. Frustration, unnecessary complication and extremely long delays in gratification are things to be avoided. What you want is the student to feel that what looked impossible at the beginning quickly becomes easy and hopefully fun too.

Java is not exactly simple. Let's look at Java code.
"Hello World" in Java
It's not pretty. Here is the a simple "Hello World" program in Java. Typically the first program taught.
Can you tell what this does? What is a "public static void"? Sounds like something in a black hole movie; scary.

Now here is Ruby code for the same thing. Yes just one line.

"Hello World" in Ruby
A lot more readable, and way more fun to code. After a little looking you realize that "puts" may be short for "put string" or "output string." Frustration is reduced. Suddenly this complex programming thing appears attainable.

But here is the thing, this may appear simple but once you start grasping the concepts, it scales up in complexity and allows you to understand more complex languages like Java easier.
Can you tell what this does?
Additionally Ruby has a interactive ruby prompt (irb) that allows you to see in real time what a piece of code does and outputs. This provides instant feedback, provides instant gratification when you get it, and allows you to practice 'talking' in Ruby.
What's that 5 doing there? I don't know, but now I want to know.

Teach Something real world useful.

Many beginning programming languages like BASIC, Scratch or LOGO are so simple or limited that they're basically useless in the real world. They were in a way designed for the world of academia and that hampers their development outside of it. (There is Visual Basic, but that is neither free, nor able to play well outside Windows, thus not super useful. )

Ruby, on the other hand, is very useful right of the bat. It's a full-fledged programming language, not a simplified set of one. It can be used to code real programs that function in real-situations right now. It's also the basis of the web framework Ruby on Rails, that allows for speedy development of web applications. In fact, Rails is what has made Ruby popular this days. Ruby has many extensions, like graphic libraries, that allow you to quickly add functionality to your program without having to build it from scratch.

Ruby is actually used in real world applications. Twitter ran on Ruby (on Rails) originally and the User Interface (UI) still does.

Ruby is also very portable. That means it runs in many places, be it a web server, Windows, Mac OS or Linux. So what you learn in one place is applicable in many. Mac OS X even comes with ruby built-in. Unlike proprietary (company-owned) languages like Visual Basic, Ruby is open source, so support or development is not dependent on a company's whims or desires and can continue indefinitely.

Teach something future-bound.

In the ever changing world of technology it's important to look toward the future and see what's over the horizon. Ruby is a language moving forward. Not only is Ruby a good basis for other languages but also can be used for web development (Ruby on Rails), for simple Android and iPhone App development (Rhodes Framework) and with a version of ruby called MacRuby (the Scottish cousin) Mac OS applications.

Additionally, MacRuby integrates with Mac OS Xcode  and can be used as a spring board to learn the far more complex world of GUI programming with Cocoa. And MacRuby is not a second cousin, it's development has been officially supported by Apple and in some cases MacRuby code can run slightly faster than native Objective-C code.


Popular posts from this blog

How to configure Ubuntu's keyboard to work like a Mac's

Typing accents on a PC is a complicated Alt + three numbered code affair. One feels like a sorcerer casting a spell. "I summon thee accented é! I press the weird magical key Alt, and with 0191 get the flipped question mark!" For a bilingual person this meant that writing on the computer was a start-and-stop process. With Mac's it a whole lot easier, just Alt + e and the letter you wanted for accents and alt + ? for the question mark. No need to leave the keyboard for the number pad and no need to remember arcane number combinations or have a paper cheat sheet next to the keyboard, as I've seen in virtually every secretaries computer in Puerto Rico.

Linux has a interesting approach to foreign language characters: using a compose key. You hit this key which I typically map to Caps Lock and ' and the letter you want and voilá you get the accent. Kinda makes sense: single quotation mark is an accent, double gets you the ümalaut, works pretty well. Except for the ñ, wh…

Contrasting Styles of Writing: English vs. Spanish

There is interestingly enough a big difference between what's considered good writing in Spanish and English. V.S. Naipul winner of the 2001 Nobel prize for literature publish an article on writing. In it he emphasizes the use of short clear sentences and encourages the lack of adjectives and adverbs. Essentially he pushes the writer to abandon florid language and master spartan communication. This is a desired feature of English prose, where short clipped sentences are the norm and seamlessly flow into a paragraph. In English prose the paragraph is the unit the writer cares about the most.

This is not the case in Spanish where whole short stories (I'm thinking this was Gabriel Garcia Marquez but maybe it was Cortázar) are written in one sentence. Something so difficult to do in English that the expert translator could best manage to encapsulate the tale in two sentences. The florid language is what is considered good writing in Spanish but unfortunately this has lead to what …

Fixing Autocomplete in Github's Atom Text Editor for Ruby

I really like Github's Atom Text Editor. I really like that it's multi-platform allowing me to master one set of skills that is transferable to all platforms and all machines. 

On thing that just burns me of the default set-up in Atom is the Autocomplete feature that seems to change my words as a type them. Because Ruby uses the end of line as a terminus for a statement you usually finish a word with pressing the return button and you get really annoying changes to your finished typed word a la MS Word. I find myself yelling "No that's not what I wrote!" at the screen in busy coffee shops.

I disabled autocomplete for a while but it is a very useful function. Then I found out they changed the package that gave the autocomplete to a new one called "Autocomplete Plus" that gives you more options. All that I needed to change to make autocomplete sane again:

1. Open Atom's Preferences
2. Search the bundled packages for "Autocomplete Plus"

3. Go to t…