Language Is Not Just Syntax

Posted: Mon, 26 December 2005 | permalink | No comments

My current long-term learning project is Ruby on Rails, the ultra-hyped web application framework from David Heinemeier Hansson and friends. I like it (primarily because I can see a lot of my own abortive ideas from a web app framework for PHP I used to develop), but there is one big thing about it (or, rather, it's surrounding hype) that irritates me.

Throughout the Rails literature (webpages, magazine and webzine articles, and the book Agile Web Development With Rails), there is a consistent message -- that, because everything is written in Ruby, you don't have to learn any new programming languages to write Rails applications.

This is a wonderful theory -- no large XML config files to define my database schemas, and no castrated and irritating HTML template system to learn. From defining table relationships to printing a select tag, It's All Ruby, All The Time. Sweet, right?

Sort of. The problem is that you won't find the language primitive to declare a one-to-many relationship in the Pickaxe (the definitive Ruby language reference book -- like "the Camel" for Perl, "the Bat" for Sendmail, or "the Turkey" for PHP).

Defining a separate namespace in Rails for all of these operations is, of course, necessary, since the language didn't already define these operations. But, once you've defined a whole new set of methods to do all of these operations, you can look back on your hard work and see -- what? A new language -- one specifically designed to describe webapps.

Don't get me wrong -- domain-specific languages are teh r0x0r. If everyone had to do all of their HTML manipulation by hand, programmers would be even more insane than they are. But, when you're writing your application in Rails, you're not speaking "pure Ruby". Your syntax and basic structure is Ruby, but your methods and attributes are new, different, and All Rails.

It may not be a separate programming language in the usual sense, but by the time you've added a whole new pile of classes, methods, and attributes (not to mention whole new ways of structuring your application), how much importance is the use of the @ symbol to signify an instance variable, compared to the whole new set of methods to learn?

Natural languages, of course, have similar issues. Most western european languages share a lot of common characteristics -- similar character sets, punctuation sets, and they read left-to-right. So I can look at a page of German or French, and identify most-to-all of the salient features (hey look, an 'a'!), and even grok the meaning of a few of the words (familiar to me, probably, because English misappropriated them from wherever they came from) but I still have no hope whatsoever of understanding the meaning of the passage as a whole. The language syntax looks familiar, but those nouns and verbs don't have any meaning to me.

You can't plonk a Rails app in front of even a seasoned Ruby developer and expect them to immediately jump in and start hacking on it like they've been writing it all their life. The language syntax looks familiar, but those methods and attributes don't have any meaning to them.

This is nothing peculiar to Rails, of course. If you want someone to hack on your Hibernate or Spring app, you'll get better results if you advertise for a Hibernate or Spring programmer than a Java programmer. But Rails advocates regularly say "it's all just Ruby, so there's nothing new to learn!", and that's Just Wrong, in my opinion.

As an aside, if you're looking around for something a bit different, do seriously consider Rails (or just Ruby, if you don't need a webapp framework). It's different from the "usual" suspects (C, C++, and "the Ps" -- PHP, Perl, and Python), and pleasantly so. If you judge your programming languages by the old adage "a programming language that doesn't change the way you think about programming isn't worth learning", Ruby will score well. I know it's helped me think about my programming differently already, especially my Python programming (and thanks to Anthony Baxter for answering all of my esoteric python questions at OSDC a couple of weeks ago).


Post a comment

All comments are held for moderation; markdown formatting accepted.

This is a honeypot form. Do not use this form unless you want to get your IP address blacklisted. Use the second form below for comments.
Name: (required)
E-mail: (required, not published)
Website: (optional)
Name: (required)
E-mail: (required, not published)
Website: (optional)