I am facing a design problem that I cannot figure out at all. I have a table in my DB called Timed_Tests. Timed_Tests has an associated model called Timed_Test.
Recently, I realized that I actually need three types of Timed_Test with slightly different features. There is current Timed_Test, there will be a Test_Basic without the end date that Timed_Test has, and there will be a Special_Test with a couple of additional attributes.
I’m trying to figure out what the best way is to set this up. Should I have one large Tests table with all the different types of attributes for all the different types of Tests? How should I setup my class inheritance structure? Should I use citier (http://peterhamilton.github.com/citier/)? How do mixins fit in with DB schema…?
I have asked a bunch of questions and they are a bit vague I know – please feel free to ask me clarifying questions, and feel free to answer any one of the issues I’m thinking about above.
Thanks so much!
If the specific attributes for the SpecialTest instances are not many, you can safely go with single table inheritance. This way you are free to specialize the behavior of your classes in any desired way, retaining simplicity of the mapping.
Using mixins (so not having table inheritance in any way) will prevent you to retrieve test instances across the classes.