CSCI Object Oriented Design: Frameworks and Design Patterns George Blankenship. Frameworks and Design George Blankenship 1

Similar documents
EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

The Strategy Pattern Design Principle: Design Principle: Design Principle:

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

SYLLABUS CHAPTER - 1 [SOFTWARE REUSE SUCCESS FACTORS] Reuse Driven Software Engineering is a Business

A Reconnaissance on Design Patterns

SDC Design patterns GoF

Software Design COSC 4353/6353 D R. R A J S I N G H

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Object-oriented Software Design Patterns

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Iterator Pattern George Blankenship

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Introduction to Software Engineering: Object Design I Reuse & Patterns

Design Patterns. An introduction

DESIGN PATTERN - INTERVIEW QUESTIONS

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

Design Patterns: Structural and Behavioural

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Design Pattern and Software Architecture: IV. Design Pattern

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Design Patterns. Hausi A. Müller University of Victoria. Software Architecture Course Spring 2000

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Object-Oriented Oriented Programming

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

What is Design Patterns?

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Template Method Pattern. George Blankenship

The Design Patterns Matrix From Analysis to Implementation

Using Design Patterns in Java Application Development

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Design Patterns. CSE870: Advanced Software Engineering (Design Patterns): Cheng

Pro Objective-C Design Patterns for ios

1 Software Architecture

Design Patterns! Acknowledgements!

Topics in Object-Oriented Design Patterns

Creational Design Patterns

UNIT I Introduction to Design Patterns

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Object Oriented Paradigm

An Introduction to Patterns

Applying Design Patterns to SCA Implementations

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

CS/CE 2336 Computer Science II

Application Architectures, Design Patterns

Composite Pattern. IV.4 Structural Pattern

CSE870: Advanced Software Engineering (Cheng) 1

Object-Oriented Design

Design patterns. Jef De Smedt Beta VZW

Information systems modelling UML and service description languages

Tuesday, October 4. Announcements

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

design patterns FOR B.tech (jntu - hyderabad & kakinada) (IV/I - CSE AND IV/II - IT) CONTENTS 1.1 INTRODUCTION TO DESIGN PATTERNS TTERNS... TTERN?...

UNIT I Introduction to Design Patterns

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester

A Rapid Overview of UML

A few important patterns and their connections

Plan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool

Lecture 20: Design Patterns II

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

MVC. Model-View-Controller. Design Patterns. Certain programs reuse the same basic structure or set of ideas

INSTITUTE OF AERONAUTICAL ENGINEERING

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

DESIGN PATTERNS SURESH BABU M ASST PROFESSOR VJIT

COPYRIGHTED MATERIAL. Table of Contents. Foreword... xv. About This Book... xvii. About The Authors... xxiii. Guide To The Reader...

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate

What is Design Patterns?

Overview CS Kinds of Patterns. Design Pattern. Factory Pattern Rationale. Kinds of Factory Patterns

Creational. Structural

Review Software Engineering October, 7, Adrian Iftene

UP Requirements. Software Design - Dr Eitan Hadar (c) Activities of greater emphasis in this book. UP Workflows. Business Modeling.

3 Product Management Anti-Patterns by Thomas Schranz

OODP Session 4. Web Page: Visiting Hours: Tuesday 17:00 to 19:00

Design Patterns. (and anti-patterns)

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Ownership in Design Patterns. Master's Thesis Final Presentation Stefan Nägeli

Summary of the course lectures

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

Design Patterns. "Gang of Four"* Design Patterns. "Gang of Four" Design Patterns. Design Pattern. CS 247: Software Engineering Principles

TDDB84. Lecture 2. fredag 6 september 13

The GoF Design Patterns Reference

CS 247: Software Engineering Principles. Design Patterns

Design Patterns Reid Holmes

DESIGN PATTERNS MOCK TEST DESIGN PATTERNS MOCK TEST II

administrivia today UML start design patterns Tuesday, September 28, 2010

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Writing your own Java I/O Decorator p. 102 Tools for your Design Toolbox p. 105 Exercise Solutions p. 106 The Factory Pattern Baking with OO

Software Eningeering. Lecture 9 Design Patterns 2

Topics. Software Process. Agile. Requirements. Basic Design. Modular Design. Design Patterns. Testing. Quality. Refactoring.

Design Patterns Lecture 2

What is Design Patterns?

An Introduction to Patterns

Lecture 4: Observer Pattern, Event Library and Componentization

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

R07. IV B.Tech. II Semester Supplementary Examinations, July, 2011

Development and Implementation of Workshop Management System Application to Explore Combing Multiple Design Patterns

Transcription:

CSCI 6234 Object Oriented Design: Frameworks and Design Patterns George Blankenship Frameworks and Design George Blankenship 1

Background A class is a mechanisms for encapsulation, it embodies a certain service providing the data and behavior that is useful in the context of some application. A single class is rarely the complete solution to some real problem There is a growing body of research in describing the manner in which collections of classes work together in the solution of problems. Application frameworks and design patterns are two ideas that became popular in this context Frameworks and Design George Blankenship 2

Application Frameworks An application framework is a set of classes that cooperate closely with each other and together embody a reusable design for a general category of problems Although one might abstract and discuss the design elements that lie behind the framework, the framework itself is a set of specific classes that are typically implemented only on a specific platform or limited set of platforms The framework dictates the overall structure and behavior of the application. It describes how responsibilities are partitioned between various components and how these components interact Frameworks and Design George Blankenship 3

A Framework as an Upside-down Library In a traditional application the application-specific code defines the overall flow of execution through the program occasionally invoking library-supplied code A framework reverts this relation: the flow of control is dictated by the framework and the creator of a new application merely changes some of the methods invoked by the framework Inheritance is often used as powerful mechanism for achieving this. Alternatively applicationspecific components that obey a specified interface are plugged in Frameworks and Design George Blankenship 4

GUI Application Framework GUI application frameworks simplify the creation of graphical user interfaces for software systems A GUI application framework implements the behavior expected from a graphical user interface windows, buttons, menu's, text fields move and resize windows handle mouse events on buttons and menus A new application is built by specifying and arranging the necessary elements and by redefining certain methods buttons, menu's, text fields responses to the mouse and key events Frameworks and Design George Blankenship 5

Simulation Application Framework Simulation frameworks simplify the creation of simulation style applications A simulation framework provides a general-purpose class for managing the types of objects in the simulation The heart of a simulation framework is a procedure that cycles through the list of objects introduced in the simulation asking each to update itself The framework knows nothing about the particular application it is going to be used for: billiard balls, fish in a tank, rabbits and wolves in an ecological game, etc. Frameworks and Design George Blankenship 6

Family GCB Application Framework Link list GUI Application Log Finite State Machine TCP/IP communications System Operational Parameters System startup Used to build a standard substructure for application Frameworks and Design George Blankenship 7

GCB Linked List Create linked lists Add/remove items Traverse a list Define an object as a list entry Add arbitrary object to a list List Head First entry Last entry Count of entries List entry Next entry Prior entry List entry Next entry Prior entry List entry Next entry Prior entry List entry Next entry Prior entry List entry Next entry Prior entry Frameworks and Design George Blankenship 8

GCB GUI Build/maintain main GUI Menu bar Scrolling text area Application specific widgets Input area Time display Build/manage Solicitation GUI Build application parameter panel Build application text validation widget Frameworks and Design George Blankenship 9

GCB Application Log Creation an display of program execution log entries Tagged with time and class that generated entry General entry Exception entry Display to GUI, file, command box Controlled by component <date time><component><text> Frameworks and Design George Blankenship 10

GCB Finite State Machine FSM creation and completion Transition table Event driven processing Missing event detection FSM execution Thread safe execution Get current state Execute state transition Trace FSM execution Frameworks and Design George Blankenship 11

GCB TCP/IP Communications Create TCP port Passive port (listen) Active port (connection) Send message Receive message Trace program execution Frameworks and Design George Blankenship 12

System Operational Parameters Repository (FileStore) Data storage System constants System properties Operating parameters subsystem Initial collection operating parameters Read/update of parameters Frameworks and Design George Blankenship 13

System startup Template for execution root class Class with main() Order the initialization of system components Standardize the initialization of the environment Standardize the management of the system Frameworks and Design George Blankenship 14

Design Patterns Design patterns are an attempt to collect and catalog the smallest recurring architectures in object oriented software systems. A design patterns typically captures the solution to a problem that has been observed in many different systems Design patterns are more abstract than a framework. Frameworks are partial implementations of (sub)systems, design patterns have no immediate implementation at all Design patterns are smaller architectural elements than frameworks, most applications (and frameworks) will use several patterns Design patterns are architectural level counterparts of programming idioms Frameworks and Design George Blankenship 15

Sorts of Design Patterns Creational Patterns: are concerned with the process of object creation Structural Patterns: are concerned with how classes and objects are composed to form larger structures purpose Behavioural Patterns: are concerned with algorithms and the assignment of responsibilities between objects Class Patterns deal with static relationships between classes and subclasses scope Object Patterns deal with object relationships which can be changed at run time Frameworks and Design George Blankenship 16

Creational Design Patterns Abstracts the instantiation process: Encapsulates knowledge about which concrete classes to use Hides how the instances of these classes are created and put together Gives a lot of flexibility in what gets created, who creates it, how it gets created, and when it it gets created A class creational pattern uses inheritance to vary the class that is instantiated An object creational pattern delegates instantiation to another object Frameworks and Design George Blankenship 17

Structural Design Patterns Structural design patterns are concerned with how classes and objects are composed to form larger structures A class structural pattern uses inheritance to compose interfaces or implementation; compositions are fixed at design time An object structural pattern describes ways to compose objects to realise new functionality; the added flexibility of object composition comes from the ability to change the composition at run-time Frameworks and Design George Blankenship 18

Behavioral Design Patterns Behavioral design patterns are concerned with algorithms and the assignment of responsibilities between objects Behavioral class patterns use inheritance to distribute behavior between classes Behavioral object patterns use object composition rather than inheritance; some describe how a group of peer objects cooperate to perform a tasks no single object can carry out by itself; others are concerned with encapsulating behavior in an object and delegating request to it Frameworks and Design George Blankenship 19

CREATIONAL PATTERNS Singleton Abstract factory Factory Method Prototype Builder Frameworks and Design George Blankenship 20

The Singleton Control over the number of objects created A single instance is the only instance expected The object is really a serial service provider The object is a repository for other objects Limited number of objects that all share a common environment Frameworks and Design George Blankenship 21

The Abstract Factory Create an object or collection of objects tailored to a context The context may be imposed by outside conditions The context may be selected by parameters The actual collection is one of a set that has the proper behaviour for the context Each object in the set performs the same function Frameworks and Design George Blankenship 22

The Factory Method Create an object or collection of objects that meet a tailored response to a general problem Each collection performs the task in a different manner with a different set of results The requestor selects the type of results and the proper object set is created Frameworks and Design George Blankenship 23

The Prototype Create objects that are clones of a model Rapid creation of similar objects Clone Initialize Simple approach object generation Frameworks and Design George Blankenship 24

The Builder Create complex multifunctional objects performing a multistage task Create (assemble) a tool kit object that is adaptable to variations in a task Frameworks and Design George Blankenship 25

STRUCTURAL PATTERNS Composite Façade Proxy Flyweight Adapter Bridge Decorator Frameworks and Design George Blankenship 26

The Composite The structure of an object hides a hierarchically organized set of core objects The surface allows the user to access the core (traverse the core) without knowledge of the organizational elements (nodes and leaves) Frameworks and Design George Blankenship 27

The Façade The façade organizes a set of core objects (or external objects) by defining a solution oriented surface (external signature) The new objects provide a standard set of computational solutions by invoking the core objects in the proper sequence The core objects could be independently invoked to provide the same solution Frameworks and Design George Blankenship 28

The Proxy The surface of the object presents a virtual core (computation) The core reality is distinct from the virtual The complexity of the core computation is hidden by the surface to allow for completely different object representation, management, or access protection Frameworks and Design George Blankenship 29

The Flyweight The structure of the object is a large number of interior objects that would normally present a footprint problem The interior objects are made a light weight (flyweight) as possible to minimize the footprint of each object External objects (container objects) are used to add common attributes to the flyweight objects Frameworks and Design George Blankenship 30

The Adapter The structure of the object is a core of an existing class providing the computational solution The surface of the object (external signature) is mapped to the internal core Provides a new API for an existing class Allows legacy objects to be used in a new environment Frameworks and Design George Blankenship 31

The Bridge The structure of the object is a core selected from a class of similar cores The surface of the object (external signature) is a standard API that invokes the appropriate core methods The bridge allows multiple cores be bridged into new uses (environments) Frameworks and Design George Blankenship 32

The Decorator The structure of the object is a core of an existing class providing the computational solution Secondary capabilities are added as features to the core The surface of the object (external signature) is a combination of the core and the features giving the object extra capabilities Frameworks and Design George Blankenship 33

BEHAVIORAL PATTERNS Chain of Responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template Method Visitor Frameworks and Design George Blankenship 34

The Chain of Responsibility The processing of a is spread across a set (chain) of objects The processing sequence is accomplished by moving the processing through the sequence Individual objects in the chain may/or may not perform a computation The sequence may be controlled (steered) by the individual objects Frameworks and Design George Blankenship 35

The Command Individual elements of a computation are implemented as objects The objects are then invoked to perform the computation The objects can be associated with other components (widgets) such that the invocation of the widget causes the computation to be performed Frameworks and Design George Blankenship 36

The Interpreter A language is created that can be used to define a computation The objects of the system are language elements and a computation can be performed by writing a program using the objects The language constrains the solution space (type of problems that can be addressed) Frameworks and Design George Blankenship 37

The Iterator Processing of aggregations can be accomplished by organizing the aggregations in a meaningful manner The surface of the organization object allows the access to the individual objects in a meaningful manner such as in order or by selection Frameworks and Design George Blankenship 38

The Mediator The computation of a system may be spread across multiple disparate objects that do not have surfaces that interlock Mediator objects are created to pass the processing between the computational entities by tailoring the interfaces and/or selecting the correct next required object in the computation Frameworks and Design George Blankenship 39

The Memento Processing may include the concept of stages The processing may progress forward from stage to stage keeping the prior stages as a history The processing my move backwards and forwards in the stage sequence The memento is used to capture prior stages for return Frameworks and Design George Blankenship 40

The Observer Processing may be keyed to the occurrence of events An observers object monitors for the occurrence of an event When an event occurs the observer coordinates the processing appropriate for the event Frameworks and Design George Blankenship 41

The State Processing may be defined using a Finite State Machine (FSM) The core object of the computation need to recognize their location on the FSM graph and change their processing to match their location on the graph Frameworks and Design George Blankenship 42

The Strategy The processing may include distinct computations An individual computation may have a family of algorithms that reflect different optimal characteristics Objects are defined for each algorithm and used to meet a particular (ad hoc) objective (or strategy) Frameworks and Design George Blankenship 43

The Template Method Processing may be defined by an algorithm that is defined by individual steps Each step is a computational entity (object) The algorithm may be reused for similar computations by tailoring the individual objects the define a step Frameworks and Design George Blankenship 44

The Visitor Processing of aggregates may include special processing of each object The special processing may adjust some of the attributes of each object or just verify that the attributes do not need adjustment There may be a number of such special processing requirements The Visitor is an object that would implement the processing and visit each object Frameworks and Design George Blankenship 45