@Alex Papadimoulis said:
Can you provide a specific example of a class?
Or what problem you're trying to solve? I'm sure there is a specific name/pattern for this ... but I'm not seeing what you're talking about ...
For example....
class CarWash
{
private boolean _wax;
void useWax (boolean wax) {
_wax = wax;
}
void wash (Car car) {
// Washing the car
if (_wax)
// waxing the car!
}
}
instead of:
class CarWash
{
void wash (CarDataStructure ds) {
Car car = ds.getCar ();
// washing the car
boolean wax = ds.shouldWax();
if (wax)
// waxing the car!
}
}