Implementing an Idiomatic Service DSL

With the solid foundation we created, it shouldn’t be too hard to implement a straightforward DSL for services; however, in many ways the design of the API is a harder problem, and much more a matter of taste than engineering. In this case our limitations can guide us. Since our limited space and scope prevent us from pursuing more elaborate options like macros and complex base traits, we can instead focus on a thoughtful arrangement of basic Scala patterns: case classes, method chaining, and implicits.

Designing a Service

We’ll again rely on Argonaut for serialization and deserialization. As you saw in the previous section, our Response class can hold any kind of value, but we need a good way to transform ...

Get Modern Systems Programming with Scala Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.