Thursday, June 22, 2006

Enumerated Type Message

Recently I have been using what I am calling an "Enumerated Type Message" for internal messaging between the model, view, and controller. Please see my template class Message.java for an example.

The Enumerated Type Message is basically a wrapper around an enumerated type with an extra field for arbitrary content. The extra field is necessary because you will often have messages of the same type instantiated at the same time with different content. For those messages with content that stays the same, e.g., null values, I create singleton instances.

I have added the creation of an Enumerated Type Message class as a new step in my Advanced Java Game Programming Checklist.