Joe Soltzberg

28%
Flag icon
// Tagged class - vastly inferior to a class hierarchy! class Figure {     enum Shape { RECTANGLE, CIRCLE };
Joe Soltzberg
This is kind of conflicting with the classic Java Planet Enum example. A good mechanism for deciding whether to do an enum or use inheritance: 1. Does the list of values change? (planets don't change for example) 2. Are there too many arguments? (just 2 for planets, but maybe many more for other examples)
Effective Java
Rate this book
Clear rating
Open Preview