Model and Forms
In Play Framework, we use Scala sealed classes, case classes, and case objects to define model objects. Scala case classes are immutable and serializable.
Consider the following code, for example:
sealed class Message case object SuccessMessage extends Message case object FailureMessage extends Message
We also define some Forms using the Play Form API. Refer to the Play Framework Form-based web application section of this chapter for more information.
Other components – services and repositories
We use some other user-defined components, such as services, repositories, and Utils
, to decouple the code from controllers.
We define our business logic in Services and Data Access logic (such as DAO components) in repositories. Services use repositories and controllers use service components.
We will explore these things in detail in the coming examples.