• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Javazone 2010-lift-framework-public
 

Javazone 2010-lift-framework-public

on

  • 3,264 views

My talk from JavaZone 2010 covering the Lift framework and some of its cutting edge features.

My talk from JavaZone 2010 covering the Lift framework and some of its cutting edge features.

Statistics

Views

Total Views
3,264
Views on SlideShare
3,256
Embed Views
8

Actions

Likes
3
Downloads
3
Comments
0

2 Embeds 8

http://lanyrd.com 7
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Javazone 2010-lift-framework-public Javazone 2010-lift-framework-public Presentation Transcript

    • Getting Real
      Lift, the web framework for Scala
      Timothy PerrettJavaZone 2010
    • About Me
      • Committer on Lift core
      • Author of Lift in Action
      Coding Scala since 2007
      • Background in both dynamic and statically typed languages
      • Manufacturing and marketing automation is my day job
      http://manning.com/perrett/
    • Agenda
      Overview of Lift
      Differentiators and rationale
      Lift’s architecture
      Some awesome features
      A few words from our users
    • What is Lift?
      Framework for building highly interactiveweb applications
      4 years old, founded by David Pollak
      Heavily leverages Scala language features
      Takes the best ideas from other frameworks
      Makes real-time web applications accessible
    • Yet another framework?
      Developers needn't be plumbers
      Unifies the best of other framework concepts
      Granular sessions and security a la Seaside
      Convention over configuration a la Rails
      Designer friendly templates a la Wicket
      Advanced features like comet work OOTB
      Tough to be truly real-time with existing tech
    • Why Scala for Lift?
      New breed of JVM language
      Real-time means events; synergy with Actors
      Promotes better coding
      Great libraries
      Yields more maintainable applications
      Fewer defects because of immutability & type system
      Better distribution and parallelism
    • Enterprise Ready
    • Enterprise Ready
      ~75m users at the end of 2009
      ~6m new users month on month
      50m+ tweets daily
      Services 3x as much traffic with Scala
    • Enterprise Ready
      ~3m users
      ~150m “check-ins”
      All “S.LI.M” stack
      14k LOC rewritten in 90 days
      Service 3x as much traffic compared to LAMP
    • Key Differentiators
      Unparalleled out of the box security
      No single vulnerability from the OWASP Top Ten
      Unique “view first” architecture
      The best comet support available today
      All contributions are “rights assigned”
      Safe for enterprise
      Assured open source
      HTTP provider agnostic
    • View First
      What’s the matter with my controllers?!
    • Controller dispatched style
    • Controller dispatched style
    • Lift’s “View First” style
    • Lift’s “View First” Model
      It’s not MVC
      Your typical page has more than a single piece of dynamic content
      Code in the view usually means some “seep” of business logic: thus, NO code in the view
      Designer friendly dynamic content markup
      Only well-formed XHTML; no string replacement – e.g. {{myvar}}
    • Lift’s “View First” Model
    • Snippets
      A “snippet” in Lift represents a collection of rendering logic
      One snippet can be called on nnumber of pages, n number of times
      A snippet is a normal Scala class or object
      Its not magic, its just well designed
      Essentially NodeSeq => NodeSeq function
    • Snippets
      class Example {
      def nameForm(xhtml: NodeSeq) = {
      varname = “”
      def doSubmit { println(“Submitted…”) }
      bind("f", xhtml,
      "name" -> SHtml.text(name, name = _),
      "submit" -> SHtml.submit(doSubmit _)
      )
      }
      }
      <lift:example.name_form>
      <p><f:name /></p>
      <p><f:submit /></p>
      </lift:example.name_form>
    • Statefulvs Stateless
      So called “share nothing” architecture is flawed.
      The state is just pushed elsewhere (RDBMS, Cookie)
      Twitter “fail whale” part of pop culture because “share nothing” didn’t scale
      Session affinity IS workable for large scale production applications (e.g. foursquare)
    • Security
      Developers must to work hard to introduce vulnerabilities in their applications
      Page elements have session-specific opaque GUIDs to reference server components (impossible to do CSRF)
      AJAX and Comet functions also use similar GUIDs so that sensitive IDs etc are not exposed
      Persistence is safe from SQL injection
    • Security
      “Four stars to @foursquare - 1st site in a while I have taken a good look at that didn't have a single security issue (that I could find)”
      RasmusLerdorf, Inventor of PHP
    • AJAX
      It’s super simple
      Just define the desired () => JsCmd callback
      It’s super secure
      Randomly maps opaque GUIDs to AJAX urls
      It abstracts underlying Javascript libraries
      Currently supports JQuery, YUI and ExtJS
      Calling JS just becomes a Scala function
    • AJAX
      // snippet
      class JavaZone {
      def example(xhtml: NodeSeq) = bind("x", xhtml,
      "button" -> SHtml.ajaxButton(Text("Press me"),
      () => SetHtml("sampleDiv", Text("That's it"))))
      }
      <!-- markup -->
      <lift:java_zone.example>
      <div id="sampleDiv"><x:button /></div>
      </lift:java_zone.example>
      POST - /ajax_request/F12814029028330FO/
    • Comet
      SpecilizedLiftActor sub-type: CometActor
      Its just an actor… thing ! Message(whatever)
      Receiving messages pushes to the browser
      No magic beans
      Utilizes long-polling
      Soon to be auto-detecting web sockets!
      Multiple comet actors delta updates over a managed browser connections.
    • Demo
      No, its not the obligatory chat app!
    • More Awesome Features
    • SiteMap
      Declarative rules for page access
      Enforced long before the page content is processed or rendered – it’s very fast.
      Can generate site menus complete with complex rules based on application state
      Unified access control model
      Allows highly componentized functionality
    • Persistence: Mapper
      ActiveRecord style ORM
      Good for average size projects
      Supports most common RDBMS
      MySQL, PostGRE, MSSQL, Oracle etc
      OOTB support with other Lift components
      Generate CRUD interfaces via CRUDify
    • Persistence: Record
      Completely store agnostic
      Mongo DB
      Couch DB
      Squeryl
      Keeps the meaning with the bytes
      Integrates seamlessly with other Lift components such as Wizard
      Automatic REST
    • Persistence: Record
      valuser = from(users)(u =>
      where(u.email === email) select(u))
      class User extends Record[User] with KeyedRecord[User]{
      def meta = User
      valcountry = new CountryField(this)
      // rest of definition
      }
      object User extends User with MetaRecord[User]
    • Wizard
      Single and multi-screen page flows
      Declarative logic
      Inclusive of validation
      Automatic persistence via Mapper or Record
      Fully customizable throughout
      Making CRUD screens is only one line of code
      Fully testable divorced from HTTP
    • Wizard
      object AskAboutIceCreamextends LiftScreen {
      valflavor = field("What's your favorite Ice cream flavor","",
      trim,
      valMinLen(2, "Name too short"),
      valMaxLen(40, "That's a long name"))
      def finish(){
      S.notice("I like "+flavor.is+" too!")
      }
      }
    • REST Services
      Can be completely stateless
      Uses a simple DSL
      …or get close to the metal with full dispatching
      Lift has awesome support for JSON:
      Slick DSL for construction / parsing
      ~300 times faster than Scala JSON parser
      Faster deserilization than Java
      Native, first-class XML support in Scala
    • REST Services
      serve {
      case "api" :: "sample" :: _ XmlGet _ => <p>Static</p>
      case "api" :: "sample" :: _ JsonGet _ => JString("Static")
      }
      http://localhost:8080/api/sample/thing.xml
      //=> <p>Static</p>
      http://localhost:8080/api/sample/sample.json
      //=> { “Static” }
    • Modules
      AMQP
      Textile
      XMPP
      OpenID
      JTA
      PayPal
      …and lots more!
    • Thoughts from our users
    • “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 over the status quo, it redefines the state of the art.”
      Michael Galpin, eBay
    • “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 doing the plumbing.”
      David LaPalomento, Novell
    • “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 a very rapid port from our previous platform”
      Harry Heymann, FourSquare
    • Summary
      Lift makes the real-time web simple
      Lift is the culmination of many great ideas and proven methodologies
      Lift has a new take on web development
      Lift is effortlessly secure
      Lift has awesome comet support
      Lift is already proven in the field
    • Questions?
      liftweb.net
      github.com/lift/lift
      twitter.com/timperrett
      github.com/timperrett
      blog.getintheloop.eu
      Lift in Action
      manning.com/perrett/
      40% discount:
      lift40au