I have a database-like object that looks like:
static class Data
{
private Dictionary<String,Car> cars;
}
class Car
{
private string name;
private Dictionary<String,Part> parts;
}
class Part
{
private string name;
private double paramA;
private int paramB;
private string paramC;
}
I use this database in a multi-core program, so i only read from it. Currently, reading is implemented thusly: in Data I have:
public double get_paramA(string car,string part)
{
return cars[car].get_paramA(part);
}
and in Car I have:
public double get_paramA(string part)
{
return Part[part].get_paramA();
}
This works, but i am worried about the future if there is a need to add more params to Part: in the current scheme it adds 3 functions to three objects.
How should i change the reading-scheme to make the code more readable/maintainable?
Sorry if this is a standard question, i have no idea what to search for to find an answer.
Aucun commentaire:
Enregistrer un commentaire