tags:

views:

642

answers:

3

Given the various advantages of the Scala language I have decided to write my next web-application in Scala. However, should I be using Wicket or Lift? I am familiar with Wicket, a like it quite a bit, but know very little about Lift. Is learning Lift worth the effort in this context?

In order words, how does Lift compare to Wicket? Given that the web-app will be in Scala, could using Lift make my life as a developer easier?

+4  A: 

I've made several webapps in Lift. Coming from a traditional Java background with lots of Maven + JSF/Facelets + Spring + Hibernate, I must admit that though I love Scala I get frustrated with some of the weaknesses of Lift. In particular, I think snippets often mix business rules with interface details. Also, implementing comprehensive unit testing is very hard.

I'm not familiar with Wicket, but at the moment I'm writing an app using the Play Framework. The Scala support mostly works pretty well, and there is an Akka module. Akka is wonderful for any kind of non-trivial application that needs to scale.

Play looks very promising, even though it's still in active development the documentation seems to be pretty good as well. The CRUD framework is neat for getting to a functional state quickly, or for building a simple admin interface for data that won't be changed very often.

Magnus
+1 on Play. Looks tremendously awesome!
Tom Morris
+1 Play. Simple, lightweight, stateless = scalable, powerful....
sirmak
are you suggesting java+play or scala+play here?
rogerdpack
I've mostly used scala+play but java+play is more mature if that is important to you.
Magnus
+6  A: 

Wicket and Lift are quite different beasts. I have some knowledge about both frameworks (but far from the expert level you usually see here):

Wicket: Each page on the web site has a HTML template page and a Java/Scala backing class. The Wicket magic is to connect the HTML template page to the corresponding class, and map each Wicket ID in the template to the correct method in the class so that data is visible in the generated HTML page sent to the client. That's it. Wicket is pure Web and nothing more. It i very easy to compose your own graphical components in Wicket and inherit from them.

Lift: Lift was created by David Pollak as a reaction to the problems he had with Rails. What he needed was performance and security. Lift is faster and more secure than Rails. It is actually very secure and handles SQL-injection, CRSF, XXS, replay attacks automatically.

Lift does the same thing as Rails (maps to DB), but is very different from Rails. The mental heritage from Rails is visible, since some of the APIs in Lift use Ruby syntax (with underscore and question marks in inspectors), something that might surprise the Scala developer. Lift is not a classical MVC-framework like Wicket, It is Model-ModelView-View. Actually Lift is more focused on the request-response cycle. It is meant to simulate the event driven GUI programming (like Java Swing or .NET GUIs). This means that HTML-elements and actions is written at the same place:

var inputName = ""
SHtml.text(inputName,s => inputName = s)

This code will create an input HTML tag like this:

<input type="text" value=""/>

and connect a function to a variable so that the input is stored. The structure is the same even if AJAX is used instead of HTTP GET/POST.

Lift is expressive and powerful, but not very easy.

Please correct me if this is not accurate!

olle kullberg
+9  A: 

If you like Wicket, you should stick with what you know & like. Wicket is a fine web framework and doing Scala & Wicket is very nice because you can use Scala's traits to compose classes in Wicket... it really cuts down the boilerplate vs. Java.

Lift has strengths that Wicket doesn't:

  • Much better Ajax support. Lift's Ajax support is far less verbose than Wicket's. If you are going to do a lot of Ajax, learning Lift might be valuable.
  • Comet support. If your application has a server-push component to it, Lift offers better comet support than any other web framework.
  • Lift is more Scala-like. If you're coming from Java, then Lift's use of pattern matching and function passing is a learning curve.

In terms of the comments in this thread, I'd like to disagree with some of the statements made:

  • Lift does not require that you mix presentation and business logic. There are tons of options for you to structure your application appropriately for your coding style from a complete divorce of presentation and logic to mixing the two wildly and freely. Your choice.
  • Lift does not do the same thing as Rails. Lift is not another me-too MVC framework, nor did I focus a lot of my time on the CRUD aspects of Lift. Lift is about security, developer productivity, maintainability and building highly interactive (Ajax and Comet) web apps. The Lift libraries contain a lot of modules including a number of ORM modules, JSON support, etc. This is due in part to the dearth of libraries in Scala back 2-3 years ago and due to the fact that the Lift community is awesome and supportive and the Lift release process works very well (monthly milestone releases that are stable enough to power Foursquare.)
  • Lift is not focused on the HTTP request/response cycle. Lift is focused on abstracting those away. The developer spends less time worrying about parameter naming and more time focusing on business logic.

But, once again, if you like Wicket, sticking with Wicket is a great choice... Wicket's even better in Scala.

David Pollak