Pergunta

I have been reading up on the Onion Architecture and today I found out about Uncle Bob's Clean Architecture.

For the life of me I cannot see any differences between them, they look identical (other than the naming convention).

Is there any differences between the two architectural styles? If yes, can you explain it to me please?

Cheers

Foi útil?

Solução

The term "Clean Architecture" is just the name of the article. The onion architecture is a specific application of the concepts explained in the article.

Outras dicas

There are architectures like clean, hexagonal and onion with the same objectives and some differences in their implementation.

  1. 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.
  2. 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.
  3. 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.
  4. Independent of any external agency. In fact your business rules simply don’t know anything at all about the outside world.

In all architectures the goal is allows the most stable things are not dependent on less stable things will change more frequently.

The layer more important and more stable is domain.

This is the more important over these architectures, then if for onion the object for coordinate from user interface input to infrastructure, domain etc.. is a application service or if in clean architecture is a interactor are small details.

They do look alike and are used to achieve the same objectives which are mainly testability and separation of concerns, but you should notice that the Uncle Bob's Clean Architecture is more Use Case centric.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top