Tuesday, December 25, 2018

Design Patterns for structuring the Business Logic


Design Patterns for structuring the Business Logic in the Business Layer in the Classic 3 tier architecture by Martin Fowler are

1.    Transaction Script
2.    Table Module
3.    Domain Layer or Onion Arch, separate Domain Model
4.    CQRS, extension of Onion Arch for Command and Queries
5.    Event Sourcing

But in Onion Architecture we break Business Layer into two layers.
Application Layer
Domain Layer

But in Onion Architecture we break Business Logic into two types.
Application Logic
Domain Logic

Are these Patterns should also be refactored????
I think not, because these patterns do not discuss the Application Logic. Application Logic Orchestration was kind of ignored in those patterns or in the book.

These patterns are implemented exactly to the Execute Methods of the Command Application Services.

Domain Logic Pattern è Execute Methods for Command Application Services

Orchestration Logic or Use Case Logic, previously scattered in Controllers and Business objects, is now housed inside the Application Services.

Orchestration or calling the different CCCs services like
Authentication, Authorization, Exception Management, Logging & Instrumentation, Audit Trail. Auto Mapping, Object Mapper, Background Jobs, Email Sending, Messaging & Queue, calling the Domain Objects in the Domain Model is the responsibility of Application Layer.

No comments:

Post a Comment