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: objectDomainObjects{typeUserId=Long;caseclassUser(id:UserId,properties:Map[String, Any])}importDomainObjects._/** * 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. Spring implements this with * annotations and proxies/byte-code enhancers. We'll…