jeudi 17 septembre 2015

Different interpretation of internal state based on what client wants

A Model object which has some private internal state. A component of this state is exposed to the clients. But one of the clients wants a different component of the internal state to be exposed. How should this be dealt with?An example

public GarageModel{
private Vehicle car;
private Vehicle truck;

public Vehicle getMostInterestingVehicle(){
    //exposes car as the most interesting vehicle but
    //one of the client wants this to return a truck
    return car;
}
}

Aucun commentaire:

Enregistrer un commentaire