Relearning to Program

[article]
Summary:

Twenty years ago, Clarke Ching fell in love with programming. Then he got a job doing just that and fell out of love within five years. Fifteen years later, Clarke sought the help of a well-known programmer for advice on how to rekindle his dormant passion for programming. The advice Clarke received led to a greater discovery.

I was working on a COBOL credit-card system that was older than I was. I'd gone from a world where I excelled to one where it was difficult to be anything other than average. Five years or so I worked as a programmer in different languages and different environments until eventually I admitted it: My love affair with programming was over.

Since then I've worked as a manager, analyst, consultant, and author. But you know what? Fifteen years later, I still love programming. And I miss it. A few months ago, I decided to do something about it. I asked Andy Hunt—a guy whom I think of as a programmer's programmer—if and how I could learn to code again. He knew that I didn't want to write code professionally. I just wanted to get my hands dirty for a little while to see if I still "got it." In the process, I also hoped to understand my programmer friends a little more than I currently did. Andy suggested learning Ruby. He also recommended reading "Learn to Program" by Chris Pine.

Ruby is an interpreted programming language that runs on Windows, Linux, and Mac (and probably a few other operating systems as well). It's an easy language to set up (it's pre-installed on Macs), and it's really easy to learn compared to most programming languages. Ruby is also free, which never hurts, and it's used commercially as well. Within thirty minutes of downloading the book, I had set up Ruby, written, and executed my first program. The program added 1 and 2 together then wrote the answer to the screen. If you are wondering, the answer was 3, not "Hello World."

Now, this probably sounds daft to you since you weren't there, but I was delighted with myself when I saw the number 3 come up on the screen. For a brief but pleasant moment, I thought to myself, "I've still got it!" If you feel even the merest pang of envy, then why not grab your nearest, friendly programmer and ask him to help you download and install Ruby. Then fire up a text editor and type in "puts 1 + 2", save the file as myprog.rb, run it from the command line and see what happens. You could probably manage this without a programmer, but if it makes it easier, then why not ask for help?

I originally learned to code using languages like Pascal, Modula-2, and C. Things have changed a lot since then. The world's gone all object-oriented, for a start, and according to my developer friends, a whole lot more complicated with Java and C# and their enormous libraries. But, did you see how short myprog.rb was? That's why Ruby is a good choice for learning or relearning programming. It is short, simple, and to the point. As a developer friend put it, you type less but get more done.Of course, that's all a bit "Programming 101," and there's a lot more to programming than that. One must learn loops, variables, objects, methods, arrays, and recursion. The good news: I relearned all of those on day two of my affair with Ruby. I worked my way through the book, doing some of the exercises and skipping others. I wrote an integer-to-Roman-number conversion program. It read the integer and wrote out its Roman number equivalent. I wrote it as a loop, and then I rewrote it recursively. I only scratched the surface, but it felt good. I'll be sticking with my day job, for sure, but, hey, it's a start.

I wasn't going to mention my little experiment to anyone until I read an article by Derek Sivers, "founder, president, and sole-programmer of cdbaby.com." Derek is a self-taught PHP programmer. He built cdbaby.com from scratch using PHP. A few years ago, with help from a top-notch developer, he rewrote the site using Ruby on Rails. Two years into the project, Derek cancelled the rewrite for a number of reasons. Then, in two months, he rewrote the entire project in PHP claiming that "It's the most beautiful PHP I've ever written, all wonderfully MVC and DRY, and I owe it all to Rails."

As a programmer Derek may have been self-taught, but he was no slouch. He created a commercially successful Web site from scratch, on his own—something few professionally taught programmers can claim. I suspect that Derek was an above-average programmer despite being self-taught. Yet, by working with Ruby on Rails which my programmer friends tell me makes it difficult for programmers to write badly designed code, he learned how to become a better programmer.

And that's what got me thinking: I wonder how many programmers out there could become better programmers, more productive programmers, and perhaps even happier programmers if they spent a little time working with Ruby on Rails (or an alternative) and learned new design skills?

I don't know the answer to that question, so please leave your comments below.

About the author

AgileConnection is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.