The Web Application Framework Candidates

9:20 PM EST Thursday, February 14 2008

The web application framework race is heating up, so let's take a moment to meet some of the candidates.

Java

George W. Bush

The current leader in the web application framework space, has a declining approval rating from the general public, but still maintains support from members of the static typing party.

Rails

Hillary Clinton

One of the leading candidates from the dynamic typing party. This candidate has experience that proves she can bring change.

Merb

Barack Obama

A candidate from the dynamic party who is quickly gaining support, running on his campaign of hope. Has a stance similar to that of Rails on many of the campaign issues.

Django

John Edwards

Another strong dynamic party candidate, but having a hard time stealing the spotlight from the two dynamic party candidates, despite running on a strong platform.

Grails

John McCain

The leading candidate for the static typing party, particularly among moderate static typers, but having a hard time gaining support from conservative members of the static party who claim that he is too dynamic on some issues.

Scala

Ron Paul

A candidate that appeals to some members of both the dynamic and static typing parties, quickly gaining notoriety on the web for his support of once unconventional ideas like functional programming.

Posted in  | Tags Rails, Python, Django, Ruby, Scala, Java, merb, | 2 Comments

Lift on Leopard

12:28 PM EST Friday, January 25 2008

Until Steve Yegge's Code's Worst Enemy rant, I hadn't even heard of the language Scala. Although Steve made no mention of Scala in his article, there were plenty of people in the comments suggesting he check out Scala. Not surprisingly, it's getting a lot of love in the blogosphere now. I've read through some of the online documentation and next I wanted to see some code and the web framework for Scala seems to be Lift. I tried get the examples running on my Macbook Pro, which is running Leopard, and I ran into this error:

java.lang.IllegalStateException: The PluginDescriptor for the plugin 
Plugin [org.scala-tools:maven-scala-plugin] was not found.

Luckily I found this thread on the lift google group, which states that the problem is that the maven that comes installed on Leopard is 2.0.6, which doesn't work with Left. I installed 2.0.8 by putting maven at /usr/local/maven and adding /usr/local/maven/bin to my PATH. That got it working and after what seemed like a hour of downloading maven packages, Lift was up an running.

At first glance, I say the Lift Scala code looks just as verbose as Java code. Take this for example:

package com.hellolift.model

import net.liftweb.mapper._
import net.liftweb.util._
import net.liftweb.sitemap._
import net.liftweb.sitemap.Loc._

import com.hellolift.controller.BlogCache
import com.hellolift.controller.BlogCache._
import com.hellolift.controller.AddEntry

object Entry extends Entry with KeyedMetaMapper[Long, Entry] {
  override def dbTableName = "entries"
  // sitemap entry
  val sitemap = List(Menu(Loc("CreateEntry", "/entry", "Create An Entry", 
                     If(User.loggedIn_? _, "Please login"))), 
             Menu(Loc("ViewEntry", "/view", "View An Entry", Hidden)), 
             Menu(Loc("ViewBlog", "/blog", "View Blog")))

  // Once the transaction is committed, fill in the blog cache with this entry.
  override def afterCommit = 
    ((entry: Entry) => {BlogCache.cache ! AddEntry(entry, entry.author.is)}) :: Nil
}

class Entry extends KeyedMapper[Long, Entry] {
  def getSingleton = Entry // what's the "meta" server
  def primaryKeyField = id

  // Fields
  object id extends MappedLongIndex(this)
  object author extends MappedLongForeignKey(this, User) {
    override def dbDisplay_? = false
  }
  object title extends MappedString(this, 128)
  object body extends MappedTextarea(this, 20000) { // Lift Note: 7
    override def setFilter = notNull _  :: trim _ :: crop _ :: super.setFilter
  }
}

Maybe I'm just spoiled by the succinctness of Ruby, but that code doesn't strike me as immediately readable. There's what looks to be routing (URL Mapping) code in here, which strikes me as odd. The model doesn't seem like a very good place for routing code.

Posted in  | Tags Scala, Liftweb | 0 Comments

Scala, Clojure and Lisplets

11:47 AM EST Saturday, December 22 2007

As a result of reading Steve Yegge's latest blog rant, I have discovered a few new interesting things. Steve's rant is very anti-Java for all the right reasons, but falls apart when it gets to the "So here's what I'm going to do about it" part. He's switching to another language, one that runs on the JVM, but not Lisp, Jython, JRuby or Groovy, but for apparently no good reason, JavaScript. Not that JavaScript is a bad language, but I see reason why you would choose that over Lisp, Python or Ruby, and he fails to offer one.

The good thing is that through the comments of this post I learned about a few things, either directly or indirectly. Some of these thing have been around for a long time, but hey, I'm just learning about them.

First, there is a ground swell of support for Scala. I checked out the docs on their site and does look like a very powerful, expressive language. It seems to have many of the features of Lisp without being a Lisp dialect. It is syntactically Java-ish, but unlike Groovy, which really for some reason just seems like much-needed syntactic sugar for Java, Scala feels lieke a completely different language. In other words, and not that this is saying Groovy is a bad thing, but Groovy really isn't conceptually different than Java, where as Scala is, with things like case classes, for example. This is a language I'll have to look into some more.

There is also a mention of a new List-dialect for the JVM called Clojure. Clojure creator Rich Hickey (you need a blog Rich) recently gave a presentation on Clojure at LispNYC and the audio and slides are there. Clojure has a bunch of interesting ideas in it which he explains in the presentation. Clojure has a literal syntax for vectors (a.k.a arrays, lists) and maps (a.k.a Hashtables, Dicts) in addition to the traditional lisp lists. It is not quite a purely functional language, but strongly encourages it, making it the default programming paradigm over object-orientation. I've been wanting to check out Haskell and Erlang to get familiar with the functional programming paradigm, but Clojure might be a good way to get some exposure to that as well.

Another thing I found is Lisplets, which was created by Rich Hickey as well a few years ago. It is a Java Servlet that packages up the entire environment of an HTTP request, request parameters, cookies, session, etc, into an S-expression that is then handed off to a Lisp interpreter that listens on a socket. Lisp then reads the s-expression, does whatever it does, and then returns data to the Servlet which gets sent to the client. Mod_lisp is based on a similar concept. I think it's kind of interesting to think of web development in this manner, with a definitive layer of abstraction between the processing of request into a data structure, and then processing the request based on that data structure.

Posted in  | Tags Clojure, JVM, lisp, Scala, Java, Lisplets | 0 Comments