Demeter's Law Against REST

Demeter’s law (there really should be a Demeter’s proposal) says that you don’t have to "get" to the object in order to get to their child objects. If you, as a client, have to perform some non-trivial operation, most of the time when the domain model you are working with must support this operation.

REST is basically a mute hierarchy of objects. This is similar to a resource / object file system where each object can have child objects. You almost always achieve REST. You can arbitrarily create mixed types of composite objects using REST methods, and while the provider and the client agree to higher-level operations, you can avoid end-to-end access.

So how do you balance REST and Demeter? It seems to me that they do not conflict, because REST is all about an ultramodern connection with the fact that the provider does not make sense to try to anticipate all the needs of customers, while Demeter assumes that the logic can migrate to its most natural place through refactoring.

However, you can claim that REST is just a stop loss until you understand your customers better. Is REST just a hack? Is Demeter unrealistic in any server / client scenario?

+5
source share
4 answers
  • Is Demeter unrealistic in any server / client scenario?

, . REST SOAP XML-RPC ?

REST , :

  • , .
  • , GET , PUT , POST , DELETE
  • ,
  • .

, REST , REST .

+5

/. , .

+2

, , RESTful, - REST. , REST . , URL- URL-.

. - a.b.c a.bc

RESTful :

<a>
  <link href="bc"/>
</a>

GET a

    <a>
      <link href="b"/>
    </a>

GET b

    <b>
      <link href="c"/>
    </b>

GET c

altCognito , REST . , HATEOAS .

:

REST - - , .

, REST , . . , , . , ", GET, PUT, POST, DELETE , ".

+2

, . REST , URI : GET, POST .. REST URI, "", .

+1

All Articles