S
Sean Chambers
Hello,
I feel that there is a cleaner way to accomplish what I am trying to
do.
I have 4 different types of classes:
-Request
--Step
---QuestionSet
----Question
That is the hierarchy chain, one request has multiple steps, one step
has multiple questionsets and one questionset has multiple questions
At the moment, I am creating each collection of objects from its
parents ctor. This just feels sloppy and is becoming very hard to read.
I feel like I can use a pattern here. I was thinking an abstract
factory but I guess I just can't see how it would be used here.
Depending on certain variables in Request will determine which Step
objects to build, and which questionSets to add to the steps. A
QuestionSet will always load all of it's questions, but every other
object will have conditional building.
Can anyone point me in the right direction? Like I said, It works as it
is now, but I am trying to refactor to be more elegant because I don't
like my current solution.
Thanks
Sean
I feel that there is a cleaner way to accomplish what I am trying to
do.
I have 4 different types of classes:
-Request
--Step
---QuestionSet
----Question
That is the hierarchy chain, one request has multiple steps, one step
has multiple questionsets and one questionset has multiple questions
At the moment, I am creating each collection of objects from its
parents ctor. This just feels sloppy and is becoming very hard to read.
I feel like I can use a pattern here. I was thinking an abstract
factory but I guess I just can't see how it would be used here.
Depending on certain variables in Request will determine which Step
objects to build, and which questionSets to add to the steps. A
QuestionSet will always load all of it's questions, but every other
object will have conditional building.
Can anyone point me in the right direction? Like I said, It works as it
is now, but I am trying to refactor to be more elegant because I don't
like my current solution.
Thanks
Sean