Make Your Web Site ‘Groovy’

If you want to get CTOs in a lather, ask them which programming language they recommend to build an advanced Web site. Jon Williams, CTO of Flat World Knowledge, recently spawned a red-hot thread on the New York CTO Club list by asking this very question.

If you want to get CTOs in a lather, ask them which programming language they recommend to build an advanced Web site. Jon Williams, CTO of Flat World Knowledge, recently spawned a red-hot thread on the New York CTO Club list by asking this very question.

CTOs approach such decisions with a passion because a bet on a language in many cases amounts to betting your entire career. The wrong choice can sink a company.

While the debate raged politely around the benefits and drawbacks of the usual suspects–Python, Ruby on Rails and PHP–one language I had not heard of was introduced: Groovy, a Java-friendly language with many of the properties of Ruby and Python.

Dan Seltzer, an independent consultant who has led architecture and infrastructure projects for TheStreet.com, Arts & Entertainment TV Networks, and Consumers Union, argues that Groovy provides the flexibility and expressive power of Ruby and Python, and, like PHP, boasts a broad ecosystem of experienced programmers. In addition, Groovy builds on Java’s deep repository of tools and widespread operational expertise for deploying and running applications at scale.

This last point is key. Because Groovy deploys on a Java virtual machine (JVM), data centers already know how to run Groovy code in production. A wide variety of existing tools can monitor aspects of performance like memory usage, connection pooling and efficiency of the running code.

The details of Seltzer’s argument and the history of Groovy are worth considering, but first, we must explain why choosing a language gets CTOs so hot and bothered.

The best way to understand the intensity of technologists’ feelings about computer languages is to consider Paul Graham’s story about using LISP to power his company, Viaweb. In Hackers and Painters: Big Ideas from the Computer Age, Graham explains how LISP made Viaweb more powerful, enabling fast replication of competitors’ innovations. (Viaweb later became Yahoo! Stores.)

Languages with loosely typed data and functions as first-class objects like LISP, Ruby, Python, and SmallTalk are called dynamic languages. In analyzing his success, Graham says LISP is more powerful than other languages. This argument implies that companies should have benefited from using LISP, but I have not found another commercial success based on LISP. Despite its power, LISP never took off–until Ruby arrived.

Ruby popularized many of the capabilities of LISP. Ruby has dynamic features that give savvy coders a powerful advantage.

Ruby on Rails, a programming framework, captured in reusable, easily configurable components the fundamental patterns that are used in creating websites, which provides another amplifier. Advocates of Ruby claim the language is the lever and fulcrum through which they can move the world, and plenty of impressive sites have proved that point, including www.BasecampHQ.com and www.Twitter.com.

Python advocates make similar arguments. Python has many dynamic features and is a favorite of Google, where Python’s inventor, Guido Van Rossum, works.

Bill Seitz, an independent product development consultant and Python advocate who is another insightful member of the NY CTO Club, pointed out three considerations for choosing a language: the power of the language; the platform of related tools and infrastructure; and the ecosystem of people, companies and related products surrounding the language.

Advocates of PHP mostly agree about the language’s power for advanced applications. PHP is a bare-bones way to program compared with LISP, Ruby or Python. Instead, PHPers argue that PHP is the best choice for simple tasks involved in most Web sites and is actually faster to program for these tasks.

What Seltzer argues persuasively is that Groovy offers the best of these choices, especially for businesses and other organizations that already use Java.

Groovy is a scripting language that has the dynamic features of LISP, Ruby, and Python. But Groovy is also a superset of Java and can also invoke any Java code library. From an operations perspective, Groovy is deployed like Java, so data center staff that can handle Java won’t be surprised by Groovy.

So what you get in Groovy is a way to use the power of a dynamic language along with access to a vast ecosystem of programmers and tools. Groovy has its own version of Ruby on Rails, an open source project called Grails, which is now part of VMware.

Seltzer reports that you can use Groovy to rapidly get a project going. If part of the code written in Groovy needs to go faster, you can rewrite it as Java. A vast ocean of code libraries in Java can be exploited by Groovy code. But most of all, Seltzer notes, Groovy makes the world of Java programming fun again, and for that reason, it is winning a lot of support.

For a company with a heavy investment in Java, Groovy should be a no-brainer. If you are starting out on an advanced Web site project, you should make a decision between PHP and Groovy.

Bare-bones sites for which advanced functionality is not crucial are probably better off in PHP because Java talent is more expensive. I use PHP-based Drupal for my sites because my needs are simple.

If you are a super programmer already experienced in Ruby or Python or have some sort of guaranteed access to such talent, these still remain viable choices. Python is a great choice if you are making a heavy investment in using Google App Engine. But if you are starting from scratch on an advanced Web site, it will be hard to do better than Groovy.