Checking the level of service in comparison with checking the domain object; potential “abuse” of domain items?

I saw many examples of books and articles talking about putting a verification code at your service level. Keep the domain objects "dumb" (aka, pure POCOs) and handle all the checks that the domain object can perform at the service level.

The service level is responsible for what it seems (or at least it can be); user authentication, role authentication, IoC script dependency objects (registrars, error handlers, etc.), domain object scripts, script stores, and transferring domain objects to and from the repository ... whew!

Does all these service-level rules pose a significant threat to your domain objects? For example, what happens when a programmer decides to write a consumption code directly against your domain objects and simply bypasses the service level in general? That would be bad, but it would be a believable situation.

If you are going to impose a lot of responsibilities at the service level, including the entire verification of a domain object, is there a way to "protect" your domain objects, is someone trying to directly link them to a script? For example, perhaps, somehow, your domain objects are no longer used by a specific client (in this case, the level of service?).

A good design makes me think that domain objects should not know anything about who names them and how they are called.

"" , , .. , ? , , , , , BAL/DAL.

- "" , ?

+3
2

. .

: , .

:

1) (.. ), , getters. , , , ( , Java)
2) , , Person, PersonInfo, , , .
3) API . .

+1

, POCO. POCO, , . POCO . .

+2

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


All Articles