How to name a class whose purpose is to hold related objects?
https://softwareengineering.stackexchange.com/questions/336486
-
01-01-2021 - |
Question
I am working in a wizard in WPF application. As the wizard gathers a lot of information I have designed separate view models for each step (view) in a wizard. But I have to hold all this information in an object to display in a summary screen and push to database when the user reviews the summary and submits.
Example: Say there is a vehicle registration wizard.
class VehicleDetails
{
string Name {get;set;}
int Number {get;set;}
}
class VehicleOwner
{
string Name {get;set;}
string Address {get;set;}
}
Class VehicleFeatures
{
string Color {get;set;}
int EngineCapacity {get;set;}
}
Now as the user fills all this information step by step I have to hold the information in a seperate instance to summarize and submit.
Class Vehicle________ (Master/Container/?)
{
VehicleDetails Details {get;set;}
VehicleOwner Owner {get;set;}
VehicleFeatures Features {get;set;}
}
What is the best way I could name so that the furute 'Reader' of this code could understand my intent ? Is there any standard vocabulary for such scenario ?
Solution
In layman's terms:
- Nobody said class members had to be primitives.
- Class members can be of any type, including user-defined types.
- The fact that some members of the class
Vehicle
are user-defined doesn't makeVehicle
into aVehicleContainer
or aVehicleMaster
- A vehicle container would be a class that containts vehicles, which in this case it is not
VehicleMaster
would be... I don't know what that would be.
Bottom line: the name of the class should be Vehicle
.