Design Pattern Problem

Google’s Web Alerts service reminded me of a question I once asked in a newsgroup. Since I didn’t get a response back then, I thought I’d post it here again.

The Top Level Design:

The class Base is a factory class with a twist. It uses the Assembly/Type
classes to extract all types that inherit from it and add them to the list
of types that inherit from it. During run time, using a static method, the
class creates an instance of the derived class using the Activator class and
returns it. This design pattern is very similar to the design pattern
applied by the Assembly class.

The twist is that all inheritors of Base must specify a small amount of
metadata. The metadata will be hard-coded into the derived classes and a
lack of the said metadata must be discovered at compile time.

Design Constraints:

  1. Base is not a component.
  2. Derived classes may be inherited as well.
  3. All derived classes must have unique metadata.

There are several ways to approach this problem…”
Read on…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s