Mastering Play Framework for Scala

By Shiti Saxena

Leverage the remarkable positive factors of Play Framework to construct scalable, resilient, and responsive applications

About This Book

  • Demystify the quandaries of net improvement utilizing Play Framework
  • Test and debug your apps through the use of Play's in-built checking out framework
  • Master the center positive factors of Scala via a entire insurance of code and examples for various scenarios

Who This e-book Is For

This booklet is meant for these builders who're willing to grasp the inner workings of Play Framework to successfully construct and set up web-related apps.

What you'll Learn

  • Customize your framework to house the explicit requisites of an application
  • Develop responsive, trustworthy, and hugely scalable purposes utilizing Play Framework
  • Build and customise Play Framework plugins that may be utilized in a number of Play applications
  • Familiarize your self with third-party APIs to prevent rewriting present code
  • Gain an perception into many of the facets of checking out and debugging in Play to effectively attempt your apps
  • Get to grasp all in regards to the strategies of WebSockets and Actors to method messages in keeping with events

In Detail

Play Framework is an open resource internet software framework that's written in Java and Scala. It follows the Model-View-Controller architectural trend and permits the person to hire Scala for software improvement, whereas preserving key homes and lines of Play Framework intact.

Starting off by way of construction a easy program with minimum beneficial properties, you get an in depth perception into dealing with facts transactions and designing versions in Play. subsequent, you enterprise into the innovations of Actors and WebSockets, the method of manipulating information streams, and checking out and debugging an program in Play. eventually, you achieve an perception into extending the framework by means of writing customized modules or plugins in Play. each one bankruptcy has a troubleshooting part that is helping you out through discussing the explanations of, and recommendations to, a few ordinarily confronted issues.

Show description

Quick preview of Mastering Play Framework for Scala PDF

Similar Programming books

Joe Celko's SQL for Smarties: Advanced SQL Programming Third Edition (The Morgan Kaufmann Series in Data Management Systems)

SQL for Smarties used to be hailed because the first booklet committed explicitly to the complex concepts had to rework an skilled SQL programmer into a professional. Now, 10 years later and within the 3rd version, this vintage nonetheless reigns ideal because the e-book written by way of an SQL grasp that teaches destiny SQL masters.

Designing Audio Effect Plug-Ins in C++: With Digital Audio Signal Processing Theory

Not only one other theory-heavy electronic sign processing booklet, nor one other uninteresting build-a-generic-database programming e-book, Designing Audio influence Plug-Ins in C++ provides every thing you every little thing you want to be aware of to do exactly that, together with absolutely labored, downloadable code for dozens audio impression plug-ins and essentially offered algorithms.

Effective C++: 55 Specific Ways to Improve Your Programs and Designs (3rd Edition)

“Every C++ specialist wishes a duplicate of powerful C++. it truly is an absolute must-read for a person taking into account doing severe C++ improvement. If you’ve by no means learn potent C++ and also you imagine you recognize every thing approximately C++, reassess. ”— Steve Schirripa, software program Engineer, Google “C++ and the C++ group have grown up within the final fifteen years, and the 3rd version of powerful C++ displays this.

Cocoa Design Patterns

“Next time a few child indicates up at my door soliciting for a code evaluation, this can be the booklet that i'm going to throw at him. ”   –Aaron Hillegass, founding father of large Nerd Ranch, Inc. , and writer of Cocoa Programming for Mac OS X   Unlocking the secrets and techniques of Cocoa and Its Object-Oriented Frameworks   Mac and iPhone builders are frequently beaten via the breadth and class of the Cocoa frameworks.

Extra resources for Mastering Play Framework for Scala

Show sample text content

The setup for writing checks Play is packaged with Specs2, given that this can be the library used internally for checking out it. It presents help to check purposes utilizing Specs2 via default, that's, no extra library dependency is needed. utilizing ScalaTest prior used to be tough yet now, Play additionally offers helpers for utilizing ScalaTest. even though it is picked up from transitive dependencies, we have to upload a library dependency to exploit the helper tools: val appDependencies = Seq( "org. scalatestplus" percent% "play" % "1. 1. zero" % "test" ) be aware The 1. 1. zero model of org. scalatestplus. play is suitable with Play 2. three. x. it really is higher to examine the compatibility whilst operating with one other model of Play at http://www. scalatest. org/plus/play/versions. Unit trying out Unit exams may be written as in any Scala undertaking. for instance, consider we've a application technique isNumberInRange that takes a string and tests if it is a quantity within the variety [0,3600]. it truly is outlined as follows: def isNumberInRange(x:String):Boolean = { val mayBeNumber = Try{x. toDouble} mayBeNumber fit{ case Success(n) => if(n>=0 && n<=3600) actual else fake case Failure(e) => fake } } Let's write a unit attempt to ascertain this functionality utilizing Specs2: category UtilSpec extends Specification { "range technique" should still { "fail for personality String" in { Util. isNumberInRange("xyz") should still beFalse } "fail for Java null" in { Util. isNumberInRange(null) should still beFalse } "fail for unfavourable numbers" in { Util. isNumberInRange("-2") should still beFalse } "pass for legitimate quantity" in { Util. isNumberInRange("1247") should still beTrue } "pass for zero" in { Util. isNumberInRange("0") may still beTrue } "pass for 3600" in { Util. isNumberInRange("3600") may still beTrue } } } those situations can be written utilizing ScalaTest with moderate variations: category UtilTest extends FlatSpec with Matchers { "Character String" should still "not be in variety" in { Util. isNumberInRange("xyz") may still be(false) } "Java null" should still "not be in diversity" in { Util. isNumberInRange(null) should still be(false) } "Negative numbers" should still "not be in diversity" in { Util. isNumberInRange("-2") should still be(false) } "valid quantity" may still "be in variety" in { Util. isNumberInRange("1247") may still be(true) } "0" may still "be in variety" in { Util. isNumberInRange("0") may still be(true) } "3600" should still "be in diversity" in { Util. isNumberInRange("3600") may still be(true) } } Unit checks that have to depend on exterior dependencies and knowledge provider layers might be outlined utilizing mocks. Mocking is the method of simulating real habit. Mockito, ScalaMock, EasyMock, and jMock are a few of the libraries that facilitate mocking. Dissecting PlaySpecification The assessments written utilizing Specs2 is also written as follows: category UtilSpec extends PlaySpecification {... } PlaySpecification is a trait that offers the mandatory helper how to try a Play program utilizing Specs2. it's outlined as: trait PlaySpecification extends Specification with NoTimeConversions with PlayRunners with HeaderNames with prestige with HttpProtocol with DefaultAwaitTimeout with ResultExtractors with Writeables with RouteInvokers with FutureAwaits { } Let's experiment in the course of the API uncovered via every one of those characteristics to appreciate its value: Specification and NoTimeConversions are characteristics of Specs2.

Download PDF sample

Rated 4.58 of 5 – based on 11 votes