Java enum as a strategy pattern

Luca | October 27, 2007

While I was reviewing this (awful) code, I realized how an enum for me is nothing more than a strategy pattern out of the box in Java.

Few days later I read this interesting article from Ralph Johnson (GoF anyone ?) where he says something pretty close to my point of view:

Design patterns are not made of stone.
[...]
Over time, we should change our programming languages so that they build in things that used to be patterns.

If Ralph and I are on the same page, I’m happy :-)

This evolution of modern languages will (hopefully) increase the number of people that are really able to write Object Oriented code, thinking about behaviour and not just about data.

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>