play-logo_

This week we began working with the Play web application framework. Frameworks aim to alleviate overhead associated with web application development by providing libraries for common tasks such as database access and user authorization and authentication. Since the developer no longer has to build these functions from scratch, he can focus on implementing the things that really make the app stand out.

But we must learn to walk before we can run and our WODs reflected this.

The first WOD was a simple exercise that had us create a new Play project from scratch, import it into IntelliJ and ensure that it passed all QA tests (i.e. checkstyle, application and integration tests). We were given very clear instructions on how to accomplish these tasks and because of this, I was able to complete my first and only attempt at this WOD in Rx time of 9 minutes and 54 seconds.

The second WOD was a little more interesting than the first. Using this Play Framework template provided by Dr. Johnson, we were instructed to recreate our ‘A history of browsers’ webpage from a previous WOD. Since the HTML and CSS code was already written, we could focus on the simple, yet crucial, details of the framework (like removing views, routes and controllers) and getting a general sense of how to structure apps in this environment. Since I’ve used the Play framework in the past, this WOD was a review of material I already knew therefore, I was able to finish my first attempt in less than 14 minutes qualifying as Rx time. I repeated the WOD twice after watching Dr. Johnson’s solution and completed my second attempt in 7:50 and my third in 9:02.

The third WOD was like the second in that we recreated a project from a prior WOD, however, this exercise was more difficult since it consisted of multiple pages. For a beginner, adding pages to a Play application is a non-trivial task.  Each new page requires its own view file in the Views directory, action method in the Application.java controller file and a defined mapping in the routes file. Initially, it can be difficult to remember how all of these parts fit together in the entire framework but with practice, it becomes routine. Again, since I’ve worked with Play in the past, these exercises were more of a review and I was able to complete my first attempt in 13:03 and my second in 13:55, both qualifying as Rx time.

Like the two WODs before it, the fourth and final WOD was a revisit of a previous project in which we were to recreate the Kamanu Composites website in the Play framework environment. This was a fairly easy WOD to complete since the HTML and CSS code could be copied out of the previous project and because it didn’t require adding new views or modifying routes. I finished my first attempt in Rx time of 11 minutes and 40 seconds and my second attempt in 10 minutes, 31 seconds.

Although the learning curve is steep, using web application frameworks can provide huge benefits. By promoting code reuse, frameworks boost developer efficiency and productivity. By enforcing structure, projects become clearer and more organized. These are just a few of the many reasons learning to use a web application framework is well worth the time and the effort.

Category:
All, Play, Software Engineering, Twitter Bootstrap
Hackaday

Fresh hacks every day

Slashdot

Professional Portfolio