Having a class such as this, with two getters for two instance variables:
class A
{
_fieldA;
_fieldB;
GetA()
GetB()
GetSpecialNumber(int a)
{
//calculation not requiring any fields
}
}
The class will be classified as lacking cohesion completely. However, I believe in some cases such a stateless object is desired and thus cohesion metric should not apply. Or is that a wrong approach/thinking? Truth is, I have never read about low cohesion being good, except for a few cases mentioned at the end of this material: http://www.aivosto.com/project/help/pm-oo-cohesion.html