I am looking into designing a system where users build a template item and then create many instances based on this template.They then need to be able customise each instance but I also need for them to be able to make changes to the template and have all instances updated. These items are fairly complex, each consisting of many components that will be stored in numerous database tables.
I see two implementation paths.
- Store complete copies of the templates to create the instances and migrate updates to the instances.
- Store records only for the changes and build each instance from a combination of the template and instance changes.
I believe the first option would create a lot of unneeded extra data however the 2nd way introduces complexities in querying the data.
This seems like it has probably been implemented many times before but I am having trouble finding much reading material. Are there common names for data models or pattern options used in implementations of such systems?
Any advice on benefits or pitfalls of each option, other options, or implementation guidance would be useful too.
Sorry I may not have been clear. I was looking more for a name for the general architecture not a design pattern. It is the end users who create instances not developers.
For example the system might allow users to define templates to model manufacturing processes of many items. Then at different sites where facilities or requirements are different, the end user would would use one of these templates to define a process specific for that site. Things will be added, removed and modified for each site.
I believe I will go with option two mentioned above - storing only delta changes, not complete copies.