This is a design-based question. I'm not at liberty to discuss the actual case I'm dealing with, but the example I provide is representative to the actual problem.
Background
Let's say we are creating books that have different endings based how somebody progresses through the book. For simplicity, our system generates a complete story without any choices for the actual User to choose, in effect creating a normal book. From the end-user's point of view, the book has no choices.
When we want to generate a book for the user to read, a book with choices is "rendered" by the system by navigating through the choices in the book and randomly selecting one of the choices at each branch. We want to store this rendered version for the user to go back to in the future, if they so choose.
The Problem
My current solution is to create two, parallel hierarchies, one for the original version and one for the rendered version. This allows us to keep the original version, the one that can be rendered again for another user (or the same user if they want to see a different version), and keep a record of the versions generated for a specific user.
While this solution seems appropriate considering the circumstances, I'm wondering if there is a better solution or design pattern that may apply here. The parallel hierarchies introduce coupling that seems unavoidable, but I would be interested in hearing other perspectives.
I think I covered the basics of my scenario, if you need any more specifics, just ask.
RenderedBook
may contain the title and version/edition whileRenderedChapterBook
could contain the chosen chapters. From those 2 classes I could generate the textbook. Alternatively, I could just duplicate the information fromBook
andChapterBook
.