Tuesday, January 16, 2007

Jedi Rubyness

I love Ruby books. They're fun to read. Being that there's a contest going on for blogging about Ruby on Rails, I can't pass this up. Apparently I have a chance to win a Ruby book by blogging about how Ruby on Rails has made me a better programmer. Awesome!

This is going to read a little like an 'epic' type of thing - it will involve love, hate, frustration, elation, and the occasional video game / movie reference (alright the whole thing is a movie), but I hope after reading this you will feel as inspired as I did writing about my path to Jedi Rubyness and Rails. Think of it as a quest. We all love quests - Star Wars, the Legend of Zelda, etc (ok never mind I'm just dating myself). This is a quest about getting better at programming because of Ruby on Rails!

Jedi Rubyness:

Me : the kid who happens upon a cool thing like the Force, or a lightsaber, or in this case Ruby On Rails

Java the Hutt
, or JavaVader : you know, in a sense it could be the villain, you'll see why!

Obi-Wan Kenobi
: David A. Black (only he doesn't get killed off by Java)

A long time ago (past year) in a galaxy far, far away, (New Jersey), I wasn't doing much of anything as far as programming. I occasionally dabbled in front end web design with Flash and HTML, but other than that I never really utilized anything in a "pure programming" sense.

One of my clients (one of those princesses, as long as they're played by Natalie Portman), a martial arts instructor needed a site for his school asking for some nifty looking GUIs and music and all. I was able to create something very cool and showy with Flash, but something was missing (Jar Jar Binks). He wished to have a little more control of the website, maybe wanting to update news or allow other users to create accounts and login and such. My knowledge of front end design would have allowed me to create a great looking front page for everyone to come in and see some links to those actions, but other than that I was dead in the water in granting my client's request (I couldn't use the Force yet).

So, remembering my Java and JSP days back in database development class, I attempted by my lonesome to roll together a small database backed website that could allow some users to post messages or create something new on the site themselves. Pain ensued.

(note: I don't know about you, but obviously some web developers out there will consider installing a Java based web dev stack childs play. Keep in mind I was a web dev newbie, with my prior knowledge in HTML, CSS, Flash, and MAYBE some java and C on my local machine, nothing ever associated with web dev. Building a Java web dev stack was a nightmare for me).

Java the Hutt: Ho, ho, ho . . .

JavaVader: If you only knew the POWER of Struts, Tomcat, Javabeans, Swing, Hibernate, Ant, Maven, and J2EE . . . *wooooosh*

No, I wasn't listing what I attempted to install. I was listing the topics I saw when I went to my local bookstore to research the matter. First thoughts that came into my mind (beyond the OH !@#$) was INTIMIDATION (Fear leads to hate, hate leads to anger, anger is the result of confusing base installations)

Not wanting to back down from a challenge, I started reading through some example code, hoping to find a chapter that would tell (in minimal steps) how to get maybe a shopping cart online or a blog. I had to put the book down as my mind couldn't seem to process all the code that was required.

Plus, for some odd reason, I was getting a bad feeling about this.

That was a discouraging experience for me. For someone wanting to "migrate" (get it? get it?!? ahh nevermind . . .) from front to middle to backend web development, it seemed like I would be spending so much more time studying and configuring rather than applying or creating.

Sometime later in the month, I went back to see if I couldn't grasp any other technologies that would help me out in my quest:

"Ok, we got Perl, PHP, hmm next to that is Python and . . . wait a second . . . Ruby for Rails? I've HEARD of this Ruby thing through a friend who's a Linux sysadmin and he said it would be cool for me to learn Ruby, but I never had the chance to research the matter until . . . now . . . let's see what this book has to say".

I don't really recall if my reactions were of the jovial type (SCORE!), or if I even broke a smile (CHEESE!). What I do remember is that one of the reoccurring thoughts (besides "Use the Force") in my head was "I can DO this" and "this looks like fun". Here, in one chapter, David A. Black walks you through setting up a music store application (bare bones of course). Of course I didn't know what :attr_accessor did at the time, but the rest of the code seemed to read like a story.

I walked home that day with Agile Web Development with Rails and Ruby for Rails. I figured that the Agile book would be good to get me started in just coding away while the Ruby for Rails could be a supplement in learning (and my first Rails lightsaber). I was actually eager to give this a try.

Like any toddler learning to walk, I crawled, drooled, stumbled, tripped, fell, cried a little, but then started to waddle (holding onto something to keep my balance). I was able to apt-get Ruby (thank you Debian packages!), install Rails, get my MySQL database talking to it, and almost cheered when I saw the all-too-familiar Welcome aboard, you're riding the Rails! page. THAT was easy.

Scaffolding was the early childhood magician for me - lots of great autogenerated magic that awed me when I knew so little about it, then later upon learning exposing all the tricks and semi-disappointed me (but still much appreciated as training wheels!). I felt like a Ruby / Rails padawan. Not even a padawan, just some guy who has been exposed to something that I definitely knew had so much potential but I didn't know what to do with it. Enter the Ruby / Rails community.

It didn't take long to find a local Ruby hackers meeting. My first exposure to the Ruby community in person was at a New York City Ruby Hacker meeting in . . . NYC. Prior to this I had never been to a programmers' meeting or a user group. I must say I'm glad this was my first experience and sorry that it will probably spoil me from now on.

The people I met were very friendly and extremely knowledgeable and very willing to walk me through some basic Ruby bootstrapping. Ruby has bought together a community I'm proud to be a part of and support (now I could mention specific people I've met such as Francis Hwang, Amy Hoy, Ryan Davis and the sort and try to match another Star Wars character to them, but to me they will just remain kick-ass Ruby Jedi)

Just being around the community whether it be live at meetings or on IRC changed my programming habits. I read programming books voraciously, always wanting to know more. I changed my coding 'style' to a more test-driven approach thanks to ZenTest / Autotest. I was able to run code on the fly with IRB, and somehow understood self-referential has_and_belongs_to_many relationships.

Were there any aspects of Ruby on Rails that specifically made me a 'better programmer'? I would say all the improvements in me were subtle. I'm still learning, but no other language has me wanting to learn MORE about it. I believe the fact that it sparked my passion for learning more about programming, testing, deployment, etc. makes me a better programmer than the average one. I believe the fact that I ENJOY the language I program in makes me a better programmer.

So yes, there may be a host of other programmers out there who can do (n) variations of a quick sort algorithm, but I would take a bet that there aren't many that enjoy the language they program in, wish to contribute to it, and even formed a user group in their hometown just so they can get more of a Ruby fix each month (shameless plug: Go New Jersey Ruby!)

Epilogue: I guess there could have been some epic battle but I don't know what to use for Star Destroyers or Ewoks. All I know is that the path to Jedi Rubyness via Rails is a FUN one and I encourage anyone with a creative spark in their eye to take that path!

1 comment:

Riva said...

You write very well.