Monday, February 7, 2011

Ruby Koans (more)

As a key component to my Professional Portfolio Investment, I've been dollar-cost averaging a small chunk of time (15 to 60 minutes) a day in a session I call "JTigger @ Play".  During this time, I am free to explore within the sandbox of the topic I've set for myself.  My current language study is Ruby.  As I reported last time, I picked-up Ruby Koans.

There are many wonderful things about this "koan" format.  Primary is how small of steps each "koan" goes.  I'm being led along a path, winding through the language, one tiny bit at a time.  At each step, the nuances of a given language feature are succinctly yet completely demonstrated.

I've used the "koans" as a launching-off point.  When a topic is raised, I allow myself to go off and play with that language feature to deeply understand it.  And when I'm clear, I'll write a tiny article in my personal wiki.

Today, I learned about the splat operator, i.e. '*'.  What an intriguing little tool!  It has two behaviors: one when applied against an lvalue (e.g. a variable on the left side of an equal sign) and another when applied on an rvalue (i.e. an expression on the right side of an equal sign).  In gross terms, on the right it "flattens" the expression, on the left it "sponges" values.

I took the time to carefully touch each possibly with the operator.  Firing-up an irb session, I nudged it on one side, pulled it on another and watched the results.  Then tweaked it the other way... just playing with all kinds of ways to apply it.  When I got a good sense of what was happening, I attempted to explain it in as succinct but clear terms as I could in the Ruby article in my wiki.  In the act of expressing an explanation, I firmed-up my understanding ("no better way to learn, than to do and teach").

Three things:

  1. a little every day  ("with dripping drops of water, the water jug is filled").
  2. learning by "playing": mildly directed exploration.  Within the structure of a single topic (Ruby) with the guidance of a methodical "curriculum" (Ruby Koans), tinkering (irb sessions and pulling reference materials).
  3. active learning -- trimming-up my mental model by producing a crisp explanation.