B
Brian Munroe
I am having trouble modeling a real world object in Java, hopefully
someone can shed some light. I am fairly new to OOP and Java
programming, so hopefully I haven't munged the concepts and terms up
too bad
I have a document, called an Action Plan, that I am trying to turn in
to an object, ActionPlan.
The real world document contains things like a title, description,
start date, etc - these are trivial to turn into attributes of the
ActionPlan object.
However, one section of the Action Plan, called Plan Conditions, won't
work as a primitive attribute. In the real world, the Plan Conditions
section can contain an arbitrary number of Plan Condition, each of
which has it's own attributes like orderNum, name, description, etc.
Here is an ASCII representation of the above paragraph:
-------------------------------------------
Action Plan
-------------------------------------------
Title: Action Plan Title
Description: Test Case Failures
Author: n/a
Plan Conditions
--------------------------------------
OrNum | Name | Description
--------------------------------------
1 Exp 1 n/a
2 Exp 2 n/a
3 Exp 3 n/a
-------------------------------------------
How should I model this one to many relationship? I am thinking I
should have an attribute of ActionPlan be an array of PlanCondition
objects?
I this the correct thing to do? Thanks.
someone can shed some light. I am fairly new to OOP and Java
programming, so hopefully I haven't munged the concepts and terms up
too bad
I have a document, called an Action Plan, that I am trying to turn in
to an object, ActionPlan.
The real world document contains things like a title, description,
start date, etc - these are trivial to turn into attributes of the
ActionPlan object.
However, one section of the Action Plan, called Plan Conditions, won't
work as a primitive attribute. In the real world, the Plan Conditions
section can contain an arbitrary number of Plan Condition, each of
which has it's own attributes like orderNum, name, description, etc.
Here is an ASCII representation of the above paragraph:
-------------------------------------------
Action Plan
-------------------------------------------
Title: Action Plan Title
Description: Test Case Failures
Author: n/a
Plan Conditions
--------------------------------------
OrNum | Name | Description
--------------------------------------
1 Exp 1 n/a
2 Exp 2 n/a
3 Exp 3 n/a
-------------------------------------------
How should I model this one to many relationship? I am thinking I
should have an attribute of ActionPlan be an array of PlanCondition
objects?
I this the correct thing to do? Thanks.