Is it generally considered good practise for a class
name to reflect the namespace
name it exists under, or should the namespace
name implicitly be considered part of the class
name?
For example, suppose I have a collection of classes which all act to filter a class Foo
:
class FooFilter
{
public virtual bool operator()(const Foo& obj) const = 0;
};
Subtypes could be called HappyFooFilter
, SadFooFilter
, ... etc.
Now if we wrap these into a namespace, we have something like:
namespace fooFilter
{
class FooFilter ...
class HappyFooFilter ....
class SadFooFilter ...
etc ....
}
But this contains a redundancy in the class names (e.g. fooFilter::HappFooFilter
). So with the introduction of the namespace fooFilter
, should the class names change to reflect this new structure?
namespace fooFilter
{
class Base ...
class Happy ....
class Sad ...
etc ....
}
namespace
rules that may affect answers.