1 / 12

Design Patterns

Learn recurring solutions to programming challenges, isolated code changes, and object interactions using design patterns. Examples include Facade, Adapter, Singleton, Abstract Factory, and Bridge.

cdickens
Download Presentation

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. Design Patterns By Mareck Kortylevitch and Piotreck Ratchinsky

  2. What is Design Pattern? • Recurring solution to known problems • Workaround to problems that arise when developing software within a particular context

  3. History • Precursor of design pattern was Christopher Alexander • First Design Patterns used in architecture

  4. Why to use DP? • Help you learn from others' successes instead of your own failures • Provide a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges

  5. Why to use...continuation • Enforce using techspeak • Isolate changes in the code • Design and interaction of objects

  6. Design Patterns Examples • Facade • Adapter • Singleton • Abstract Factory • Bridge

  7. Facade - definition • Provide a unified interface to a set of interfaces in a subsystem. Façade defines a higher-level interface that makes the subsystem easier to use.

  8. Facade - UML class diagram

  9. Facade - example • Facade (MortgageApplication) • knows which subsystem classes are responsible for a request. • delegates client requests to appropriate subsystem objects. • Subsystem classes (Bank, Credit, Loan) • implement subsystem functionality. • handle work assigned by the Facade object. • have no knowledge of the facade and keep no reference to it.

  10. Facade – example diagram Facade Subsystems Bank Credit Loan

  11. Singleton - definition • ensure a class has only one instance and provide a global point of access to it. • defines an Instance operation that lets clients access its unique instance. Instance() is a class operation. • responsible for creating and maintaining its own unique instance.

  12. Singleton – UML Singleton -static Singleton: instance -Singleton() +static getInstance():Singleton

More Related