1 / 17

Using Software Design Patterns

Using Software Design Patterns. Bill Anderson. About me. Fox developer since 1987 Program Director, Los Angeles Visual Foxpro Developers Group (LAFox) Independent Consultant since 1991 SoCal speaker and author. Design Patterns. What are patterns? A solution to a problem in a context.

marius
Télécharger la présentation

Using Software Design Patterns

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using Software Design Patterns Bill Anderson

  2. About me • Fox developer since 1987 • Program Director, Los Angeles Visual Foxpro Developers Group (LAFox) • Independent Consultant since 1991 • SoCal speaker and author

  3. Design Patterns • What are patterns? • A solution to a problem in a context. • Similarities to architectural design issues.

  4. Design Patterns • Four elements to a design pattern • Name • When to apply pattern • Description of elements and responsibilities • Consequences of usage • You’re familiar with patterns!

  5. Bridge Pattern • Definition: Decouple an abstraction from the implementation so the two can vary independently. • Fundamental design pattern • Three types of bridges • Reference bridges • Multiple bridges • Aggregation bridges

  6. Decorator Pattern • Definition: Attach additional responsibilities to an object dynamically. • Heuristic: Subclass all “black box” objects (VFP base classes, ActiveX controls, etc.) • Subclassed a control and changed its behavior? Then you know the pattern.

  7. Adapter Pattern • Definition: Convert the interface of a class into another interface clients expect. • Adapters modify interfaces to an object (unlike Decorators, which modify behavior of an object). Makes an object look like another.

  8. Template Method • Definition: Define the skeleton of an algorithm in an operation. • Used to define a common sequence of events • Template methods contain • Abstract operation methods • Hook operations

  9. Iterator Pattern • Definition: Provide a way to access elements of an aggregate object. • Means of traversal handled by iterator object. • Should be a container. • VFP collection class is ideal. • Similarities to traversing an array.

  10. Observer Pattern • Definition: Define dependency between objects so that if state change, all dependents are notified. • Two types of Observers • Active (Voyeur) • Passive (Publish and Subscribe)

  11. Mediator Pattern • Definition: Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling via one communication point. • Used to handle event notification. • Mediator is a form of a Passive Observer.

  12. Memento Pattern • Definition: Capture an object’s internal state so that the object can be restored. • Use this pattern for VFP housekeeping chores – SET settings, ON settings, work areas, etc.

  13. Chain of Responsibility • Definition: Avoid coupling request sender to the receiver by giving more than one object a chance to handle the request. Chain the receiving objects. • Pattern often used in hierarchies – Error handling, processing import data, multi-tier applications, etc.

  14. Chain of Responsibility

  15. Abstract Factory Pattern • Definition: Provide an interface for creating families of dependent objects without specifying their concrete classes. • Avoid NewObject and CreateObject methods – let Factory handle it. • VFP data access performance is ideal for implementing this pattern.

  16. Summary • Use Software Patterns to keep an application as flexible as possible. • Think in Patterns • You’re already familiar with most patterns. • Use pattern heuristics as a guideline. • Understand pattern usage. • Don’t get lost in formal definitions. • Fox Wiki is a great resource • http://fox.wikis.com

  17. Thank you! Remember to fill out your session evaluation. Session slides, white paper, and code samples will not be updated.

More Related