Posts

Showing posts from January, 2014

Composing Service Layers in Scala

The Problem We just described standard design issues you have when you start creating layers of services, DAOs and other components to implement an application. That blog/gist is  here . The goal is to think through some designs in order to develop something useful for an application. Working through Layers If you compose services and DAOs the normal way, you typically get imperative style objects. For example, imagine the following: object DomainObjects { type UserId = Long ; case class User ( id : UserId , properties : Map [ String , Any ]) } import DomainObjects._ /** * The service layer. Most service layers define the unit of work. Many * times a unit of work in the service layer is the same as that implemented * in the DAO layer, but that's because some internet examples are too small * to show the nuanances. Since this layer defines units of work, this is where * the transaction strategy is also implemented. Spr