Brian

41%
Flag icon
enum PayrollDay {     MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,     SATURDAY(PayType.WEEKEND), SUNDAY(PayType.WEEKEND);
Brian
Seems like would’ve been more instructive example not to provide a default constructor and force Strategy selection as indicated in the text. But this is clever and readable and I like it.
Robert
· Flag
Robert
Right. And more than instructive, it'd also be clearer (to a future person figuring out the code) and less error prone (forces a developer to make a decision what a new day type — e.g., Holiday — shou…
Effective Java
Rate this book
Clear rating
Open Preview