Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get started developing for a web using Scala?

Tags:

scala

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?

like image 627
Cory Avatar asked Aug 13 '09 14:08

Cory


3 Answers

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.

like image 56
Nick Partridge Avatar answered Oct 25 '22 10:10

Nick Partridge


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.
like image 40
andri Avatar answered Oct 25 '22 10:10

andri


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:

  • There's an open source Lift book (a snapshot of which was published as The Definitive Guide to Lift) which you can find at http://groups.google.com/group/the-lift-book (search for master.pdf on that page).
  • The Starting with Lift PDF is a shorter introduction http://liftweb.net/docs/StartingWithLift.pdf
  • The mailing list is high volume (for me) but a great source of information: http://groups.google.com/group/liftweb

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.

like image 2
Richard Dallaway Avatar answered Oct 25 '22 08:10

Richard Dallaway