Professional Documents
Culture Documents
Full Chapter Clean Architecture With Net Developer Reference 1St Edition Esposito Dino PDF
Full Chapter Clean Architecture With Net Developer Reference 1St Edition Esposito Dino PDF
https://textbookfull.com/product/clean-architecture-with-net-1st-
edition-esposito/
https://textbookfull.com/product/programming-microsoft-asp-net-
mvc-dino-esposito/
https://textbookfull.com/product/programming-large-language-
models-with-azure-open-ai-conversational-programming-and-prompt-
engineering-with-llms-developer-reference-1st-edition-esposito/
https://textbookfull.com/product/modern-web-development-
understanding-domains-technologies-and-user-experience-1st-
edition-dino-esposito/
Get Your Hands Dirty on Clean Architecture Build clean
applications with code examples in Java 2nd Edition Tom
Hombergs
https://textbookfull.com/product/get-your-hands-dirty-on-clean-
architecture-build-clean-applications-with-code-examples-in-
java-2nd-edition-tom-hombergs/
https://textbookfull.com/product/windows-internals-
part-2-developer-reference-7th-edition-russinovich/
https://textbookfull.com/product/passive-solar-architecture-
pocket-reference-first-edition-thorpe/
https://textbookfull.com/product/clean-cooking-healthy-eating-is-
easy-with-delicious-clean-recipes-2nd-edition-booksumo-press/
https://textbookfull.com/product/pro-c-7-with-net-and-net-core-
andrew-troelsen/
Clean Architecture with .NET
Dino Esposito
Clean Architecture with .NET
ISBN-13: 978-0-13-820328-3
ISBN-10: 0-13-820328-8
$PrintCode
Trademarks
Every effort has been made to make this book as complete and as
accurate as possible, but no warranty or fitness is implied. The
information provided is on an “as is” basis. The author, the publisher,
and Microsoft Corporation shall have neither liability nor
responsibility to any person or entity with respect to any loss or
damages arising from the information contained in this book or from
the use of the programs accompanying it.
Special Sales
Editor-in-Chief
Brett Bartow
Executive Editor
Loretta Yates
Associate Editor
Shourav Bose
Development Editor
Kate Shoup
Managing Editor
Sandra Schroeder
Tracey Croom
Copy Editor
Dan Foster
Indexer
Ken Johnson
Proofreader
Jennifer Hinchliffe
Technical Editor
Milan Jovanovic
Editorial Assistant
Cindy Teeters
Cover Designer
codeMantra
Graphics
codeMantra
Contents at a Glance
Introduction
PART I THE HOLY GRAIL OF MODULARITY
CHAPTER 1 The quest for modular software architecture
CHAPTER 2 The ultimate gist of DDD
CHAPTER 3 Laying the ground for modularity
PART II ARCHITECTURE CLEANUP
CHAPTER 4 The presentation layer
CHAPTER 5 The application layer
CHAPTER 6 The domain layer
CHAPTER 7 Domain services
CHAPTER 8 The infrastructure layer
PART III COMMON DILEMMAS
CHAPTER 9 Microservices versus modular monoliths
CHAPTER 10 Client-side versus server-side
CHAPTER 11 Technical debt and credit
Index
Contents
Acknowledgments
Introduction
PART I THE HOLY GRAIL OF MODULARITY
Chapter 1 The quest for modular software architecture
In the beginning, it was three-tier
Core facts of a three-tier system
Layers, tiers, and modularization
The DDD canonical architecture
The proposed supporting architecture
Adding more to the recipe
Different flavors of layers
Hexagonal architecture
Clean architecture
Feature-driven architecture
Summary
Chapter 2 The ultimate gist of DDD
Design driven by the domain
Strategic analysis
Tactical design
DDD misconceptions
Tools for strategic design
Ubiquitous language
A domain-specific language vocabulary
Building the glossary
Keeping business and code in sync
The bounded context
Making sense of ambiguity
Devising bounded contexts
The context map
Upstream and downstream
An example context map
An example deployment map
Summary
Chapter 3 Laying the ground for modularity
Aspects and principles of modularization
Separation of concerns
Loose coupling
Reusability
Dependency management
Documentation
Testability
Applying modularization
The presentation layer: interacting with the outside
world
The application layer: processing received
commands
The domain layer: representing domain entities
The data/infrastructure layer: persisting data
Achieving modularity
More modularity in monoliths
Introducing microservices
The simplest solution ever
Maintainability
Designing for testability
Summary
PART II ARCHITECTURE CLEANUP
Chapter 4 The presentation layer
Project Renoir: the final destination
Introducing the application
The abstract context map
Designing the physical context map
Business requirements engineering
Breakdown of software projects
Event-based storyboards
Fundamental tasks of Project Renoir
Boundaries and deployment of the presentation layer
Knocking at the web server’s door
ASP.NET application endpoints
Presentation layer development
Connecting to business workflows
Front-end and related technologies
API-only presentation
Summary
Chapter 5 The application layer
An architectural view of Project Renoir
The access control subsystem
The document-management subsystem
Project Renoir in Visual Studio
Task orchestration
What is a task, anyway?
An example distributed task
An example task in Project Renoir
Data transfer
From the presentation layer to the application layer
From the application layer to the persistence layer
Implementation facts
Outline of an application layer
Propagating application settings
Logging
Handling and throwing exceptions
Caching and caching patterns
Injecting SignalR connection hubs
Boundaries and deployment of the application layer
The dependency list
Deployment options
Summary
Chapter 6 The domain layer
Decomposition of the domain layer
The business domain model
Helper domain services
Devising a domain model
Shifting focus from data to behavior
Life forms in a domain model
The domain model in Project Renoir
The hitchhiker’s guide to the domain
Treating software anemia
Common traits of an entity class
Rules of etiquette
Style conventions
Writing truly readable code
Summary
Chapter 7 Domain services
What is a domain service, anyway?
The stateless nature of domain services
Marking domain service classes
Domain services and ubiquitous language
Data access in domain services
Data injection in domain services
Common scenarios for domain services
Determining the loyalty status of a customer
Blinking at domain events
Sending business emails
Service to hash passwords
Implementation facts
Building a sample domain service
Useful and related patterns
The REPR pattern adapted
Open points
Are domain services really necessary?
Additional scenarios for domain services
Summary
Chapter 8 The infrastructure layer
Responsibilities of the infrastructure layer
Data persistence and storage
Communication with external services
Communication with internal services
Implementing the persistence layer
Repository classes
Using Entity Framework Core
Using Dapper
Hosting business logic in the database
Data storage architecture
Introducing command/query separation
An executive summary of event sourcing
Summary
PART III COMMON DILEMMAS
Chapter 9 Microservices versus modular monoliths
Moving away from legacy monoliths
Not all monoliths are equal
Potential downsides of monoliths
Facts about microservices
Early adopters
Tenets of a microservices architecture and SOA
How big or small is “micro”?
The benefits of microservices
The gray areas
Can microservices fit all applications?
The big misconception of big companies
SOA and microservices
Are microservices a good fit for your scenario?
Planning and deployment
Modular monoliths
The delicate case of greenfield projects
Outlining a modular monolith strategy for new
projects
From modules to microservices
Summary
Chapter 10 Client-side versus server-side
A brief history of web applications
The prehistoric era
The server-scripting era
The client-scripting era
Client-side rendering
The HTML layer
The API layer
Toward a modern prehistoric era
Server-side rendering
Front-end–back-end separation
ASP.NET front-end options
ASP.NET Core versus Node.js
The blocking/non-blocking saga
Summary
Chapter 11 Technical debt and credit
The hidden cost of technical debt
Dealing with technical debt
Ways to address debt
Debt amplifiers
The hidden profit of technical credit
The theory of broken windows
The power of refactoring
Do things right, right away
Summary
Index
Acknowledgments
The most unspoken of all is the desire to travel the world, speaking
at international conferences without the pressure to talk about what
is cool and trendy but only about what I have seen and made work—
without mincing words and without filters or reservations. To do this,
I needed to work—finally—daily on the development of real
applications that contributed to some kind of business and simplified
the lives of some kind of audience.
I have nothing to sell; only to tell. And this book is for those who
want to listen.
This book was made possible by Loretta and Shourav and came out
as you’re getting it thanks to Milan, Tracey, Dan, and Kate.
Is this book only for .NET professionals? Although all chapters have
a .NET flavor, most of the content is readable by any software
professional.
Assumptions
Part I of this book, titled “The Holy Grail of modularity,” lays the
foundation of software modularity, tracing back the history of
software architecture and summarizing the gist of domain-driven
design (DDD)—one of the most helpful methodologies for breaking
down business domains, though far from being an absolute
necessity in a project.
https://github.com/Youbiquitous/project-renoir
Note
We’ve made every effort to ensure the accuracy of this book and its
companion content. You can access updates to this book—in the
form of a list of submitted errata and their related corrections—at:
MicrosoftPressStore.com/NET/errata
Stay in touch
Software gained its own dignity and identity only at the end of the
1960s, about the time humankind landed on the moon. The first
reported use of the term “software engineering” dates to the mid-
1960s. Nobody ever managed to create the software; rather, it
emerged as a side effect—or waste product—of more ambitious
research. Separating hardware from software was the first step of
modularization ever experienced in computer science.
Note
Note
Note