Why Ravioli Is My Favourite Recipe

Jeroen Rosenberg
Jeroen Rosenberg
Published in
14 min readFeb 24, 2023

--

No, this post is not about my favourite recipe. Or maybe in some way it is. This is a post about hexagonal architecture, an architectural pattern for building software. I’ll explain what hexagonal architecture is all about and what it has to do with cooking ravioli. To illustrate what it looks like in practice, I’ll show how to transform ‘spaghetti code’ into highly cohesive, loosely coupled and highly testable code using the principles of hexagonal architecture and domain driven design. I do this by rewriting a Kotlin and Spring Boot application and introducing hexagonal architecture.

Multitier Architecture

To understand what hexagonal architecture is all about, let’s first have a look at the classic, layered architecture. In this type of software architecture, often compared with lasagne, you divide your code in a couple of layers or tiers. In a 3-tier architecture this would be:

  • Presentation layer
  • Logic or domain layer
  • Data layer
3-tier architecture or lasagne architecture
3-tier architecture

Presentation Layer

This layer provides the interface through which users or other systems can access your application, either for data entry or consumption. It presents results to users or clients and it enable users to interact with your application. This could for instance be…

--

--

Jeroen Rosenberg
Jeroen Rosenberg

Dev of the Ops. Founder of Amsterdam.scala. Passionate about Agile, Continuous Delivery. Proud father of three.