Presentation is loading. Please wait.

Presentation is loading. Please wait.

** Reuse Activities ** Selecting Design Patterns and Components (Part 1) Done by Safaa khalil Meqdad.

Similar presentations


Presentation on theme: "** Reuse Activities ** Selecting Design Patterns and Components (Part 1) Done by Safaa khalil Meqdad."— Presentation transcript:

1 ** Reuse Activities ** Selecting Design Patterns and Components (Part 1) Done by Safaa khalil Meqdad

2 Outline Introduction Sources of Changes Design Patterns

3 .. Sources of Changes.. New vendor or new technology New implementation New views Errors

4 .. Design Patterns.. Bridge Design Pattern Adapter Design Pattern Strategy Design Pattern Abstract Factory Design Pattern

5 ** Bridge Design Pattern ** decouple the interface from an implementation so that implementations can be substituted possibly at run time. From figure (1) the client just deal with Abstraction class and completely shielded from both abstraction implementor and concrete implementation. Bridge design pattern fills the gap between the interface and its implementation.

6 Arena LaegueStore LaegueStoreImplementator StubStore Implementor XMLStore Implementor JDBCStore Implementor Figure (1) Abstraction class

7 ** Adapter Design Pattern ** The Adapter converts the interface of a legacy system into an interface expected by the user.. From figure ( 2 ) the Adapter class (MyStringComparator) provides the interface expected by the client,and delegates the request the client request to the Legacy class (MyString) and perform any necessary conversions. Adapter works with Legacy Class and all of its subclasses. Client and Legacy class can work together with out any modification on both sides.

8 Array Comparator compare ( ) MyStringComparator compare ( ) MyString graeterThan ( ) eqauls ( ) Figure (2) Adapter class Legacy class

9 ** Strategy Design Pattern ** Decouple a policy-deciding class from a set of mechanisms so that different mechanisms can be changed transparently from the client. From figure (3).. the network access protocols implementations are encapsulated with a strategy pattern to decouple the policy from selecting a network interface New algorithms can be added.

10 Application LocationManager NetworkConnection send ( ) receive ( ) setNetworkInterface ( ) NetworkInterface open ( ) close ( ) send ( ) receive ( ) Ethernet Open ( ) close ( ) send ( ) receive ( ) WaveLAN Open ( ) close ( ) send ( ) receive ( ) UMTS Open ( ) close ( ) send ( ) receive ( ) Figure (3) Strategy class Policy

11 ** Abstract Factory Design Pattern ** The Abstract Factory shield the client from different platforms that provide different implementations for the same set of concepts.. Client deals with interface provided by the AbstractFactory figure (4). Client can change platforms easier. Adding new product is difficult since new realization for each factory must be created.

12 Blind LuxmateBulb EIBBulb LuxmateBulbEIBBulb LightBulb HouseFartory createBulb ( ) craeteBlind ( ) EIBFactory createBulb ( ) craeteBlind ( ) LuxmateFactory createBulb ( ) craeteBlind ( ) TheftApplication Figure (4) AbstractFactor y class

13 Summary Design PatternPhrase Bridge Design Pattern “Must Support future protocols” Adapter Design Pattern “Must deal with existing systems or reuse Legacy systems” AbstractFactory Design Pattern “Platform independency”.. “Manufacturers independency” Strategy Design Pattern “Must allow different algorithms to be interchanged at runtime”


Download ppt "** Reuse Activities ** Selecting Design Patterns and Components (Part 1) Done by Safaa khalil Meqdad."

Similar presentations


Ads by Google