Tuesday, May 29, 2012

Finally: A great dev environment for Lift + Scala

Working With Lift

So far, my excursions into Scala have been a lot of fun, save for one thing: the development environment. I use Eclipse most of the time, and the Scala IDE left a bit to be desired, especially when paired with Maven. The promise is there, it was just continually painful to get things working, and was very fragile. Moving from my desktop to a laptop meant 2 hours of fiddling with reconfiguration.

I continually look for new tools when the ones I'm using are this painful. I even toyed with the emacs plugin.

Then I found this set of instructions on the Scala IDE site related to using Lift with the Scala IDE on Eclipse. It I had, to date, avoided learning yet another build  system (in this case sbt), but was willing to give it a go.

To my delight, it worked perfectly, quickly, and without any fiddling.

I've combined it with the JRebel plugin from Zero Turnaround (there is a free Scala license), it gives me instant save and refresh updates. I've now got a Lift webapp with JPA persistence and seamless unit tests, all running from Eclipse with auto-complete of code, refactoring support, etc.

So, as of today, I'd highly recommend this setup to anyone wanting to try out Lift. Do not use maven. Do not use eclipse WTP (the setup described has an embedded Jetty that runs from eclipse for excellent debugging support).

OK, on to some comments on my experience with Lift and Scala: I am truly impressed. I was suitably impressed even when the tools sucked.

There are plenty of great materials out there for getting the basic gist of both, so I'm going to limit my comments to these observations:

I've been writing C/C++/Java/Perl/etc for over 20 years. I'm typically the best developer in my group, and produce 10k lines of good production code a month. Basically, I'm no slouch. But of all of the languages and toolkits I've used, it is rare that I write a complete bug-free feature on the first go, and it is even more rare when I don't know the language all that well (I've read the Scala book from cover to cover, but I've only written maybe 1,000 lines of code).

But time and again I crank out new features using Scala and Lift that just work. The first time. Even when I'm not sure I've got the notation right. Frankly, I'm thrilled by it.

The view first philosophy exactly matches my own (in fact I wrote an in-house CMS system that used a very similar system for Java with Seam), but Lift and Scala are able to leverage the no-code-in-the-view technique to impressive heights.

The only two complaints I've heard that seem to have merit are:

1. The documentation is weak (though it seems to be improving, and the source code integration with eclipse helps tremendously)

2. Scaling of Lift requires sticky sessions (e.g. a session cannot easily from one server to another without losing things)

My experience so far is that a failure in a cluster causing some users to lose their current page of work is an acceptable level of availability...and I have not looked deep enough into the inner working of Lift to know how much you'd lose (I think just the current state...login would probably be maintained)

Anyway, the long and short of it for me: now that the tools are hindering me, I'm extremely pleased with both the language and the web framework.

No comments:

Post a Comment