Generating protobuf formats with scala.meta macros

Today’s focus is on scalameta. In this introduction post we’re going to see how to create a macro annotation to generate protobuf formats for case classes. The idea is to be able to serialise any case classes to protobuf just by adding a @PBSerializable annotation to the case class declaration. Then behind the scene the […]

PBDirect – Protobuf without the .proto files

Protocol Buffer (aka Protobuf) is an efficient and fast way to serialise data into a binary format. It is much more compact than Java serialisation or any text-based format (Json, XML, CSV, …). Protobuf is schema based – it needs a description (in a .proto file) of the data structures to be serialised/deserialised. On the […]

Fluent – A deep dive into Shapeless and implicit resolution

As promised in my previous post we’re going to explore to internal of Fluent and how it uses Shapeless and implicit resolution to transform case classes. Fluent started as an experiment (and still is), the code is rather small (about 300 lines of code) and yet I am still impressed by the variety of cases […]

Introducing Fluent – the seamless translation layer

In Domain Driven Design (DDD) it is recommended to introduce a translation layer (aka anticorruption layer) between 2 bounded contexts. The role of the anticorruption layer is to avoid any concepts to leak from one domain into the other. This is a sound idea as it keeps the domains isolated from each other ensuring they […]

Reducing type class boilerplate with Shapeless

If you followed our previous post on forging a DSL using type classes, you surely notice that writing type class instances is a rather repetitive task. In today’s post we’re going to get rid of this by derivating type class instances automatically using Shapeless. We also use this post as an excuse to experiment with […]

The free monad without the boilerplate

The free monad is really neat for creating DSL as it allows to completely separate the business logic from the implementation. It leaves a great freedom for the implementation choices and should you change your implementation you just need to rewrite your interpreter without changing any of the business logic. That’s great! However after playing […]