Should the domain layer in the 3-tier application architecture wrap the data-level classes needed for the user interface layer?

Assuming a “standard” three-tier application (UI - Domain - Data), should the Domain Layeruser interface classes originally defined in Data Layer?

I mean, assuming there is a class Productdefined in Data Layer, is it wrong to force some method from my method to Domain Layerreturn it (this makes them visible to the user interface)? Or should I define in Domain Layersome class itself that wraps Productfrom Data Layer, so the user interface is now independent of Data Layer?

thank

+3
source share
6 answers

Such an implementation associates user interface classes with data classes that are usually harmful. The best practice in every known scenario is to keep them separate. This will not only separate them from each other, but also give you the freedom to embed user logic (at any time in the future) between user interface classes and data classes. It also gives you the freedom to make settings for the data object without directly affecting the user interface classes.

+2
source

Product ProductImpl. ( ).

+6

. , MVVM (Model-View-ViewModel), .

0

, .

, 90% , , .

, .., . , , .

, , , .

0

, , , , . , , , , . , .

, , , , , . , Andreas_D , , , , , , . Data Layer.

0

? ? 3 ? - , 3- , UI/BL/DB - .

(= + ), , (DTO). DTO .

/ Product domain , WSDL, Product domain - , .

, DTO, / .

0

Source: https://habr.com/ru/post/1760244/


All Articles