Architecture Concept
Criteria
Concept, design and implement some architecture
Keyword
- Clean Architecture
- Onion Architecture
- Dependence Injection
SOLID Concepts
Single responsibility principle
A class should only have a single responsibility, that is, only changes to one part of the software’s specification should be able to affect the specification of the class.
Open–closed principle
“Software entities … should be open for extension, but closed for modification.”
Liskov substitution principle
“Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.” See also design by contract.
Interface segregation principle
“Many client-specific interfaces are better than one general-purpose interface.”
Dependency inversion principle
One should “depend upon abstractions, [not] concretions.”
1. Dependence Injection
Criteria
At the Onion Architecture, Jeffrey Palermo describe about Independent in software design: “The Onion Architecture relies heavily on the Dependency Inversion principle. The application core needs implementation of core interfaces, and if those implementing classes reside at the edges of the application, we need some mechanism for injecting that code at runtime so the application can do something useful.”
1.1 Dependency Inversion principle
In object-oriented design, the dependency inversion principle is a specific form of decoupling software modules.
Why?
- At the Clean Architecture of Uncle-Bob, He describle about Independent in software design:
“
That each of these architecture produrce system that are:
- Independent of Frameworks. The architecture does not depend on the existence of some library of feature laden software. This allows you to use such frameworks as tools, rather than having to cram your system into their limited constraints.
-
Testable. The business rules can be tested without the UI, Database, Web Server, or any other external element.
-
Independent of UI. The UI can change easily, without changing the rest of the system. A Web UI could be replaced with a console UI, for example, without changing the business rules.
-
Independent of Database. You can swap out Oracle or SQL Server, for Mongo, BigTable, CouchDB, or something else. Your business rules are not bound to the database.
-
Independent of any external agency. In fact your business rules simply don’t know anything at all about the outside world. “
2. Provider
3. Adapter
4. Observer
Aggregate Model
- Entity, Root Entity
- Value Object
- Enumration
Events
- Domain Event
- Intergration Event
Cross cuting concern
- Business rules
- Caching
- Logging
- Data validation
- Environment variables
- Error detection and correction
- Internationalization and localization, ex language localization
- Security
- Memory management
- Monitotring
- Transaction persistence
- Synchronization
- Dependency injection
###
References
- https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
- https://jeffreypalermo.com/2008/07/the-onion-architecture-part-2/
- https://en.wikipedia.org/wiki/Dependency_inversion_principle