Monday, August 24, 2009

#songsincode - Learning Programming Logic

#songsincode is a meme that started last week on twitter.  It only took a few hours for it to be a very strong trend.  I found myself caught up in it for a very long time I must say.  There is a strange elegance to programming code that only certain people understand.  If you were not interested in #songsincode you are probably NOT one of those people.  Programming is similar to writing in that you can do something in MANY lines of code and it will work.  But if you TRULY understand advanced programming logic you can do the exact same "something" in 1 or 2 lines.  Its the art of understanding how code works at a much deeper level.

So who cares, right? And what the heck does this have to do with learning? EVERYTHING! But just for validation I went back to TWITTER and asked.  Here was my favorite response:

But first, this is NOT a twitter rant.  #songsincode started in twitter and the power of the network effect helped the fun spread.  And that is one of the great things about twitter, but I'm not going to talk about that here.

I see a wonderful connection between #songsincode and learning programming logic.  We know the brain likes patterns.  We seek to make meaning out of new patterns by applying old patterns formed by our past experiences.  I remember learning about "prior knowledge" in graduate school, but I don't think it was quite the same thing.  Maybe, but I digress...
The point is that everyone loves music and musical lyrics have patterns.  So, perhaps instead of using x,y,z and random numbers, etc. we start by organizing a song lyric in code.  This is what #songsincode was all about.  Here are some examples:

var i = {shot:{sheriff:true,deputy:false}}
Lyric: "I shot the sheriff, but I did not shoot the deputy"
Song: I Shot the Sheriff
Band: Bob Marley

var alabama = {location: "", skies: "#00f"} -
Lyric: "...Sweet home Alabama...where the skys are so blue" -
Song: Sweet Home Alabama
Band: Lynard Skynard

if ($kid->deaf && $kid->dumb && $kid->blind) {$kid->pinballskill = 'mean';}
Lyric: "...that deaf, dumb, and blind kid, sure plays a mean pinball"
Song: Pinball Wizard
Band: The Who

Its the amazing joy of solving a puzzle and/or understanding the punch line.  If you don't understand programming code you will find this to be utterly stupid because it will make NO sense to you.  You're brain will not be able to make meaning from the new patterns it sees because, not being a programmer, your brain will have no experience to draw from.  Making connections for learners, when its done right and hits the right spot with a learner, can create amazing engagement and stickyness (Read: Made to Stick)

Are you a Beatles fan?  Here are several variations on a popular lyric:

If $i = "Eggman" and $we = "Eggmen", then $i = "Walrus" and "Coocoobajoob"
self.is_a?(Walrus) ==true
i =;
[i, you, me].map {|x| 'he'}; we = 'altogether'; i = 'walrus';
if ($_REQUEST["q"] == "Kookookachoo"){ echo "They aren't the eggman" } else {echo "I Am the Walrus";}

Okay, so all of these lines are basically pulling from the same Beatles song lyric.  Cool, huh?!  Which code is in a pattern you understand?

We talk a lot about engaging learners and we try all sorts of technology gimicks to gain and retain that attention.  But this has nothing to do with technology.  This is simply an extremely compelling example of finding a learners existing passion or interest and helping them make the connection.  This certainly is not a new concept.  Great teachers/leaders have been doing this for a long time.  But in this day and age where we are trying desparately to engage kids in science, engineering, math, etc, we must connect with THEIR passions FIRST before introducing them to ours.  I think music is a great place to start.

Got a song lyric you'd like to see in code?  I'll bet if you tweeted it someone would create it for you. ;-)

(And yes, everyone was "rickrolled" several times...its kind of funny when you see it)


Michael Leahy said...

Yep, and as a lyricist, I find the trend a scream (and a touching tribute to lyricists). I suspect the attraction for readers is a bit like doing a cryptic crossword.

My take on the trend is at:

John | Retro Programming said...

I love trying to figure out the more subtle #songsincode, although there's some I just don't get.