<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
| // simple example of the cake pattern | |
| // abstract DAO trait | |
| trait Repository[A, B]{ | |
| // saves an entity, returns an ID | |
| def save(entity: A): B | |
| // more features.. | |
| } | |
| trait RdbmsRepository extends Repository[MyUserCaseClass, Long]{ |
| /** | |
| * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com> | |
| */ | |
| package akka.contrib.pattern | |
| import language.postfixOps | |
| import scala.concurrent.duration._ | |
| import com.typesafe.config.ConfigFactory | |
| import akka.actor.Actor |
#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 {Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x