Ok, so here's the situation:
I have a Vehicle class. This vehicle has a few properties like chassis, drive type, etc.
Here's how I'd like to model the classes:
Vehicle class
- Chassis Class (ID, Description)
- Drive Type Class (ID, Description)
Basically, I want to use composition of objects: a Vehicle object has a Chassis and Drive Type object within it. Here's how my co-workers would like to see it:
Vehicle class
- ChassisID (integer)
- DriveTypeID (integer)
So just holding the identifiers as integers within the vehicle class.
I was taught in school that you should always favour composition, and that objects that are associated with other entities should reference those entities objects, not their ID.
What are your thoughts? Am I being too granular with this?!
Thanks,
D'Arcy
I have a Vehicle class. This vehicle has a few properties like chassis, drive type, etc.
Here's how I'd like to model the classes:
Vehicle class
- Chassis Class (ID, Description)
- Drive Type Class (ID, Description)
Basically, I want to use composition of objects: a Vehicle object has a Chassis and Drive Type object within it. Here's how my co-workers would like to see it:
Vehicle class
- ChassisID (integer)
- DriveTypeID (integer)
So just holding the identifiers as integers within the vehicle class.
I was taught in school that you should always favour composition, and that objects that are associated with other entities should reference those entities objects, not their ID.
What are your thoughts? Am I being too granular with this?!
Thanks,
D'Arcy