Don't Write Tagged Class
What’s worse than a class hierarchy? Tagged class.
// Don't do this!
public class Figure {
enum Shape { RECTANGLE, CIRCLE };
final Shape shape;
...
}
What’s worse than a class hierarchy? Tagged class.
// Don't do this!
public class Figure {
enum Shape { RECTANGLE, CIRCLE };
final Shape shape;
...
}