Let's say I have a class like:
class NavigationData
{
float roll;
float pitch;
double latitude;
double longitude;
}
and if I want to create a method:
const bool validate() const;
which basically validates whether the 4 fields contain valid values.
Should validate() be part of NavigationData class, or should I create something like a NavigationDataValidator, that contains a validate(const NavigationData&) method.
I'm just giving a simple example, obviously my real class is a lot more complicated than this. I'm looking for good OO principles.
Put it another way: given a method, how do we know if it should belong to the class, or should belong to a separate class?