Contents
What is the domain layer responsible for?
The domain layer hosts the entire business logic that is not specific to one or more use-cases. In other words, the domain layer contains all business logic that remains once you have compiled the application layer. The domain layer consists of a model (known as the domain model) and possibly a family of services.
What is domain layer in Android?
The Domain layer interacts with the Data and Feature (presentation) layer using interfaces and interactors. It is also completely independent and can be tested regardless of external components. Each domain layer has a unique use case, repository and business model.
What goes in the domain layer?
The domain layer is a collection of entity objects and related business logic that is designed to represent the enterprise business model. The major scope of this layer is to create a standardized and federated set of objects, that could be potentially reused within different projects.
How are domain objects used in layered architecture?
Note that the parameters to the method (username and orderId) are value objects. That’s because the layer above (the User Interface layer) does not have domain objects – all it has are some values sent by the client. Looking inside the method you will find that the value objects are used to fetch the real Orderand call its pendingCancelmethod.
What’s the difference between application layer and domain layer?
The domain layer models the business of your application. This should be your clear interpretation of it’s rules, it’s component dynamics and contains it’s state at any given moment. The application layer is “worried about” defining the jobs needed to be done to accomplish a certain application task.
What makes a domain layer an isolation layer?
Domain Layer should be designed as an isolation layer, which means the business logic and rules should not be affected with any codes (in Application Layer, Presentation Layer and Infrastructure Layer) changes.
When does the domain layer come into play?
As @lonelybug pointed out, the domain layer should be completely isolated from the rest of the system. However, something has to translate UI-specific values (query strings, POST data, session, etc.) into domain objects. This is where the application layer comes into play.