Jump to content

OOP, DDD, AOP and EDP: Difference between revisions

From Knowledge Base
Created page with " == Paradigms == Paradigms are high-level guidelines and the most abstract, followed by principles, patterns, idioms and code smells. There are also mixins, which always apply to one certain programming language. <mermaid> graph TD; subgraph Abstraction Level Paradigms[Paradigms] Principles[Principles] Patterns[Patterns] CodeSmells[Code Smells] Mixins[Mixins] end Paradigms --> Principles Principles --> Patterns Patterns --> CodeSmells C..."
 
No edit summary
Line 78: Line 78:
</mermaid>
</mermaid>


[[File:CompanyApp.png|thumb]]
[[File:CompanyApp.png|frameless|center]]

Revision as of 21:26, 16 January 2025

Paradigms

Paradigms are high-level guidelines and the most abstract, followed by principles, patterns, idioms and code smells. There are also mixins, which always apply to one certain programming language.

<mermaid> graph TD;

 subgraph Abstraction Level
   Paradigms[Paradigms]
   Principles[Principles]
   Patterns[Patterns]
   CodeSmells[Code Smells]
   Mixins[Mixins]
 end  
 Paradigms --> Principles
 Principles --> Patterns
 Patterns --> CodeSmells
 CodeSmells --> Mixins

</mermaid>

OOP, DDD, AOP, EDP

These paradigms collectively shape modern design and implementation, each with its own unique role to play.


Object-Oriented Programming (OOP)

[OOP](https://en.wikipedia.org/wiki/Object-oriented_programming) is a programming paradigm that focuses on modeling software using objects, which are instances of classes. Objects encapsulate data and behavior together. It emphasizes principles like [encapsulation](https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)), [inheritance](https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)) and [polymorphism](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)) to organize code and improve maintainability. OOP is a foundational concept in software development and can be applied in various domains.

<mermaid> classDiagram

 class Object {
   data
   behavior
 }
 Object --|> Class
 Class --|> Object

</mermaid>

Domain-Driven Design (DDD)

[DDD](https://en.wikipedia.org/wiki/Domain-driven_design) is a design methodology and set of principles that guide the design of complex systems, particularly those with rich domain models. [DDD](https://en.wikipedia.org/wiki/Domain-driven_design) emphasizes understanding the problem domain, modeling it with domain objects and using [object-oriented techniques](https://en.wikipedia.org/wiki/Object-oriented_programming) to represent domain concepts. It promotes the use of [aggregates](https://martinfowler.com/bliki/DDD_Aggregate.html), [entities](https://blog.jannikwempe.com/domain-driven-design-entities-value-objects) and [value objects](https://martinfowler.com/bliki/ValueObject.html) to capture the domain's intricacies and relationships. While OOP provides the technical foundation, DDD provides a strategic approach to using OOP effectively in the context of a specific domain.

<mermaid> classDiagram

 class DomainObject {
   data
   behavior
 }
 DomainObject --|> Aggregate
 Aggregate --|> DomainObject

</mermaid>

DDD is not precisely a paradigm, principle, or pattern in the traditional sense. Instead, DDD is an approach or methodology for designing and developing complex software systems.

Aspect-Oriented Design (AOP)

[AOP](https://en.wikipedia.org/wiki/Aspect-oriented_programming) is a design paradigm that complements [OOP](https://en.wikipedia.org/wiki/Object-oriented_programming). It focuses on modularizing cross-cutting concerns or aspects in software, such as logging, security and transaction management. [AOP](https://en.wikipedia.org/wiki/Aspect-oriented_programming) separates these concerns from the core business logic and allows them to be applied consistently across the application. It does this by introducing constructs like aspects, pointcuts and advice to address concerns that often "cut across" the main code structure. AOP can be used alongside OOP to improve the maintainability and comprehensibility of complex software systems.

<mermaid> sequenceDiagram

 participant Application
 participant Aspect
 Application ->> Aspect: Call Business Logic
 Aspect ->> Application: Apply Concerns

</mermaid>

Event-Driven Architecture (EDA)

[EDA](https://en.wikipedia.org/wiki/Event-driven_architecture) is an architectural and design approach where software components communicate by producing and reacting to events. In an event-driven system, components (often objects) are designed to respond to events asynchronously, making systems more scalable, decoupled and responsive. Event-Driven Architecture can be employed within OOP and DDD to model interactions between components, such as aggregates responding to domain events. It is especially relevant in systems where real-time or asynchronous communication is critical, like in distributed systems, microservices and user interfaces.


<mermaid> stateDiagram-v2

   [*] --> Active: System Startup
   state Active {
       [*] --> EventReceived: Event Triggered
       EventReceived --> ProcessEvent: Handle Event
       ProcessEvent --> [*]: Event Handling Complete
   }

</mermaid>