design patterns - Why should I isolate my domain entities from my presentation layer? -
A part of a domain-based design that does not contain much detail, is that how you and your interface Domain model should be separated I am trying to convince my colleagues that this is a good practice, but I do not seem to have much progress ...
They use domain entities, Where they make fun in the presentation and interface layers anytime. When I argue them that they should use the display model or DTO to separate the domain layer from the interface level, they respond to the counter that they do not see the value of the business in doing something like that, because now You have a UI object to maintain as well as the original domain object
so I'm looking for some concrete reasons with which I can use it The front. Specifically:
- Why should not we use the domain object in our presentation layer?
(If the answer is clear, 'decoding', then please explain why this is important in this context) - Do we use additional objects or constructions to separate our domain objects from the interface should do?
Very simple, the reason for implementation and flow is yes, your presentation layer is used for your business items Need to know about them so that they can be displayed properly. Yes, initially it seems that there is a lot of overlap between the two types of objects. The problem is that as time passes, things on both sides are added, changes in presentation, and presentation level needs include those things. Are developed to do that are completely free from your business layer (color, for example). In the meantime, your domain objects change over time, and if you do not have proper decugging from your interface, then you can risk the risk of spoiling your interface layer by appropriately benign changes in your business object.
Personally, I believe the best way to approach things is through a strictly implemented interface pattern; That is, your business object layer exposes an interface which is the only way it can be transmitted; No implementation details (i.e. domain objects) about the interface are not revealed. Yes, this means that you have to implement your domain object in two places; In your interface layer and your bow layer but it can help improve decoding while improving it, while starting it may seem like extra work, decoupling will save tons of work at some point in the future.
Comments
Post a Comment