51

A Playful Eye for the JEE Guy

Embed Size (px)

DESCRIPTION

Transcript of a presentation about the Play framework. The actual presentation was dynamic, and hard to capture in a slideshow (see slide 22 for why).

Citation preview

Page 1: A Playful Eye for the JEE Guy
Page 2: A Playful Eye for the JEE Guy
Page 3: A Playful Eye for the JEE Guy
Page 4: A Playful Eye for the JEE Guy
Page 5: A Playful Eye for the JEE Guy

List of all JEE JSRs

It goes on

Page 6: A Playful Eye for the JEE Guy
Page 7: A Playful Eye for the JEE Guy
Page 8: A Playful Eye for the JEE Guy
Page 9: A Playful Eye for the JEE Guy

Download Activator at: http://www.typesafe.com/activator

Page 10: A Playful Eye for the JEE Guy
Page 11: A Playful Eye for the JEE Guy
Page 12: A Playful Eye for the JEE Guy

That’s it - application created!

Page 13: A Playful Eye for the JEE Guy
Page 14: A Playful Eye for the JEE Guy

Note the “localhost” - server is running locally

Page 15: A Playful Eye for the JEE Guy
Page 16: A Playful Eye for the JEE Guy
Page 17: A Playful Eye for the JEE Guy

The router maps HTTP requests to actions, which are static methods*

*in Scala - methods of an object

Page 18: A Playful Eye for the JEE Guy

Also deals with parameter bindings

Page 19: A Playful Eye for the JEE Guy

And can be exported to use in client-side Javascript

Page 20: A Playful Eye for the JEE Guy
Page 21: A Playful Eye for the JEE Guy
Page 22: A Playful Eye for the JEE Guy

The slides you’ve seen are actually a Play application

Page 23: A Playful Eye for the JEE Guy

The slides you’ve seen are actually a Play application

(in the presentation itself, these are annotated screenshots, of course) (but feel free to fork it on GitHub, as they say, and run locally)

Page 24: A Playful Eye for the JEE Guy
Page 25: A Playful Eye for the JEE Guy

Here is the application controller

Page 26: A Playful Eye for the JEE Guy

Here is the application controllerNote that I’ve created a toy DSL for standard slides.

Page 27: A Playful Eye for the JEE Guy

Here is the application controllerNote that I’ve created a toy DSL for standard slides.Let’s look at the object hierarchy of the elements in this DSL

Page 28: A Playful Eye for the JEE Guy
Page 29: A Playful Eye for the JEE Guy
Page 30: A Playful Eye for the JEE Guy

Pretty small template for rendering recursive structure, and wrapping it in Bootstrap3, I’d say

Page 31: A Playful Eye for the JEE Guy
Page 32: A Playful Eye for the JEE Guy

Here’s where the recursive rendering happens. Note the usage of pattern matching, to route the element to the proper render function

Page 33: A Playful Eye for the JEE Guy
Page 34: A Playful Eye for the JEE Guy
Page 35: A Playful Eye for the JEE Guy
Page 36: A Playful Eye for the JEE Guy
Page 37: A Playful Eye for the JEE Guy
Page 38: A Playful Eye for the JEE Guy
Page 39: A Playful Eye for the JEE Guy

Type “activator console” at the command prompt to get to the console. Or, “activator” to start the activator shell, and then “console”

Page 40: A Playful Eye for the JEE Guy

Type “activator console” at the command prompt to get to the console. Or, “activator” to start the activator shell, and then “console”

We can play with the model objects, even when the application is not running

Page 41: A Playful Eye for the JEE Guy
Page 42: A Playful Eye for the JEE Guy

We can even render templates when the application is not running.

Page 43: A Playful Eye for the JEE Guy

We can even render templates when the application is not running.

Big news for testing UI layer - you can just inject data to it directly, instead of forcing the application into a certain state.

Page 44: A Playful Eye for the JEE Guy

We can even render templates when the application is not running.

Big news for testing UI layer - you can just inject data to it directly, instead of forcing the application into a certain state.

Very different from JSF, where the page is the “leader” of the rendering process, and calls backing beans. This approach has its advantages, but it also makes it hard to separate the page from the back-end.

Page 45: A Playful Eye for the JEE Guy
Page 46: A Playful Eye for the JEE Guy
Page 47: A Playful Eye for the JEE Guy
Page 48: A Playful Eye for the JEE Guy
Page 49: A Playful Eye for the JEE Guy
Page 50: A Playful Eye for the JEE Guy

Easy to write non-blocking code, thus easy to scale

Page 51: A Playful Eye for the JEE Guy