2006-02-28

Poggle Patterns

I will be using two patterns in writing my program for Poggle. The first is a continuation of the one Microsoft use, the View-Document model. The View portion of the pattern handles what is presented to the user. The Document portion is the interface between the game itself and the rest of the program. The Game is in own part of the program.
In the future additional functionality will be added as distinct parts to the program as additional components are added. For example, a part to handle the players and their inventories, and others to manage the playing pieces and the playing field.

The other pattern that I will use is called the Singleton. Classes are often created when the additional functionality goes beyond the core of a enclosing class. The problem is that it is not a good idea to create a class for the benefit of only one object. (Think re-use.)
BUT, all too often only one instance of a class is necessary in a program. Thus, the Singleton.
Devised as a method to allow a program one and only one class instance, the Singleton keeps the idea on one object fresh in the programmer's mind.

In all honestly, a Singleton pattern is overkill for the Poggle program. It will be used in later programs, so I might as well introduce it here.

No comments: