• Save
Hands on web development with play 2.0
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
363
On Slideshare
354
From Embeds
9
Number of Embeds
2

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 9

http://www.linkedin.com 8
https://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Hands-on Web Development with Play 2.0! Abbas Raza Jean-Baptiste Volta
  • 2. Gratitude YOU for stopping by!! SVCC for organizing the CampGuillaime Bort for Play Framework
  • 3. Game PlanPlay Framework Primer (~ 15 min) - Concepts - Architecture - Artifacts It’s Play time (Rest of session) - Setting up Play - Building App Step-by-Step
  • 4. What’s Play?Designed by web developers for web developersBrings high-productivity web development tothe JVMGreatly enhances developer experience (DX)
  • 5. Full stack web frameworkJava and Scala supportHigh productivityStateless architectureHTTP centricTypesafeAsynchronousHighly scalableIntegrated testing
  • 6. High ProductivityMake changes and hit reload in Java world!!Compile-time checkingType-safeConsoleBuilt-in serverUseful error reporting
  • 7. Compile-time CheckingChecks almost all the artifacts at compile-time – Java/Scala code – Templates – Routes – Config – Javascript (via Google Closure) – LESS – Coffeescript
  • 8. Stack trace – Ring a bell?!
  • 9. Error ReportingBrowser error reportingSimplified and useful info
  • 10. Error Reporting
  • 11. HTTP CentricDesigned around HTTP, hence statelessState either at client or in persistence layerBack button works!Does not fight HTTP or the browser - leverages the power of HTTP
  • 12. Why complicate URLs?http://www.coolsite.com/cooler/fe/l=en_US/p/Organizer/CoolerID=9909873008/a=90875276_2885276/invalidateCoolerCache=true/b_c=119/b_otsc=SHR/b_otsi=SPIUUB/s_ev20=jhuC%7CSHR%7COTSI%7CSPICFB/s_pt=REP,HUY,SLO,EE2,FRE,FER#provin=mic
  • 13. Clean URL DesignURL design part of the application designURL is an interface – a contract not implementationURLs are human and machine friendlyFor instancehttp://localhost:9000/#/projects/3/tasks
  • 14. Modern Web DevelopmentHTML5CoffeeScriptLESSBootstrap
  • 15. TestingSpec2 - Default way to testTest controller, router, templateTest from browser
  • 16. Cloud DeploymentHerokuCloudFoundryOpenShiftCloudbees
  • 17. Architecture
  • 18. Downloading & InstallationDownload the binaries from http://www.playframework.com/down loadLatest version – 2.0.4Unzip it to any locationAdd play to path
  • 19. Create New ProjectRun the following command$ play new coolApp“Start” the application with$ cd coolApp$ play run
  • 20. Directory Structure
  • 21. Application ConfigurationConfiguration properties for any application.Examples include database connection info.File located at: <Project>/conf/application.confA typical entry looks like: – db.default.driver=org.h2.Driver
  • 22. application.conf
  • 23. RouterWhat: Routes requests to appropriate controllerWhere: File located at: <Project>/conf/routesTypical entries:GET / controllers.Application.index
  • 24. routes
  • 25. ControllersController serves requestsContains business logicLocated at <project>/app/controllers
  • 26. Controllerspackage controllersimport play.api._import play.api.mvc._object Application extends Controller { def index = Action { Ok("Hello, Rockstar") }}
  • 27. TemplatesTemplate encapsulates HTML to be renderedIs a Scala functionIs type-safeAre compiled into classes for run-time
  • 28. Templates@(user: User)(body: Html)<html> <body> <header> <dl id="user"> <dt>@user.name</dt> </dl> </header> <section id="main"> @body </section> </body></html>
  • 29. IDE SupportEclipse – eclipsifyIntelliJ – ideaNetbeans – netbeansScalaIDE
  • 30. Free Online Scala Course by Martin Oderskyhttp://www.coursera.org/course/prog fun
  • 31. It’s Play timeImplement a Lean Startup conceptLean Startup Movement mandates validating the pain point before building any productStep-by-step development of the application from scratch
  • 32. Thank You!!
  • 33. Referenceshttp://www.playframework.comPlay 2 with Scala in Action by Peter Hilton, Erik Bakker, Francisco Canedo
  • 34. Image References‘Lets play’ - http://www.drpeppersnapplegroup.com/smedia/www/2011/04/11/img-lets- play460x300_223742710844.jpg‘Architecture diagram’ – http://www.playframework.org