Solution Architecture · Quick recall Q&A

1 min read
Mid-level6 min read
Rapid overview

Quick recall Q&A

  • Q: Can Clean Architecture and DDD coexist?
  • A: Yes. DDD provides the modeling approach inside the Domain layer, while Clean Architecture provides the dependency and layering rules around it.
  • Q: Why choose vertical slices over layered folders?
  • A: Vertical slices keep related code together, reduce navigation overhead, and keep changes localized to a feature. Deleting a feature is deleting a folder.
  • Q: How do you implement multi-tenancy in Clean Architecture?
  • A: Create a BaseTenantEntity with TenantId, inject ICurrentTenantService into DbContext, and apply global query filters. Domain layer stays clean; tenant isolation is infrastructure concern.
  • Q: When would you use the Result pattern over exceptions?
  • A: For expected failures (validation, not found, business rules). Exceptions are for unexpected errors. Result pattern makes error handling explicit and easier to test.
  • Q: What is the purpose of domain events?
  • A: Cross-aggregate communication without coupling. When an Order is placed, it raises OrderPlaced event. Other aggregates or services can react without Order knowing about them.
  • Q: How do you test Clean Architecture applications?
  • A: Unit tests for domain logic (no mocks needed). Handler tests with mocked repositories. Integration tests with real database. Functional tests through API endpoints.
  • Q: When would MVVM be a bad fit?
  • A: For simple screens with minimal state; MVVM overhead may outweigh benefits. For complex UI with heavy binding and unit-tested view logic, it pays off quickly.

See also