Skip to content

ribbinpo/architecture-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Architecture Patterns Overview

This repository contains examples and implementations of three popular software architecture patterns. Each pattern has its own directory with a complete implementation to demonstrate its principles and benefits.

1. Clean Architecture

Clean Architecture is a software design philosophy introduced by Robert C. Martin (Uncle Bob). It emphasizes separation of concerns and dependency rules to create maintainable and testable applications.

Key Principles:

  • Independent of frameworks
  • Testable
  • Independent of UI
  • Independent of database
  • Independent of any external agency

Layers (from innermost to outermost):

  • Entities (Enterprise Business Rules)
  • Use Cases (Application Business Rules)
  • Interface Adapters
  • Frameworks & Drivers

2. Hexagonal Architecture (Ports and Adapters)

Hexagonal Architecture, also known as Ports and Adapters, was introduced by Alistair Cockburn. It focuses on creating a core application that is independent of external concerns.

Key Principles:

  • Core business logic is isolated
  • External concerns are handled through ports and adapters
  • Dependencies point inward
  • Business rules are protected from external changes

Components:

  • Core (Domain)
  • Ports (Interfaces)
  • Adapters (Implementations)

3. N-Layered Architecture

N-Layered Architecture is a traditional approach that organizes an application into distinct layers, each with specific responsibilities.

Key Principles:

  • Clear separation of concerns
  • Each layer has specific responsibilities
  • Dependencies flow from top to bottom
  • Layers communicate through well-defined interfaces

Common Layers:

  • Presentation Layer
  • Business Logic Layer
  • Data Access Layer
  • Domain Layer

Getting Started

Each architecture pattern has its own directory with a complete implementation. Navigate to the respective directories to explore the implementations:

  • clean-architecture/ - Clean Architecture implementation
  • hexagonal-architecture/ - Hexagonal Architecture implementation
  • n-layered/ - N-Layered Architecture implementation

Benefits of Each Architecture

Clean Architecture

  • Highly testable
  • Framework independent
  • Easy to maintain
  • Clear separation of concerns

Hexagonal Architecture

  • Domain-centric
  • Flexible and adaptable
  • Easy to test
  • Technology agnostic

N-Layered Architecture

  • Simple to understand
  • Clear responsibilities
  • Easy to implement
  • Good for smaller applications

When to Use Each Architecture

Clean Architecture

  • Large, complex applications
  • Long-lived projects
  • When framework independence is crucial
  • When testability is a priority

Hexagonal Architecture

  • Domain-driven applications
  • When external systems need to be easily swapped
  • Microservices
  • When core business logic needs to be protected

N-Layered Architecture

  • Smaller applications
  • When simplicity is preferred
  • Traditional business applications
  • When quick development is needed

Contributing

Feel free to contribute to any of these architecture implementations by submitting pull requests or creating issues for improvements.

License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published