Tutorials Clean Architecture & DDD Mastery
Clean Architecture: The 'Screaming' architecture
On this page
Screaming Architecture
Coined by Uncle Bob Martin, Clean Architecture is a refinement of Onion Architecture that emphasizes that your folder structure should "Scream" what your application does.
1. Use Cases as the Primary Unit
In a standard ASP.NET app, your folders are Controllers, Models, Views. This tells you it's a web app, but it doesn't tell you what it DOES. In Clean Architecture, your folders are CreateOrder, CancelSubscription, RegisterUser. The architecture screams "Logistics App" or "Health System".
2. The Data Flow
Request -> Controller -> Interactor (Use Case) -> Entity -> Repository -> Database.
The Interactor is where the magic happens. It coordinates the business rules using entities and mocks the data access via interfaces. This makes it incredibly easy to Unit Test your entire business flow without a single database call.
3. Architect Insight
Q: "How many projects should I have in my Solution?"
Architect Answer: "The standard pattern is 4 projects:
1. **Domain:** Enterprise business rules (Entities).
2. **Application:** Service-oriented business rules (Use Cases).
3. **Infrastructure:** Data persistence and external APIs.
4. **WebUI/API:** The entry point.
Keep it simple. Don't create 20 projects 'just in case'."