Is there a design principle relating to this? Here's the two approaches I'm currently aware of:
Approach 1:
Expose 'higher level', 'processed' information which consumers can readily use.
abstract class Vehicle
{
bool IsMoving();
}
The downside of this seems to be that you have a single information source that will probably end up servicing a disparate array of consumers who all probably require a slightly different take on what 'is moving' means.
For example, one consumer might consider 'moving' to be anything other than a speed of zero (let's ignore floating-point issues!) - while another consumer considers 'moving' to be speeds in excess of 1 m/s.
Approach 2:
Expose 'raw' data which consumers can use to make their own decisions about, and then use.
abstract class Vehicle
{
double GetSpeed();
}
The downside here is that you may (read: will) end up with a lot of duplicate code (because many consumers may have the same definition of what 'moving' is). The solution, I'd imagine, is to have a separate (adapter?) layer where these types of decisions/processing happen - but I'd like to read up on this properly.
I'm trying to avoid asking a subjective, discussion style question, so I'm not asking which is better - I would like to know if there's some theory about this subject which I can go read up on. Thanks!