A Playful Eye for the JEE Guy

Preview:

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

List of all JEE JSRs

It goes on

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

That’s it - application created!

Note the “localhost” - server is running locally

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

*in Scala - methods of an object

Also deals with parameter bindings

And can be exported to use in client-side Javascript

The slides you’ve seen are actually a Play application

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)

Here is the application controller

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

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

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

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

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

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

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

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.

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.

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