Preface – Get Your Hands Dirty on Clean Architecture



This section briefly introduces the author and the coverage of this book.

About the Book

We would all like to build software architecture that yields adaptable and flexible software with low development costs. But, unreasonable deadlines and shortcuts make it very hard to create such an architecture.

Get Your Hands Dirty on Clean Architecture starts with a discussion about the conventional layered architecture style and its disadvantages. It also talks about the advantages of the domain-centric architecture styles of Robert C. Martin's Clean Architecture and Alistair Cockburn's Hexagonal Architecture. Then, the book dives into hands-on chapters that show you how to manifest a hexagonal architecture in actual code. You'll learn in detail about different mapping strategies between the layers of a hexagonal architecture and see how to assemble the architecture elements into an application. The later chapters demonstrate how to enforce architecture boundaries. You'll also learn what shortcuts produce what types of technical debt and how, sometimes, it is a good idea to willingly take on those debts.

After reading this book, you'll have all the knowledge you need to create applications using the hexagonal architecture style of web development.

About the Author

Tom Hombergs is a software engineer by profession and by passion with more than a decade of experience working on many different software projects for many different clients across various industries. In software projects, he takes on the roles of software developer, architect, and coach, with a focus on the Java ecosystem. He has found that writing is the best way to learn, so he likes to dive deep into topics he encounters in his software projects to create texts that give structure to the chaotic world of software development. He regularly writes about software development on his blog at and is an occasional speaker at conferences.

Learning Objectives

By the end of this course, you will be able to:

  • Identify potential shortcomings of using a layered architecture
  • Apply methods to enforce architecture boundaries
  • Find out how potential shortcuts can affect the software architecture
  • Produce arguments for when to use which style of architecture
  • Structure your code according to the architecture
  • Apply various types of tests that will cover each element of the architecture


This book is for you if you care about the architecture of the software you are building. To get the most out of this book, you must have some experience with web development. The code examples in this book are in Java. If you are not a Java programmer but can read object-oriented code in other languages, you will be fine. In the few places where Java or framework specifics are needed, they are thoroughly explained.


This book explains all concepts through an example web application called "BuckPal," which transfers money online.

The code of the example application is available on GitHub at Feel free to post any questions and suggestions as issues in the GitHub repository.


The code examples in this book are in Java. Even as a Java fanboy, I will admit that Java is a very verbose programming language. Since I don't want you to be distracted by boilerplate code within the code examples, I decided to just leave it out. In order for the code to still be valid, I included Lombok ( annotations in the code that will autogenerate some boilerplate code:

  • The @Getter annotation will autogenerate getter methods for the annotated field or, if used on a class, on all private fields of that class.
  • The @RequiredArgsConstructor annotation will autogenerate a constructor with parameters to initialize all private final fields of a class.
  • The @NoArgsConstructor annotation will autogenerate a no-argument (default) constructor.


If you have anything to say about this book, I'd love to hear it. Get in touch with me via mail at or on Twitter via