Java enums + template method design pattern

Let’s consider the following code snippets: [crayon-600bfbfb43ddc476717352/]   [crayon-600bfbfb43de4583995442/] How often do we see much the same scenario? It is not completely wrong since there is a try to use enums so it is not entirely “string driven” programming. However there is still a space to do some refactoring. What about doing such stuff more in the object-oriented way? Enums are very powerful Java feature but for most of the cases there are only used in the simplest possible way.

Continue Reading
Skip to toolbar