GoF's design pattern implemented with Java