I'm wondering about a good way to deal with a Question/Answer - Model for multiple Users. My goal is to have an efficient and readable model where all the results of my users are stored. Every user has the same questions/answers!
At the moment I have three classes, Question
,Answer
and User
.
A user
has a Set of Questions
.
A question
has a Set of Answers
and an extra field selected_value
which is the answer the user clicked.
Every user has a copy of the same set of questions. Therefore I can easily see what a user has clicked.
This is an unnecessary overload because I need to store the questions/answers more than once.
But the good thing about this approach is the availability of my questions/answers in my user-model as I need to see what every user clicked. It's also easy to extract this information (e.g. via xml) doing just a loop around every user and his questions.
But what kind of approach would you recommend to use? Should I create a model "result" inside of my User-Model where I simply store a list of pairs like "QuestionId, AnswerId"? Is there any more accepted way to do so?
User-Model
- are you using an ORM? Which one?