lift web framework

38
Petr Hošek @petrh CZJUG, December 2010

Upload: petr-hosek

Post on 15-May-2015

1.396 views

Category:

Technology


0 download

DESCRIPTION

Lift web framework is one of the most popular parts of Scala ecosystem. Thanks to many innovative features and its use in projects such as foursquare or snapsort, this web framework popularity is skyrocketing. Moreover, for many developers, this web framework is the main reason to study Scala programming language.

TRANSCRIPT

Page 1: Lift web framework

Petr Hošek @petrh

CZJUG, December 2010

Page 2: Lift web framework

Why do we need another web framework?

Page 3: Lift web framework

„Foursquare switched over to Scala & Lift last year and we‘ve been thrilled with the results. The ease of developing complex interactive AJAX web pages enabled very rapid port from our previous platform.“

Harry Heymann,

Page 4: Lift web framework

„Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level features like the built-in Comet support allow you to focus on innovating instead of the plumbing. “

David LaPalomento,

Page 5: Lift web framework

„Lift is the only new framework in the last four years to offer fresh and innovative approaches to web development. It‘s not just some incremental improvement of the status quo, it redefines the state-of-the-art. If you are a web developer, you should learn Lift. “

Michael Galpin,

Page 6: Lift web framework

„The fact that Lift-based applications run unchanged on the SAP's NetWeaver CE Java application server makes this an intriguing approach for enterprise applications in the SAP world.“

Darren Hague,

Page 7: Lift web framework

Overall View

Page 8: Lift web framework

Expressive elegant web frameworkCombines best of other frameworks

Page 9: Lift web framework
Page 10: Lift web framework

Powered by languageModern object-functional JVM language

Page 11: Lift web framework

View First Approach

Page 12: Lift web framework

View-Driven DevelopmentSimilar to MVC but not exactly the same

No business code allowed in the viewUsually represents „seep“ of business logic

Designer friendly markup contentViews are well-formed XHTML/HTML5

Page 13: Lift web framework

vs

Model-View-Controller View-Driven-Development

Page 14: Lift web framework

Snippets

Page 15: Lift web framework

Snippet provides rendering logicCalled arbitrarily times on multiple pages

Snippet is Scala class or objectFunctions transforming sequence of XML nodes

Snippets can be stateful or statelessUsing session affinity

No hidden magic or code plumbingEverything is just well designed

Page 16: Lift web framework

AJAX & Comet

Page 17: Lift web framework

Native support for AJAX and CometProbably best support available today

JavaScript becomes Scala functionsUsing Scala function callbacks for AJAX

Abstracts underlying JavaScript libraries

Support for JQuery, YUI and ExtJS

Page 18: Lift web framework

Comet support through ActorsSending/receiving messages to/from browser

Utilizes long-pollingFuture use of HTML5 web sockets

Provides inherent securityUsing opaque GUIDs for AJAX & Comet URLs

Page 19: Lift web framework

Persistence Support

Page 20: Lift web framework

Mapper persistence frameworkOriginal persistence framework

Page 21: Lift web framework

Lightweight object-relational mappingSimilar design to ActiveRecord

Support for common relational databases

MySQL, PostgreSQL, Oracle Database, etc.

Support for different persistence systems

Hibernate, JPA, etc.

Page 22: Lift web framework

Record persistence frameworkNew store-agnostic persistence

framework

Page 23: Lift web framework

Support for different storesMongoDB, CouchDB, Squeryl, etc.

Easy to develop custom back-endAutomatic validation,CRUD and REST support

Page 24: Lift web framework

REST & WebServices

Page 25: Lift web framework

Built-in REST and WebService supportUsing either simple DSL or full dispatching

Both statefull and statelessDeclarative rules for URI dispatching

DSL for JSON constructionExtremely fast serialization/deserialization

First-class XML supportNative part of Scala language

Page 26: Lift web framework

Modularity

Page 27: Lift web framework

Lift uses modular architectureUsing Apache Maven artifacts

Many existing modules available to useJust add dependency into your project

Page 28: Lift web framework
Page 29: Lift web framework

Security

Page 30: Lift web framework

Out-of-the-box securityNo vulnerability from the Top Ten

Difficult to introduce vulnerabilitiesDevelopers needs to make an effort

Page elements have opaque GUIDsUsed to reference server components

AJAX and Comet use similar GUIDsSensitive data are not exposed

Persistence safe from SQL injectionSQL queries sanitization enforcement

Page 31: Lift web framework

Scalability

Page 32: Lift web framework

Support for database shardingUsing federation of database servers

Using non-blocking input/outputOut-of-the-box support for Jetty Continuations

Decoupling threads from requestsImplemented via Scala Actors

Page 33: Lift web framework

Negatives & Drawbacks

Page 34: Lift web framework

The good, the bad and the uglyLift has downsides as well

Framework „takes over control“What is happening in the background?

Documentation is insufficientMany important details are missing

Exploring Lift book is incompleteUpcoming Lift in Action book is still in EAP

No direct tool supportRelated to insufficient Scala tool support

Page 35: Lift web framework

Summary

Page 36: Lift web framework

Lift makes the web development simpleLift combines many ideas & methodologiesLift has new take on web developmentLift is inherently secureLift has excellent AJAX and Comet supportLift is already proven in the industry

Page 37: Lift web framework
Page 38: Lift web framework

Content adapted from Lift in Action bookTimothy Perrett, Manning Publications, 2011

Content adapted from Exploring Lift bookDerek Chen-Becker, Marius Danciu and Tyler Weir, 2009

Content adapted from official website liftweb.netCourtesy of WorldWide Conferencing, LLC