PxFAQ – Why are CRUD operations generaly located in Set Business Logical Machines? (posted by Fabien Villard)

Related questions:

  • Why separate Elementary and Set machines/operations?
  • Would it be interesting to add a CRUD Business Logical Machine next to the Elementary and Set ones?

It is clear that we are considering things in the Logical Aspect and that no justifications will come from Technical Aspect.

First shot

CRUD operations are not high level operations. They are instead mandatory to conduct higher level operations related to real world ones. We do not create objects for no reasons. The operation is triggered by an intention from the user. For example the creation of a Contact object in a PIM is the consequence of the intention to store the data and comments for a new person we have met in a certain context. Hence CRUD operations are not of a sufficient abstraction level to be considered business operations and this explains why they are usually not located in elementary machines.

Business operations on an object reflect the transformations the object can support according to the rules reflecting its behavior in the real world. But CRUD operations do not reflect a transformation, either because the object initially does not exist or finally does not exist anymore, or because reading does not change the object itself.

So, CRUD operations do not change the object itself but they do change the collection of objects. They have a transformation action on the set of all existing objects. This action may include changes in some
aggregated information like global amounts or statistical data or, simpler, the number of such objects, and even the state of the collection: “we have reached a threshold on the number of clients”. These data relate to the collection, not to individual objects. Hence CRUD are Set operations and pertain to the Set Business Logical Machine, and there is no need to increase the complexity by adding a new machine.

Fine tune

UPDATE is a special case : it is intended to change something in the object even if it is not a real transformation. By placing it in the Set machine we create a lot of connexions between the two machines because a lot of the UPDATE operation uses will come from the Elementary machine and its high level operations. So it seems appropriate to place the UPDATE operation in the Elementary machine.

Last, DELETE may be seen as the ultimate operation an object uses to commit suicide, or as a euthanasia request. The former vision places the DELETE operation in the Elementary machine, the later in the Set one. Placed in the Elementary machine, the DELETE operation MUST inform the Set machine of the change in the collection to trigger new calculations on the set.

Leave a Reply


Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 957,358 bad guys.