3 ms·
Fivelessminutes's dismissal is indeed shallow, but then again, the rule being dismissed looks like shallow dogma (though we are not seeing it in context.) Enum
by mannykannot 5y ago
Fivelessminutes's dismissal is indeed shallow, but then again, the rule being dismissed looks like shallow dogma (though we are not seeing it in context.)
Enums are essentially categorical variables, and there is nothing wrong with that: they are widely used in statistics and other real-world applications (arguably, even, booleans are a case of such.)
As a junior programmer, I was once assigned to work on an example of what could happen as a result of following this advice: an explosion of subclasses for the sake of avoiding a few conditional clauses. Algorithms had been broken up so that the common parts could be put in base classes, and you had to jump all around the code to see what was going on. Worse, objects could change their categorization during their lifetime, which required the substitution of a new object for the previous one. This complexity was contagious; once this one type was implemented in this manner, a lot of other things had to follow suit.
This was one of the experiences that turned me into a skeptic with regard to the proposition that there's no problem that cannot be simply solved by being more object-oriented.