Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design Pattern question (in hindsight)
Message
 
À
18/04/1999 20:21:58
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00209551
Message ID:
00209698
Vues:
25
Hi Nancy!

It's hard to find a generic answer to this question. But I'll try answering the more specific ones you had.

> For example: I have a container superclass that I subclass into containers
> for each wizard step. I add the controls for each step to the container
> subclass. (I then have a pageframe class that subclasses the step
> containers.) In this case the container superclass just sets the layout
> information. I don't add any custom properties or methods. Is this an
> example (even if a bad one) of a Facade structural pattern? I looked at
> Template, but to me it's not a behavioral pattern.

I'm not exactly sure what pattern this would be. Generally, patterns more often deal with object interaction than subclassing. Looks to me like this is good example for proper abstraction, but not any other pattern I'm aware of. (Of course, there are hundreds of patterns and almost everything can be called a pattern, but I haven#t seen this in any of the major catalogs...)

> Another example: I have a listbox subclass that adds a custom property
> called "PopulateList". This subclass calls PopulateList in the Init, but it
> doesn't code the Populate list. I let subclasses control that. Is this an
> example of a Template Method design pattern?

The Template Method pattern describes a method that doesn't do anything but calling other methods. There should be no additional behavior in a template method (other than maybe one or twi IFs that specify what methods to call). Also, there should be more than one method call.

If these sules are fulfilled, then yes, you have a template method. Usually, Init() methods don't fit that description though... :)

Markus




Markus Egger
President, EPS Software Corp
Author, Advanced Object Oriented Programming with VFP6
Publisher, CoDe Magazine
Microsoft MVP since 1995
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform