Web Projects #2: Language Choice

When I began my web apps back in 2007 I was adamant about a few things but quite flexible regarding others. I cared about the integrity of my data: I would not be using MySQL, and SQLite was for testing, only. The production machine would be PostgreSQL. A LAMP-ish arrangement was likely, but while I had plenty of experience with Linux (and other Unixes) as well as Apache, and I had already decided on an RDBMS, my language skills were geared toward modern languages, not the computer variety. Years of Linux work had left me competent with shell scripting; I used bash but always eyed zsh. The question was: Perl, PHP, Python, or Ruby?

(This is a followup to a July, 2011 post, ‘Background and Motivation‘)

I counted PHP out rather quickly. I had experience with it. I had used PHP4 on one of my own sites; the PHP coding I had one had come easily to me, but was (a) hackish, (b) limited in extent, and (c) treated rather procedurally rather than in an object-oriented fashion. PHP-based applications—blog engines, more complex CMSs, and so on—seemed to have new security alerts every week, and while this, arguably, was the fault of the coders and not the language, the ease with which coders produced functional but crucially-flawed software in PHP disturbed me. And while I had coded in PHP, I did not enjoy it: I did not like the syntax, I didn’t like how most coders formatted their code, I disliked the haphazard naming scheme of built-in functions, and so on.

My introduction to Perl came in the late 90s when I began using Linux, but I only ever “admired” it from afar. I watched others code it, I perused system scripts in Perl, I used Perl-based early CMS sites like Slashdot and those based on Scoop. I had an instant draw to Perl in that its creator/author, Larry Wall, was described as a ‘linguist’ … I had studied (some) linguistics, I loved languages, etc. … of all the LUG members was I not the best-suited to appreciate Perl?

Around this time Rails was becoming ‘the big thing’ … not that there is ever a single ‘Big Thing'(tm) … and by extension Ruby’s profile was becoming sharper … clearer … larger … higher? As a Linux user I’d never paid much attention to Ruby; I had, however, more or less shifted to using Macs a few years earlier when I bought an iBook G4, and in the ‘Mac World’ I seemed to come across Ruby more frequently. I read some code, I did some tutorials. I felt at home, at least a little, welcomed and comforted; I’d have to give Ruby some credit for making OO-programming/design ‘clear’ to me in a way that it hadn’t been under, say Perl. Yet … yet … I’ve always prided myself on a lack of cavities and having good teeth, and there was just a little too much syntactic sugar with Ruby. I’d stopped reading most fantasy after my teens, yet Ruby was full of magic.

If this were Goldilocks and the Three Bears—and I played the role of Goldilocks—we could stop here, as one language would be too big, one too small, and one just right. Or hot, cold, and just right. But this is no fairy tale.

Some friends/colleagues/acquaintances liked and used Python, though for the most part it was not as prominent in the LUG. A lot of web folks used PHP, the hackier types preferred Perl. But our former interim president, a statistics professor and guy who kept a giant Emacs buffer open as his entire interface, even on a 20-plus-inch display, had introduced me to Zope back around 2001. And I’d heard of text manipulation and math-science apps as strong areas for Python. There was less magic, the OO-ness was as clear to me as it was in Ruby, the syntax had less sugar, I actually liked the indentation/formatting/white-space rules, and as a newcomer to the language I appreciated the principle of one-right-way-to-do-it.

At the time it came down, for me, to Python and Ruby. Ruby had Rails and, by extent, Active Record; Python had TurboGears (which an online acquaintance was discussing) and Django, along with a couple ORM products. A couple of my Python-using friends were also Lisp-heads, and even though there was no direct connection between the languages, it seemed like there had to be something that would draw users to both languages … if I at some level appreciated or admired Lisp, would I likewise want to be a Python user?

This was 2007. After short discussions, soul searching, and the like, I narrowed matters to Ruby and Python. I seriously contemplated Perl at first, with Mason … but I knew I’d need to (want to!) avoid mod_perl. I realized I could hack something together in PHP, but it would be like a sugar fix that left me feeling sick later. I never seriously contemplated Java, though I could have. I later looked up other languages and frameworks … could I do the project in Lisp? Haskell? Lua?

This was 2007, I would have the job for one year, and eventually somebody else would have to maintain what I wrote. Anybody could pick up PHP, correct? By ‘somebody else’ a humanities or social science graduate student was implied. HTML I’d trust him or her with, but PHP? A little too much loaded-gun-with-no-safety. Too little enforced code-content / code-template separation. Regardless of whether I liked Lisp, could I really expect anybody else to use it?

This was 2007, not 1999 and not 2012. We had already shifted from .shtml through .php and mod_perl to frameworks. Could I write a database interface in bash that would produce web pages and process form input? Probably. Would I want to? Not really. Would it be ‘the way’ or even ‘a way’ to go forward? No. There were frameworks out there, and Python had moved beyond Zope. My real options, when considering [1] code maintainability, [2] the support community, and [3] the odds for further development three, four, or five years down the line—assuming I did not go with Java—were Ruby and Python.

This was 2007 and I realized in 2008 that I’d likely be the one returning to this code from time to time to implement bug fixes and new features. What would I be still willing to approach and use? In the summer of 2007 I proposed to my bosses a Python & PostgreSQL solution glued together with and served by Django. This summer I’ve been meaning to revisit that code for them I still think it was the right choice.

Previous: Background and Motivation
Next: Framwork Choice

About Steve

47 and counting.
This entry was posted in Code and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *