mercredi 2 novembre 2016

Duplicate master data set into multiple clones with special inheritance rules

The problem starts with having a master set of data on which CRUD operations are applied and sent to clients.

  1. From the master data set, a client might want the entire data set.
  2. From the master data set, a client might want only X data piece.[X being an identifier].
  3. From the master data set, a client might not want X data piece and want Y data piece.

Extra info: A 'not want' operation might be turned to 'want all except' operation, but not desirable. If 'i want x' represents a small piece of data, this will lead to a lot of rules of type 'i want y1, y2, y3' etc. On the master feed, we apply CRUD operations, so each 'create' on master, will mean a create for every N clients.

Until now, i thought at:

  1. Creating a domain which contains some rules. Client inherits X, Client does not inherits Y, Client inherits X but not Y, etc. This is doable in our system, but not recommended as we are dealing with some indexes based on ids of type long, which cannot be modified into a special key without damaging clients. Based on this rules, when we deal with CRUD operations, we check those rules and take a decision if we need to pass the info to the client or not.

  2. Having Entity in the master data set, for the sake of example ignore the naming, create a new Entity2(which has reference to the master Entity) and has less properties that Entity(only those modified), thus, saving memory but increasing the no of entities in our system. I think this is kind of similar with Liskov principle, same type, but can be replaced with a subtype- wild reference, but kind of close to the idea.

Having these said, have you ever encountered such an example? Do you have any advice?

Thanks,

Aucun commentaire:

Enregistrer un commentaire