I have a software-DB architecture/design problem related to a blog application. Suppose I want to provide the user with the feature of adding sections in a page. Each page section can have many components which vary, depending on standard practices in web development.
For example:
- A section with a paragraph and an image OR two such components OR
- A section with four images or one Gallery OR two Galleries
- A section with two paragraphs OR
- A section with video and paragraph etc
One approach I can take is to build each type of component type, its MVC components, and use it when ever I need. But I am feeling from a design perspective if I have 1000 such components, I will have 1000 tables in active record. That's not efficient.
I am feeling the need of dynamic attributes generation OR using same table to store different types of components and just dynamically changing the view depending on a type attribute OR a factory pattern implementation(which I feel is a good candidate here).
I will really appreciate if you can help me out with this design or suggest some other ways of handling dynamic components generation.
Aucun commentaire:
Enregistrer un commentaire