design sanity check/advice



I'm relatively new to "real" object-oriented design/development (i.e.
patterns/refactoring etc.) although I've been working with OOP
languages for quite some time. I've been doing a lot of
reading/research in order to take it to the next level and am
incorporating it into a new project I'm working.

The app is a survey engine developed using Java/Spring/Hibernate.
Surveys contain pages which contain questions (different variations of
multiple choice and essay-type). Surveys exist in 3 distinct phases:
survey design, survey response entry and survey analysis/reporting.
I've started out with a domain model which represents just the design
phase of a survey lifecycle. The classes contain just the information
which needs to be persisted to define the structure/layout of the
components.

e.g.:

public class SurveyDefinition {

private Long id;
private String title;
private String description;
private List pages = new ArrayList();

public abstract class QuestionDefinition {
private Long id;
private Integer questionNumber;
private String prompt;
private boolean answerRequired;
private PageDefinition page;
..
..
..

}

public abstract class MultipleChoiceQuestionDef extends
QuestionDefinition {

private boolean singleAnswer;
private List choices = new ArrayList();
..
..
..

}

This initial design was really just created to get my feet wet with
Hibernate to make sure that I could get all of the ORM
inheritance/polymorphism/association mechanisms working. I have kind
of a vague idea of where I want to take this but I want to make sure
that I'm not too far off base before I get too far into the design.

Does it make sense to have the survey design phase entities (e.g.
SurveyDefinition, PageDefinition, QuestionDefinition etc.) as separate
classes distinct from the survey response entry phase entities (e.g.
Survey, Page, Question etc.)? I'm thinking that the survey response
entry phase entities really are different animals with richer behavior
and that these could be created by passing the definition entities
into a factory/creation class/method.

Are there any (other) strategies/patterns etc. that I might want to
pursue?

Any suggestions/advice/admonitions/coaching/counseling/encouragement
and/or hot stock tips would be greatly appreciated.

Thanks,
Gary

.



Relevant Pages