Lift web framework
-
Upload
petr-hosek -
Category
Technology
-
view
1.397 -
download
0
description
Transcript of Lift web framework
![Page 1: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/1.jpg)
Petr Hošek @petrh
CZJUG, December 2010
![Page 2: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/2.jpg)
Why do we need another web framework?
![Page 3: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/3.jpg)
„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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/4.jpg)
„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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/5.jpg)
„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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/6.jpg)
„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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/7.jpg)
Overall View
![Page 8: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/8.jpg)
Expressive elegant web frameworkCombines best of other frameworks
![Page 9: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/9.jpg)
![Page 10: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/10.jpg)
Powered by languageModern object-functional JVM language
![Page 11: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/11.jpg)
View First Approach
![Page 12: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/12.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/13.jpg)
vs
Model-View-Controller View-Driven-Development
![Page 14: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/14.jpg)
Snippets
![Page 15: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/15.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/16.jpg)
AJAX & Comet
![Page 17: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/17.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/18.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/19.jpg)
Persistence Support
![Page 20: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/20.jpg)
Mapper persistence frameworkOriginal persistence framework
![Page 21: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/21.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/22.jpg)
Record persistence frameworkNew store-agnostic persistence
framework
![Page 23: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/23.jpg)
Support for different storesMongoDB, CouchDB, Squeryl, etc.
Easy to develop custom back-endAutomatic validation,CRUD and REST support
![Page 24: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/24.jpg)
REST & WebServices
![Page 25: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/25.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/26.jpg)
Modularity
![Page 27: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/27.jpg)
Lift uses modular architectureUsing Apache Maven artifacts
Many existing modules available to useJust add dependency into your project
![Page 28: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/28.jpg)
![Page 29: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/29.jpg)
Security
![Page 30: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/30.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/31.jpg)
Scalability
![Page 32: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/32.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/33.jpg)
Negatives & Drawbacks
![Page 34: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/34.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/35.jpg)
Summary
![Page 36: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/36.jpg)
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](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/37.jpg)
![Page 38: Lift web framework](https://reader036.fdocuments.net/reader036/viewer/2022062303/55557341b4c9055f5f8b4a87/html5/thumbnails/38.jpg)
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