views:

395

answers:

5

Now, I am familiar with Scala language and ready to do web development. The only framework I came across is Lift and don't know anything about it. How do you approach web development using Scala?

+2  A: 

I've used both Wicket and Tapestry to build Web applications in Scala.

The main reason why I didn't go with, say, Lift is because our developers are quite experienced with the two frameworks and thus the conversion to Scala would be easier for them.

Of course, there are some things to keep in mind when using a Java web framework with Scala:

  • Collection classes. Scala collections are far richer than their Java counterparts, but most Java frameworks are unable to use them. (Apparently something to remedy this will be introduced with Scala 2.8)
  • Occasional compatibility issues, for example Tapestry 5.1 does not accept methods it does not require in module classes, but Scala implicitly adds a $tag() to every class. This will cause Tapestry to reject the class.
andri
How did you get around the `$tag` problem? By not using Tapestry 5.1?
Daniel
I just wrote that one class in Java :) This is a hackish solution, but apparently Scala 2.8 will retire the $tag method anyway and then it won't be a problem anymore.
andri
Tip: You can use Java collections in Scala, and Scala collections in Java, with 2.7.x, with http://github.com/jorgeortiz85/scala-javautils/tree/master
Jorge Ortiz
A: 

I've had success with Struts 2 and Scala. The @BeanInfo and @BeanProperty annotations in the scala.reflect package come in handy for property access.

A: 

I believe Lift is currently the leading web framework if you want to write your application in Scala.

Ken Liu
+4  A: 

There are at least 2 scala frameworks for web development. One, as you mentioned, is Lift.

There's also Step, which is a micro-framework in the vein of Sinatra for ruby. It seems pretty cool and has a nice DSL.

Slightly more experimental, the latest scalaz trunk has a package for dealing with web applications. It's somewhat lacking in documentation and examples though, and is likely to undergo some heavy changes over the next few months (I'm a committer). If you'd like to follow the bleeding edge ways that I'm thinking of using it, you could check out scapps. I hope to have an example app up soon.

Nick Partridge
Step looks great, but I can't get it to work with Scala 2.8.
Seun Osewa
+2  A: 

Using Lift for web development in Scala has some positives:

  • active, supportive, responsive community;
  • the framework is designed for Scala rather than happens to be compatible with Scala;
  • it's had substantial effort invested in it already by multiple contributors.

The negatives:

  • possibly a challenge if (like me) you are moving from frameworks such as Struts;
  • much of the responsiveness to user requests is happening in 1.1-SNAPSHOT as opposed to specific releases, which means you're coding against moving target. Not a big issue in practice, but I can see this being unsettling for some. Clearly this bullet point is not going to age well once 1.1 is released.

As Nick Partridge pointed out in his answer, there are other frameworks. As I don't know what you want or expect of a framework I can only point you at some Lift resources which may help you make up your mind:

You may also want to take a look at motivation and influences of Lift ("Seaside's highly granular sessions and security, Rails fast flash-to-bang, Django's 'more than just CRUD is included', Wicket's designer-friendly templating....") listed on http://liftweb.net/ to see if they match what you want.

Richard Dallaway