(Updated: 2005.12.21 03:31:15 PM)
| |
A place to list documented VFP examples of Design Patterns
Attention 3rd Party Vendors -
Before we had a lot of published resources for making use of
Design Patterns to solve problems in VFP, many of us learned how to recognize a particular pattern by studying your products & tools. Those examples are just as important as a published work IMHO, so please feel free to note your examples on the following list or elsewhere in the wiki!
Abstract Factory
CodeBook and related framework documentation
Abstract Factory Code Sample by Kevin McNeish on Microsoft's VFP site. Fixed dead link - works now.
Fox Talk article 3/2002, The Kit Box: As a Matter of Fact—ory by Andy Kramek and Marcia Akins
Subscribers only.
Adapter Pattern
Fox Talk article 7/1/99, Best Practices: Seeing Patterns: The Adapter by Jefferey Donnici
Fox Talk article 9/1/02 What's in a name?
This month, Andy Kramek and Marcia Akins dive into the world of design patterns trying to solve a puzzling naming mystery. According to Design Patterns (Gamma, Helm, Johnson, and Vlissides, Addison Wesley, 1995), the name "Wrapper" is a synonym for both the "Adapter" and the "Decorator" patterns. However, because these are quite clearly different patterns, logically they can't both be called "Wrapper."
AggregatePattern
FoxPro Advisor June 2004 Discover the Advantages of OOP Over Procedural Programming by Mike Yearwood
Bridge Pattern
Bridge Design Pattern Paper by Steven Black
Fox Talk article 3/1/96, Extend and Adapt Your Classes with Bridges by Steven Black
FoxPro Advisor March 1998 article Use Patterns to Increase Reuse and Flexibility by YAlan Griver
Introduction to Design Patterns by YAlan Griver - Broken Link!
Fox Talk article 11/1/98, Best Practices: Seeing Patterns: The Bridge by Jefferey Donnici
Simple Code Example
ox = createobject('Abstraction')
? ox.DoSomething()
define class Abstraction as custom
oImp = .null.
function init
this.oImp = createobject("Implementor")
function destroy
this.oImp = .null.
function DoSomething
return this.oImp.dosomething()
enddefine
define class Implementor as custom
function DoSomething()
return "Something is done by the implementor."
enddefine
Chain Of Responsibility
Fox Talk article 4/1/99, Best Practices: Seeing Patterns: Chain of Responsibility by Jefferey Donnici
Fox Talk article 01/98, discussing Chain Of Responsibility design pattern in an error handling scheme, Reusable Tools: Error Handling Revisited by Doug Hennig. Also available from the Technical Papers page of the Stonefield Systems Group Web site.
FoxPro Advisor December 2001, Chain of Responsibility, by Rick Hodder
Fox Talk article 10/04: Parsing Power Tools, Part 4 by Lauren Clarke and Randy Pearson. Excellent non-hierarchical example of Chain Of Responsibility pattern.
CommandPattern
Fox Talk article 10/1/99,
Best Practices: Seeing Patterns: The Command by Jefferey Donnici
CompositePattern
Fox Talk article 12/1/99, Best Practices: Seeing Patterns: The Composite by Jefferey Donnici
FoxPro Advisor January 2002, Composite Pattern by Rick Hodder
Decorator Pattern
Decorator Design Pattern Paper by Steven Black
Introduction to Design Patterns by YAlan Griver - Broken Link!
Fox Talk article 7/1/96, Design Patterns: Wrappers by Steven Black
FoxPro Advisor article 5/98, Enhance Existing Code with the Decorator by YAlan Griver
Decorator Pattern topic now includes another fine example from Steven Black
DecoratingWithTHIS_ACCESS, and Decorating for the Busy Developer by Lauren Clarke
ElementPattern
FoxPro Advisor June 2004 Discover the Advantages of OOP Over Procedural Programming by Mike Yearwood. While technically this may not be a pattern, by having an element class, I made it easier to work with the elements in the aggregate.
FactoryMethodPattern
Fox Talk article 01/01/2000, Best Practices: Seeing Patterns: The Factory Method by Jefferey Donnici
Working link!
Hook Operation
Hook Operations Design Pattern Paper by Steven Black
IteratorPattern
Fox Talk article 6/1/99, Best Practices: Seeing Patterns: The Iterator by Jefferey Donnici
FoxPro Advisor October 2001 The Iterator Pattern Makes Coding Easier by Rick Hodder
Iterator Pattern From Text by Joe Kuhn
FoxPro Advisor June 2004 Discover the Advantages of OOP Over Procedural Programming by Mike Yearwood
Layers
Design Pattern: Layers, by Steven Black
MediatorPattern
Mediator Design Pattern Paper by Steven Black
Introduction to Design Patterns by YAlan Griver - Broken Link!
Fox Talk Article 12/1/98, Best Practices: Seeing Patterns: The Mediator by Jefferey Donnici
see also PushMediator for active mediators, and PullMediator or Passive Mediator Pattern
FoxPro Advisor article 4/98, Design Patterns, Observers and Mediators by YAlan Griver
Mediator Pattern From Text - by Joe Kuhn
Easy Mediator - by Joe Kuhn
MementoPattern
Fox Talk article 5/1/98, Kit Box: Saving and Restoring Objects by Barbara Peisch and Paul Maskens
FoxPro Advisor, November 2001, Strategy and Memento by Rick Hodder
Observer Pattern
Introduction to Design Patterns by YAlan Griver - Broken Link!
Fox Talk article 1/1/99, Best Practices: Seeing Patterns: The Observer by Jefferey Donnici
Fox Talk article 4/1/96, Design Patterns: Abstract one-to-many Relationships with Observer by Steven Black
FoxPro Advisor article 4/98, Design Patterns, Observers and Mediators by YAlan Griver
Observer Pattern Example compliments of MarkBucciarelli
Observer Pattern From Text by Joe Kuhn
SingletonPattern
Fox Talk article 5/1/99, Best Practices: Seeing Patterns: The Singleton by Jefferey Donnici
StatePattern
FoxPro Advisor Feb 2002 State Pattern by Rick Hodder
Strategy Pattern
Fox Talk article 1/1/97, Add Design Flexibility with a Strategy Pattern by Steven Black
Fox Talk article 2/1/99, Best Practices: Seeing Patterns: The Strategy by Jefferey Donnici
Fox Talk article 9/1/99, Best Practices: Seeing Patterns: Any Questions? by Jefferey Donnici
FoxPro Advisor, November 2001, Strategy and Memento by Rick Hodder
Strategy Pattern topic includes a documented example from Steven Black 's INTL
TemplateMethodPattern
Fox Talk article 11/1/99, Best Practices: Seeing Patterns: The Template Method by Jefferey Donnici
FoxPro Advisor Sept 2001 Reuse Code with the Template Method Pattern by Rick Hodder
VisitorPattern
FoxPro Advisor June 2004 Discover the Advantages of OOP Over Procedural Programming by Mike Yearwood
Otherwebsites with pattern information, not limited to VFP
Data & Object Factory Developer Training Patterns Training
Contributors: Roxanne Seibert, Pamela Thalacker, Anthony Testi, David Fung
Category Design Patterns Category 3 Star Topics