Presentation is loading. Please wait.

Presentation is loading. Please wait.

Reuse Activities Selecting Design Patterns and Components

Similar presentations


Presentation on theme: "Reuse Activities Selecting Design Patterns and Components"— Presentation transcript:

1 Reuse Activities Selecting Design Patterns and Components
Part (2)

2 Outline Encapsulation Control Flow with the Command Pattern.
Encapsulation Hierarchies with the Composite Design Pattern. Heuristics for Selecting Design Patterns. Identifying and Adjusting application framework.

3 Problem: We don’t want the classes responsible for recording and replaying moves to depend on specific game. Solution: Using Command Design Pattern.

4 Match Move * Play() Replay() Execute() binds TicTacToeMove ChessMove GameBoard Execute() Execute() Command Design Pattern uses specification inheritance between command class and concrete command enabling new command to be added independently from the invoker.

5 In Delegation two objects are involved in handling a request:
Delegation is a way of making composition (for example aggregation) as powerful for reuse as inheritance. In Delegation two objects are involved in handling a request: A receiving object delegates operations to its delegate. The developer can make sure that the receiving object does not allow the client to misuse the delegate object Delegate Client Receiver calls Delegates to

6 Delegation is used between concrete commands and receivers, and between invoker and command enabling concrete command to be dynamically created, executed and stored. Main

7 Encapsulation Hierarchies with the Composite Design Pattern.
Definition: A software system consists of subsystems which are either other subsystems or collection of classes Composite: Subsystem (A software system consists of subsystems which consists of subsystems , which consists of subsystems, which... User Software System * Class Subsystem Children

8 Border layout Grid layout(3,4) Border layout

9 Composite Design Pattern
* Component Move() Resize() Composite Move() Resize() Label Button Checkbox window Panel Main Applet

10 Heuristics for Selecting Design Patterns.
Using key phrases in the Requirement Analysis Document (RAD) and System Design Document (SDD). Heuristics box

11 “Manufacturer independence” “Platform independence” Abstract factory
Phrase Design Pattern “Manufacturer independence” “Platform independence” Abstract factory “Must comply with existing interface” “Must reuse existing legacy component” Adapter “Must support future protocol” Bridge “All commands should be undoable” “All transactions should be logged” Command “Must support aggregate structures” “Must allow for hierarchies of variable depth and width” Composite “Policy and mechanisms should be decoupled” “Must allow different algorithms to be interchanged at runtime.” Strategy Main

12 Application Framework Definition
An application framework is a reusable partial application that can be specialized to produce custom applications. Frameworks are targeted to particular technologies.

13 Examples of application Frameworks

14

15

16 Enterprise application
Infrastructure Middleware Enterprise application Aim to simplify software development process. Used internally within software project Used to integrate existing distributed application and components. Focus on domains such as telecommunicati-ons Support the development of end user applications. Are essential to create rapidly high quality software systems

17

18 Whitebox Rely on inheritance and dynamic building for extensibility. Existing functionality is extended by subclassing framework base classes and overriding predefined hook methods. Blackbox Support extensibility by defining interfaces for components that con be plugged into the framework. Existing functionality is reused by defining components that conform to particular interface.

19 Require intimate knowledge of the framework’s internal structure.
Produce systems that are tightly coupled to the specific details of the framework’s inheritance hierarchies, thus change in framework require recompilation of application. Easier to use because of delegation. More difficult to develop because require definition of interfaces and hooks. Easier to extend and reconfigure dynamically.

20 Design patterns versus frameworks
Focus on reuse of abstract designs and small collections of cooperating classes. Can be viewed more as building blocks of frameworks. Framework Focus on reuse of concrete designs, algorithms and implementations in a particular programming language. Focus on particular application domain.

21 Class Libraries versus Frameworks
Less domain specific and provide smaller scope of reuse. eg: classes for strings, complex numbers, arrays and bitsets. Passive: don’t implement constrain the control flow. Frameworks Cooperate to provide a reusable architectural skeleton for a family of related applications. Active: control the flow of control within an application.

22 Components versus Frameworks
Self contained instances of classes that are plugged together to form complete applications. It is a blackbox that defines a cohesive set of operations that can be used solely with knowledge of the syntax and semantics of its interfaces. Less tightly coupled and can be reused on the binary code level. Application don’t always have to be recompiled when components change. component interface provides a façade pattern for the internal class structure of the framework. Can be plugged into blackbox framework. Used to simplify the development of end user application software. Frameworks Can be used to develop components. Used to simplify the development of infrastructure and middleware software. Components are often plugged into blackbox frameworks.

23 Example: Framework for Building Web Applications
WebBrowser StaticHTML WOAdaptor WebServer WoRequest Template WebObjectsApplication WORequest EOF RelationalDatabase

24 Thanks for your attention


Download ppt "Reuse Activities Selecting Design Patterns and Components"

Similar presentations


Ads by Google