Domain-Centric Design - nTier

From Logic Wiki
Jump to: navigation, search


Definition

  • The problem-space of your application is its domain
  • The objects you design to model the domain are domain objects
    • Also referred to as model objects of the model
  • Domain objects
    • Encapsulate application business logic and rules
    • Maintain any state required to do so
    • Do not depend on external infrastructure concerns

Dependency Inversion Principle (DIP)

High-level modules should not depend on low level modules. Both should depend on abstractions

Abstractions should not depend on details. Details should depend on abstractions.

Refactoring Goal: Onion Architecture

File:HexagonalArchitecture.jpg

Simply

File:Onion.png

Onion Architecture Principles

  • All code depends on layers closer to center
  • Domain model ad center
  • Inner layers define interfaces; outer layers implement these interfaces
  • Layered behaviour around the domain model
  • Infrastructure and I concerns pushed to edge
    • Depend on Application Core, not vice versa

Folder / Project Structure

  • ProjectName.Core (Not referencing any other projects)
  • ProjectName.Infrastructure (Ref : Core)
  • Project.Website (Ref : Core, Infrustructure)
  • Project.DAL
  • Project.BLL