Pattern
|
Use
|
Singleton
|
Ensures a class has only one instance AND provides a global point of access to it.
The
StaticData
Singleton is an example of this pattern. See its use in
WeaponDAOImpl
.
|
Factory
|
Provide an interface for creating families of related or dependent objects
without specifying their concrete class.
The
DAOFactory
is an example of this pattern. See its use in
WeaponStatsStub
.
|
Composite
|
Implements the same interface as leaf implementations and typically iterates over
their child objects calling the same method that was invoked on the Composite.
|
Decorator
|
A Decorator forwards requests to its Component object usually performing
additional operations before and after forwarding the request.
|
Adapter
|
Adapter allows classes to work together that couldnt otherwise due
to incompatible
interfaces.
The
HalfLifeLoader
is an example implementation of this pattern. See its use in
StaticData
.
Currently this adapters class is hard coded, a factory will be
used as soon as another adapter is created.
|
Command
|
Encapsulate a request as an object, thereby letting you parameterize clients with
different requests, queue or log requests, and support undoable operations.
The best example of this is the Struts Action classes. See the
com.mlw.fps.controller
package for examples.
|
Model View Controller
|
-
Model
- The core of the application. This maintains the state and data that the application represents. This is where the business logic resides.
-
Controller
- Dispatches requests to the model and controls flows to the view.
-
View
- The user interface which displays information about the model to the user and collects user input.
Struts!
|