Ruby: A non-programmer’s foray into a programming language.

In high school, English was my thing. (What does this have to do with Ruby? I’m getting there.) I loved picking up a pen and chasing down words to discuss novels or detail moments or to wax poetic about the political structure of  Rome. Have you ever watched someone make pottery on a wheel? Their fingers sliding over wet clay, pressing in slightly and urging a shape where moments before there was only a glob. All the while, their feet work steadily, finding the right rhythm to keep everything moving. Sometimes, their lips move just a little, as though they were whispering to the clay the way one might whisper to a lover or share secrets with a friend- they seem to coax out beauty and share instructions with the clay, until it bends softly and forms the way they want it to. I was never any good at the pottery wheel, but  what I witnessed as other people worked was how I felt when I wrote in English class. I could grope around whisper to an idea and then keep my hands and pen moving rhythmically along until some essay appeared, fully formed on my page. It was was natural.

Then I started taking Spanish. Spanish did not come naturally to me at all. I remember this blind feeling of knowing what I wanted to say, but needing to look up not only the words, but the tense and the grammar and the punctuation. I’d get little phrases slightly off, I’d forget an accent mark or make a masculine verb feminine and then the whole sentence sounded wrong.  My teacher would carefully correct them, handing back a red stained piece of paper for me to go over again. I’d pull out the dictionary and go over each word, waiting for the moment when the words could flow effortlessly out of me and be magically correct on their own. When a phrase or sentence would “sound wrong” to me the way English does when there is a misused word.

Now, I am trying to learn to program. As I slog through lines of ruby, I get that same feeling I had in Spanish class. Learning to program is, of course, a foreign language. But it is also a language with a different set of rules.    I am not just trying to turn my english verbs and nouns into Spanish ones, I am trying to learn the very structure and sound of verbs that computers understand. Flowing descriptive sentences are chopped and spliced- removed of ambiguity and flourish and left as a series of commands strung together with a punctuation that is not dictated by the pauses and breaths of human speech. Again and again, my rake commands are greeted with lines of red errors detailing my every mistake. I grab a book and settle in, going over the code word by word one line at a time, and feel somehow super human (if only for a moment) when I clear an error. Then, when I get stuck, I show someone who actually knows what they are doing, and my super-human feeling completely vanishes as I watch them lay their fingers gently on the keyboard. They see instantly what “sounds wrong” and know exactly where to place the punctuation, when adjust a word or a space and how to clear out the red errors. And in the middle of it, some times I see their lips moving just slightly, coaxing the code to bend in just the right way.

I have a long way to go and a lot to learn. But with each error I start to recognize and each problem I figure out, I catch just a glimpse of that rhythm. One day when it, too, is natural, perhaps I will argue in praise of the art of  Ruby’s simplicity, its ease. For now, I fumble in the dark, waiting for the moment I can intuitively “hear” or feel how it is supposed to be and perhaps, even to whisper words of encouragement as the code takes shape.

Advertisements

4 responses to this post.

  1. WOW!!! Loved the description of “flowing” you described…

    Lately I understood that’s the feeling I get when testing. After 15 years of doing it and enjoying it, It’s like my hands just flow through the application and my eyes land on the bugs, and that’s why it’s so hard to explain to my programmer friends (who really try to test!) or to starting testers how to test. I constantly explain “the grammatical rules and the way to build sentences”, but I guess it takes time and experience to make it look easy and natural. Your analogy of learning a language just defined what I felt, and I know the feeling having learned 2 languages other than my mother tongue – Spanish 🙂

    I am also on the same ship with Ruby, but I guess I am 2 steps behind. I already decided I will need to jump into it, but have not started yet… we’ll see how long it takes me to go fluent there too.

    Good luck and great blog!

    -joel

    Reply

  2. Posted by Chris McMahon on October 6, 2010 at 9:42 am

    I had the same reaction when I first started teaching myself to program. (Except that I had already read a ton of code so I was maybe a little more familiar with common algorithms than you.)

    Something to keep in mind is that while programming languages have nouns and verbs and syntax, even grammar, those structures are much much simpler than any natural language equivalents. Once you get the basics down, you can start to think about stuff like design patterns pretty quickly.

    A really good book for a beginner/intermediate Ruby programmer to become a really good programmer in general is Brian Marick’s “Everyday Scripting in Ruby”. Highly recommended.

    Reply

  3. Thanks for the book suggestion! I will defiantly check it out.

    Reply

  4. Posted by gil on November 23, 2010 at 4:49 pm

    thanks for the post. its exactly where i am.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: