Web Design

Scala Play

What is it?

The Play framework (2007) is an open source, high-productivity Scala and Java application framework for the web. It contains the API and the components the developers need to develop modern web applications. Play is based on a lightweight, stateless, web-friendly architecture and features predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.

Why using it?

Polymer

What is it?

Polymer is based on encapsulated and interoperable custom elements that extend HTML itself. Built atop these new standards, Polymer makes it easier and faster to create anything from a button to a complete application across desktop, mobile, and beyond.

Why not using it?

Even if Polymer has a lot of cool polyfills, it remains young. Indeed, Polymer is actually in development and this implies that the framework could have a lot of non-desirable bugs. The last problem with Polymer is that it take a while before being familiarized with it and in the context of a course project, we can’t spend a lot of time to learn a new language.

Thus we are going to use the Play framework.

How to set up Scala Play?

If you want to set up the framework, you must first follow the instructions of the following web page: https://www.playframework.com/documentation/2.3.x/Installing

Next, if you want to create a new application, open you terminal/command prompt and type:

> activator new

Then choose play-scala by typing 6.

Then you can rename your project (it assigns a default name if empty).

So you must have something like the figure below if you follow this steps:

Now go to your new project directory. Now, to open the user interface to code type:

> activator ui

If you only want to run your code, you can type:

> activator run

If you want to test your code (Play give us simple tools to test) type:

> activator test

Warning, the ui command could take a lot of time before something happen, so wait. Automatically, a web page will be opened (localhost:8888). If all worked correctly, you should have the page on the figure below.