Diary of a Webster

Monday, September 08, 2008

Right-brained Programming Guide

This has to be the most right-brained programming guide in the universe:

why's (poignant) guide to ruby


Why the lucky stiff uses these hilarious cartoons and stories to motivate his exposition. Why uses wild (dare I say poignant) metaphors as mnemonics for syntax rules.
E.g.:

Arrays

An array is a list surrounded by square brackets and separated by commas.

[1, 2, 3] is an array of numbers.

['coat', 'mittens', 'snowboard'] is an array of strings.

Think of it as a caterpillar which has been stapled into your code. The two square brackets are staples which keep the caterpillar from moving, so you can keep track of which end is the head and which is the tail. The commas are the caterpillar’s legs, wiggling between each section of its body.

Once there was a caterpillar who had commas for legs. Which meant he had to allow a literary pause after each step. The other caterpillars really respected him for it and he came to have quite a commanding presence. Oh, and talk about a philanthropist! He was notorious for giving fresh leaves to those less-fortunate.

Yes, an array is a collection of things, but it also keeps those things in a specific order.

posted by Steve Stanley at 8:36 PM

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

About Me

Name: Steve Stanley
Location: Berkeley, California, United States

View my complete profile

Previous Posts

  • Once again, XSS vulnerabilities, and cool grep flags
  • vi vim reformat
  • RPM best practices
  • analog / report magic on www
  • how to tell the version of Redhat Linux installed ...
  • Subversion trials and errors
  • Subversion notes
  • Web Survey Tools
  • find | xargs grep and Human readable site map
  • sed and grep: "Stories" of web visitors

Powered by Blogger

Subscribe to
Posts [Atom]