(Start) Making Sense of DDD-Based Software Engineering
Now available for purchase on leanpub.com
- Have you heard of Domain-driven Design, but you've never found the right way to get started?
- Have you tried to learn it before, only to find it difficult or not fully convincing?
- Are you already applying DDD principles but sometimes unsure whether you are doing it right?
- Do you know how to systematically identify bounded contexts?
- Do you really understand what the Ports & Adapters pattern means?
- Do you see why Aggregate design is so central in DDD - and do you apply it in a structured way?
- Do you struggle with code quality in your real-world projects?
- Do you want to explore a specialized DDD-based approach that provides much more practical guidance than the original, often rather generic definitions?
This book is not just another introduction to Domain-Driven Design (DDD). It explores real-world design problems, challenges conventional approaches, introduces new ideas by providing practical guidelines on three levels of abstraction, which the author calls "Clean Bounded Contexts", "Clean Aggregates" and "Clean Domain-Driven Code". These terms together form a specialized, systematic approach to professional software engineering for backend applications. The book is packed with detailed diagrams and code examples. Along the way, readers gain practical guidelines and design insights that help them confidently apply these concepts in their own software projects.
Besides the general goal to teach the foundations of Domain-Driven Design and Ports & Adapters, the 3 main goals of this book are:
- Concerning Software Architecture: Provide a clear and consistent understanding of the symbiosis between Domain-driven Design and Ports & Adapters so that you can end up with what I call "Clean Bounded Contexts".
- Concerning Software Design / Tactical Design: Provide a clear and consistent understanding of the so-called Aggregate Design by not only explaining the general rules but also introducing my "Clean Aggregate Design Checklist" into the general discussion, which leads to what I call "Clean Aggregates".
- Concerning Software Development, i.e. the actual coding: Provide a clear and consistent understanding of the symbiosis between the Tactical Design from DDD and Clean Code from Uncle Bob, which results in "Clean Domain-Driven Code" ("CDDC").
In summary, it is therefore a common thread running through the book to specialize the original concepts through more concrete ones, so that they provide more practical guidance. I don't claim to have exclusively invented the terms "Clean Bounded Context", "Clean Aggregate" and "Clean Domain-Driven Code", but they are given a dedicated meaning in this book and in combination, they represent an integrated approach that - according to my research and experience - hasn't been described in this coherent form elsewhere.
In part 1, you will get a basic introduction to the main concepts of DDD. This is especially for DDD beginners, but I bet that many intermediate- and even some advanced practicioners will find some aspects, that they weren't aware of in detail. So unless you are in too much of a hurry, I would recommend that even advanced readers at least skim the chapter so that you get the common basis for the rest of the book.
In part 2, we go into detail about the strategic design. I start with a concise differentiation between domain, subdomain, bounded context and some other important terms. This might sound trivial at first, but I think that these terms are more often used in a sloppy way than correctly and so I consider it quite important to lay a good foundation from the very beginning. A major focus is laid on the criteria that should be used to properly identify bounded contexts. Still in chapter 2, you will find a detailed strategic design example demonstrating exactly that.
Part 3 is about backend architecture and my definition of the "Clean Bounded Context" concept. One focus lies on the exploration of the different logical layers in such a combined DDD- plus Ports&Adapters backend application. This is also the right place to discuss one of the religious questions of the DDD community: Should you isolate the domain layer or not?
Part 4 is all about the Tactical Design from DDD and it finally introduces my "Clean Aggregate Design Checklist". This means, that besides the general introduction of the pattern elements as defined in the literature so far, you will get concrete practical guidance for the application of the known rules. I suppose the checklist to be a unique distinguishing feature.
Part 5 is challenging DDD's "Consistency Boundary Rule" with a complete practical example that uses domain events in order to adhere to that rule. You will also find general discussions about different architectural styles, also known as "Orchestration vs. Choreography" – which also includes a Business Process Engine-based approach.
In Part 6, we finally dive into the large and detailed tactical design example including a simulation of a sequence of knowledge crunching sessions. This is accompanied by many in-depth discussions around otherwise "hidden" design topics. You find the application of the previously defined aggregate design rules and the checklist from part 4. I also discuss the big question, if you should apply a puristic DDD knowledge crunching approach or if the introduction of additional methodologies could be preferrable.
In Part 7, I transform the design from part 6 into code, utilizing all the tactical design patterns and demonstrating the symbiosis with Clean Code, which I call "CDDC": Clean Domain-Driven Code!
Part 8 provides three additional architectural aspects to round up that area of discussions: At first, I extend the FAMS example with the necessity to communicate with other bounded contexts. We assume, FAMS needs to integrate an external "Live Ticker" mobile app. Secondly, I transform the DDD-based approach into a context where there is a third party core system like it is the case for most banks and insurances. Lastly, I discuss an alternative architectural approach that reduces the amount of remote communication between components.
Part 9 represents the overall conclusion with a discussion if DDD is worth the effort and the most important final recommendation.
About Me
About the Author
The author has been working as a freelance software engineer since 2001 for several Banks, Insurances, State Institutions as well as some small to medium-sized enterprises. He has played various roles in all these software development projects, and continues to do so to this day: Developer, Senior- / Lead-Developer, Software-Architect, Solution-Architect and Business Analyst to name the most important ones. He is constantly trying to establish "State-of-the-Art" architectural- and programming principles, because he keeps finding that in many projects, even well-known patterns and approaches do not get considered appropriately - often because of a lack of knowledge. Accordingly, this book is the result from many of his consulting- and coaching efforts.
Legal Notice
Information pursuant to § 5 of the German Digital Services Act (DDG)
Stephan M. Bauer
Lessingstr. 5
94315 Straubing
Germany
Contact
Email: sb (at) stephanbauer.me
Business Information
VAT-ID: DE 201912849
Responsible for Content
Stephan M. Bauer, address as stated above.
Liability for Content
The contents of this website have been created with the utmost care. However, no guarantee can be given for the accuracy, completeness and topicality of the content. As a service provider, I am responsible for my own content on these pages in accordance with general laws. I am not obliged to monitor transmitted or stored third-party information or to investigate circumstances that indicate illegal activity. Obligations to remove or block the use of information under general law remain unaffected.
Liability for Links
This website contains links to external third-party websites, such as leanpub.com, over whose content I have no influence. Therefore, I cannot accept any liability for this external content. The respective provider or operator of the linked pages is always responsible for their content. The linked pages were checked for possible legal violations at the time of linking; illegal content was not recognizable at that time.
Copyright
The content and works created by the site operator on these pages are subject to copyright law. The book cover, the book text and all related materials are protected by copyright. Duplication, editing, distribution and any kind of use beyond the limits of copyright law require the written consent of Stephan M. Bauer.
Book Content and Sales
This website presents the book "(Start) Making Sense of DDD-Based Software Engineering". The book is sold exclusively through Leanpub, which acts as the seller and handles ordering and payment processing. This website itself does not process book orders or payments; Leanpub's own terms and privacy policy apply to any purchase.
Consumer Dispute Resolution
I am neither obliged nor willing to participate in dispute resolution proceedings before a consumer arbitration board.
Privacy Policy
The controller responsible for data processing on this website is Stephan M. Bauer (see the contact details in the Legal Notice). This website does not use contact forms, newsletter services, user accounts or online shop functionality, and it does not embed YouTube videos, Google Maps, reCAPTCHA, Google Fonts or social-media plugins. It does not use any advertising or tracking network other than Google Analytics 4 (see below). All images and icons are hosted on this website's own server and are not loaded from external third-party servers. Personal data is processed only as described below.
Hosting and server log files
This website is hosted by STRATO GmbH ("STRATO"). When you access this website, STRATO's servers automatically process technical connection data - such as your IP address, the date and time of the request, and the file requested - in server log files, in order to technically deliver and secure the website. This processing is carried out by STRATO as the hosting provider; I do not personally access, store or evaluate this server log data. The legal basis is Art. 6(1)(f) GDPR (legitimate interest in the reliable and secure operation of the website). Further information is available in STRATO's privacy policy.
Google Analytics 4
This website uses Google Analytics 4, a web analytics service provided by Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Ireland ("Google"). Google Analytics is not loaded when you first open this website. It is loaded dynamically, and only, after you explicitly click "Accept" in the consent banner shown on this website. If you click "Decline", Google Analytics is not loaded and no connection to Google's servers is established for this purpose.
Your decision is stored in your browser's local storage under the key analytics-consent, with
the value granted or denied. You can review or change your decision at any time via
the "Privacy settings" link in the footer of this website. If you had previously granted consent and then
withdraw it, this website deletes the Google Analytics cookies that are accessible to it and reloads the
page. Please note that data already transmitted to Google before withdrawal cannot be deleted retroactively
through this mechanism, and withdrawal does not affect the lawfulness of processing carried out before it.
Where you have given consent, Google Analytics processes technical information, usage information and information about your interactions with this website, to the extent this is actually collected by Google Analytics 4. For this Google Analytics property, Google Signals is disabled. Event data is retained for 2 months and user-level data for 14 months, after which it is automatically deleted. At the Google Analytics account level, sharing of data with other Google products and services is disabled, as is sharing for the purpose of creating models for contributions and business insights; sharing for Google's technical support and for product recommendations for this account is enabled. These two enabled settings relate to Google's support and product-improvement functions for my Analytics account and do not constitute or enable personalized advertising.
Data may be transferred to Google LLC in the United States. Depending on Google's current certification status, this transfer relies on the European Commission's adequacy decision for the EU-U.S. Data Privacy Framework and/or standard contractual clauses. The legal basis for using Google Analytics is your consent pursuant to Art. 6(1)(a) GDPR and, where applicable, § 25(1) of the German Telecommunications-Digital-Services Data Protection Act (TDDDG). Further information is available in Google's privacy policy and in Google's Google Analytics data-privacy information.
External links
This website links to external services, in particular Leanpub, where the book is sold. Clicking such a link causes your browser to connect directly to that external service. From that point on, the respective provider's own privacy policy applies; see, for example, Leanpub's privacy policy. I have no influence over the data processing performed by these external providers.
Your rights
Under the GDPR, you have the right to access the personal data I hold about you, to rectification, to erasure, and to restriction of processing, as well as, where applicable, to data portability and to object to processing. Where processing is based on your consent, you have the right to withdraw that consent at any time, as described above. You also have the right to lodge a complaint with a data protection supervisory authority. As I am based in Bavaria, Germany, I consider the Bayerisches Landesamt für Datenschutzaufsicht (BayLDA) to be the competent authority for this website, without prejudice to your right to complain to the supervisory authority in your own country or place of residence. For any data protection enquiries, please contact me at the address given in the Legal Notice.