What parts of a project are part of the infrastructure layer?

Asked

Viewed 267 times

-1

My goal is to know if the classes related to the topics below fit into this infrastructure category to separate them into layers within a project. Follow the topics:

  • Database
  • Log
  • Dependency injection container (and other configurations)
  • Routes (controllers and etc)
  • Login

Which of these parts of a project are considered infrastructure? I would also like more examples about parts of a project that are infrastructure. Separating the project into namespaces like Infrastructure, for example.

1 answer

0


If you apply to layered architecture (Layered Architecture) in its application, then the infrastructure is one of the logical layers (in the sense of non-physical), called infrastructure layer (Infrastructure layer).

It does not refer to the infrastructure that supports the application as a whole (in the sense of server, database, etc.), rather it is a way to achieve separation of responsibilities in the code involved in its application.

In other words, the database itself does not belong to the infrastructure layer (it is not even part of the application), but the code that makes access to the database belongs.

The code that accesses the database (a DAO or Repository for example) is considered part of the infrastructure layer, as well as the code that writes to a file or sends to a server, the code that writes/reads data in files in general (for example, configuration files), the code that records messages in a message queue service (message), etc..

They are all considered "support" codes for the application and access to external resources (hardware), do not refer to the user interface, business rules (domain layer) or application rules (application layer).

Services available for domain layer code.

Among the topics you mentioned, I have cited database and log, I can not say about the dependency injection container, that until today I do not know the technology. MVC controllers are user interface layer, already back-end controllers and routes so I suspect they are application layer.

Login is a use case that goes through all layers, from user interface through application layer, domain layer and accessing the database via infrastructure layer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.