afsharm / ServicePlace

4 stars 0 forks source link

Adapt the architecture to clean architecture #1

Open afsharm opened 2 weeks ago

afsharm commented 2 weeks ago

The current architecture/topology has been tried to be clean and testable. However, as there are a lot emphasis on clean architecture nowadays, review the architecture again and make necessary changes. Check the book Clean Architecture by Robert C. Martin.

afsharm commented 2 weeks ago

My understanding of the book is that:

  1. One should focus on main parts of the system (policy) rather details of the system. Subjects such as database, frameworks and web are consider as details.
  2. The book has a great emphasis on abstraction. It says one should build parts of the system independent of details such as database or external service API calls. In other words, the application should be able to change details easily. For example, the core system should be able to use MSSQL or MongoDB or flat files easily.
  3. Options should be able to be decided later as long as much as possible.
  4. SOLID should be applied in all OO based designs.
  5. Each component/class should be dedicated to one purpose.
  6. Components are dedicated to actors (remember use cases)
  7. Components should be independent as much as possible
afsharm commented 1 week ago

One of the important concepts to implement is architectural boundaries:

image

See chapter 17: Boundaries - drawing lines

afsharm commented 1 week ago

I have used integer auto identity field in database level for service id. but it is too dependent on database details in clean architecture point of view. some logic, specially unit tests are based on the functionality. find the correct way of the eyes of the clean architecture to have this id value or use other solutions like GUID primary keys.