I have several times to try to explain to the developer why they should change a class that has multiple instances
switch(m_type) {
case TYPE_A:
...
break;
case TYPE_A:
...
break
...
}
Where m_type is a (final) reference to an enum specifying the type of instance.
Whenever I see this, I think it's time to split the class into several subclasses, where the particular class you create determines the type. The argument I always return is this: "It seems you should not create all these classes with hardly any code, what will they do there? Like 2 methods or something!"
, , , . , , .., . , , . , , , , , , , .
, , , - , ?
,