InfoQ

News

David Pollak on lift and Scala

Posted by Gavin Terrill on Mar 11, 2008

Community
Architecture,
Java
Topics
Web Frameworks ,
Language
Tags
Scala

David Pollak announced the 0.6 release of lift  yesterday:

lift is an expressive and elegant framework for writing web applications. lift stresses the importance of security, maintainability, scalability and performance, while allowing for high levels of developer productivity.

lift 0.6 brings the following exciting new and enhanced features:

   - Scala 2.7.0 support (which means that you can once again use Eclipse to develop lift apps)
   - Localization of core lift classes (Thanks Marius)
   - Enhancements to Redirect support
   - Cookie support (rather than using underlying Servlet cookie support)
   - Enhancements to Prepared Statements
   - Significant enhancements to JSON support and client-side HTML generation
   - Improved tests and documentation (thanks Eric)

InfoQ took the opportunity to ask David about some of the motivations that lead him to develop lift, as well as his experiences with Scala to date.

Can you give us some background on your experiences that led to developing lift?

I had done 18 months of Rails and 10 years of Java development.  Rails was a fresh perspective on web development... common tasks were the "short path" items.  It was great. However, I found that Ruby's dynamic typing led to a lot of errors and the requirement for 95% test coverage in order to have reasonable deployments.  Unfortunately, to get 95% test coverage, my code size (including tests) ballooned to near Java sizes.  Additionally, because Rails "changes things" (it has different methods that it dynamically changes) between development, test, and deployment, even with excellent test coverage, there were frequent deployment mishaps. The above problems intersected with the MRI Ruby implementation being slow and unstable and a development community that didn't care, I decided to "look elsewhere." I stumbled across Scala and instantly realized it was what I was looking for.  Scala has all the language features that I like in Ruby and all the language features I like in Java.  It was a "you've got your peanut butter in my chocolate" moment for me.

What makes Scala a great environment to build a web framework in?

Syntax.  Performance.  Stability.  An excellent type system that's only there when you need it.  Closures.  Pattern Matching.  Built in XML literals.  Actors.  It's hard to decide.

What would you say differentiates lift from Rails, Seaside or Java frameworks such as Struts or Spring MVC?

As easy and concise as Rails.
As secure and stateful as Seaside and Wicket.
Type-safe yet not hyper-verbose unlike Struts.
Better Comet support than any other web framework.
Support for "real time" application that allow many people to collaborate.
So, you can build wicked powerful apps wicked fast (just like Rails.)  But you don't have the issue of shovelling all your state into a relational database.  The state is "live" not freeze-dried and that makes a huge difference for writing apps that go beyond front ends to database tables.

Can you describe your experiences deploying lift in a production environment? What sort of performance are you seeing?

I've done a fair amount of benchmarking lift applications.  The lift render pipeline is short and sweet and lift runs on standard web containers.  This means that you get similar performance to well written J2EE apps. For non-database pages, lift typically has sub 1ms render time. For pages that require hitting the database, page render times are related to db access. On an Amazon EC2 instance (1.7Ghz Intel processor with 2GB of RAM), I was able to sustain 500+ pages per second and 50% of those pages had DB access and the MySQL instance was running on the same box.

How do you see lift working with existing Java applications, or in mixed language environments (e.g. JRuby)?

lift works very well with existing Java code.  lift's RabbitMQ and XMPP support is based on Java libraries.  Scala calling Java code is 100% seamless.  Scala implementing Java interfaces and subclassing Java classes is 100% seamless.  It just works. There's at least 1 lift project that's lift and Spring co-existing in the same WAR file.  My first Scala app was a Servlet container.  I was so blown away that "it just worked."

No comments

Watch Thread Reply

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.