Patterns in. Lecture 2 GoF Design Patterns Creational. Sharif University of Technology. Department of Computer Engineering



Similar documents
ABSTRACT FACTORY AND SINGLETON DESIGN PATTERNS TO CREATE DECORATOR PATTERN OBJECTS IN WEB APPLICATION

Structural Design Patterns Used in Data Structures Implementation

Génie Logiciel et Gestion de Projets. Patterns

Agile Software Development

Roulette: Inheritance Case Study

CMSC 132: Object-Oriented Programming II. Design Patterns I. Department of Computer Science University of Maryland, College Park

Designing and Writing a Program DESIGNING, CODING, AND DOCUMENTING. The Design-Code-Debug Cycle. Divide and Conquer! Documentation is Code

Software Development Methodologies

Design Patterns. Design patterns are known solutions for common problems. Design patterns give us a system of names and ideas for common problems.

Framework Development for Large Systems

Framework Development for Large Systems

Excerpts from Chapter 4, Architectural Modeling -- UML for Mere Mortals by Eric J. Naiburg and Robert A. Maksimchuk

Treating Interfaces as Components

Encapsulating Crosscutting Concerns in System Software

The Command Dispatcher Pattern

Engineering Process Software Qualities Software Architectural Design

A Reusability Concept for Process Automation Software

Patterns in Software Engineering

A Pattern for Designing Abstract Machines

The Different Types of Search and Execution Systems

SOACertifiedProfessional.Braindumps.S90-03A.v by.JANET.100q. Exam Code: S90-03A. Exam Name: SOA Design & Architecture

Composing Concerns with a Framework Approach

Reuse in Modelling Instructional Design

Agent Design Patterns: Elements of Agent Application Design

Ontological Representations of Software Patterns

Eugene Wallingford Department of Computer Science University of Northern Iowa Cedar Falls, Iowa

Design Patterns. Advanced Software Paradigms (A. Bellaachia) 1

Microelectronic System-on-Chip Modeling using Objects and their Relationships

Lecture Objectives. Software Life Cycle. Software Engineering Layers. Software Process. Common Process Framework. Umbrella Activities

The Phases of an Object-Oriented Application

A First Set of Design Patterns for Algorithm Animation

APLRAC: A PATTERN LANGUAGE FOR DESIGNING AND IMPLEMENTING ROLE-BASED ACCESS CONTROL

Pattern. seconda parte. Types of patterns. ...other good guidance... some GRASP. design patterns (software design) Types of software patterns

An Automatic Reversible Transformation from Composite to Visitor in Java

Towards Reusable Intelligent Scheduling Software

Architecture. Reda Bendraou

Evaluating OO-CASE tools: OO research meets practice

Rapid Application Development of a Decision Support System using Object Oriented Programming

Design Pattern Management System: A Support Tool Based on Design Patterns Applicability


Chapter 3 Chapter 3 Service-Oriented Computing and SOA Lecture Note

Tool Support for Software Variability Management and Product Derivation in Software Product Lines

EpochX: Genetic Programming in Java with Statistics and Event Monitoring

A Catalogue of General-Purpose Software Design Patterns

A MODEL OF HETEROGENEOUS DISTRIBUTED SYSTEM FOR FOREIGN EXCHANGE PORTFOLIO ANALYSIS

ARCHITECTURAL DESIGN OF MODERN WEB APPLICATIONS

Component Based Development in Software Engineering

What is a life cycle model?

ABSTRACT. Keywords Virtual Reality, Java, JavaBeans, C++, CORBA 1. INTRODUCTION

REST Client Pattern. [Draft] Bhim P. Upadhyaya ABSTRACT

Design with Reuse. Building software from reusable components. Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 14 Slide 1

Concern Driven Software Development

ATV Data Link Simulator: A Development based on a CCSDS Layers Framework

Design Patterns in Java

Pattern-Based Tool Support for Frameworks Towards Architecture-Oriented Software Development Environment

Umbrella: A New Component-Based Software Development Model

Operator-Centric Design Patterns for Information Visualization Software

JOURNAL OF OBJECT TECHNOLOGY

JOURNAL OF OBJECT TECHNOLOGY

Design Patterns. V Software Engineering Lecture 8. Adapted from Prof. Necula CS 169, Berkeley 1

Preparing for Service-Oriented Computing: a composite design pattern for stubless Web service invocation

Patterns for Business Object Model Integration in Process-Driven and Service-Oriented Architectures

Pattern-Oriented Architecture for Web Applications

Embedded Software development Process and Tools: Lesson-1

COORDINATION CONTRACTS AS CONNECTORS IN COMPONENT-BASED DEVELOPMENT

Design Patterns for Managing Product Lifecycle Information

The WebShop E-Commerce Framework

Customer Bank Account Management System Technical Specification Document

Software Engineering. Software Engineering. Component-Based. Based on Software Engineering, 7 th Edition by Ian Sommerville

Engineering Web Applications for Reuse

Singletons. The Singleton Design Pattern using Rhapsody in,c

How To Design Software

4. Incorporate Lessons Learned with SDLC

Automated Software Evolution via Design Pattern Transformations

Core J2EE Patterns, Frameworks and Micro Architectures

Architectural Patterns (3)

A Process View on Architecture-Based Software Development

70 October 1997/Vol. 40, No. 10 COMMUNICATIONS OF THE ACM

Reusability Problems of Object- Oriented Software Building Blocks

Design Patterns in Python

Software development life cycle. Software Engineering - II ITNP92 - Object Oriented Software Design. Requirements. Requirements. Dr Andrea Bracciali

Domain-Driven Design

Peter Mileff PhD SOFTWARE ENGINEERING. The Basics of Software Engineering. University of Miskolc Department of Information Technology

The Oregon Software Development Process

How To Use The Command Pattern In Java.Com (Programming) To Create A Program That Is Atomic And Is Not A Command Pattern (Programmer)

Structuring Product-lines: A Layered Architectural Style

Object Oriented Design

The WebShop e-commerce framework

GenericServ, a Generic Server for Web Application Development

CHAPTER 1 INTRODUCTION

Object-Oriented Software Specification in Programming Language Design and Implementation

A methodology for secure software design

[2006] IEEE. Reprinted, with permission, from [M. Ye and K. Sandrasegaran, Teaching about Firewall Concepts using the inetwork Simulator, Information

Business Modeling with UML

Applying Design Patterns in Distributing a Genetic Algorithm Application

View Controller Programming Guide for ios

Component-Based Software Engineering (CBSE) Announcements

Using Bonds for Describing Method Dispatch in Role-Oriented Software Models

Gadget: A Tool for Extracting the Dynamic Structure of Java Programs

ios Design Patterns Jackie Myrose CSCI 5448 Fall 2012

Transcription:

Patterns in Software Engineering Lecturer: Raman Ramsin Lecture 2 GoF Design Patterns Creational 1

GoF Design Patterns Principles Emphasis on flexibility and reuse through decoupling of classes. The underlying principles: p program to an interface, not to an implementation. favor composition over class inheritance. find what varies and encapsulate it. 2

GoF Design Patterns: General Categories 23 patterns are divided into three separate categories: Creational patterns Deal with initializing and configuring classes and objects. Structural patterns Deal with decoupling interface and implementation of classes and objects. Behavioral patterns Deal with dynamic interactions among societies of classes and objects. 3

GoF Design Patterns: Purpose and Scope 4

GoF Creational Patterns Class Factory Method: Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory method lets a class defer instantiation to subclasses. Object Abstract Factory: Provide an interface for creating families of related or dependent objects without specifying their concrete class. Builder: Separate the construction of a complex object from its representation so that the same construction process can create different representations. Prototype: Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. Singleton: Ensure a class only has one instance, and provide a global point of access to it. 5

Factory Method Intent: Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. 6

Factory Method: Applicability Use the Factory Method pattern when a class can't anticipate i t the class of objects it must create. a class wants its subclasses to specify the objects it creates. classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate. 7

Factory Method: Structure 8

Factory Method: Consequences It provides hooks for the subclasses. It connects parallel class hierarchies. 9

Abstract Factory Intent: Provide an interface for creating families of related or dependent objects without specifying their concrete classes. 10

Abstract Factory: Applicability Use the Abstract t Factory pattern when a system should be independent of how its products are created, composed, and represented. a system should be configured with one of multiple families of products. a family of related product objects is designed to be used together, and you need to enforce this constraint. you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations. 11

Abstract Factory: Structure 12

Abstract Factory: Consequences Concrete classes are isolated. Clients manipulate instances through their abstract interfaces. Exchanging g product families is easy. Different product configurations can be used simply by changing the concrete factory. Consistency among products is promoted. Supporting new kinds of products is difficult. dff The AbstractFactory interface fixes the set of products that can be created. 13

Builder Intent: Separate the construction of a complex object from its representation so that the same construction process can create different representations. 14

Builder: Applicability Use the Builder pattern when the algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. the construction process must allow different representations for the object that's constructed. 15

Builder: Structure 16

Builder: Collaborations 17

Builder: Consequences It lets you vary a product's internal representation. It isolates code for construction and representation. It gives you finer control over the construction process: Since the Builder pattern constructs the product step by step under the director's control. 18

Prototype Intent: Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. 19

Prototype: Applicability Use the Prototype pattern when the classes to instantiate are specified at run-time, for example, by dynamic loading. building a class hierarchy of factories that parallels the class hierarchy of products should be avoided. instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually. 20

Prototype: Structure 21

Prototype: Consequences It hides the concrete product classes from the clients, thereby reducing the number of names clients know about. It lets a client work with application-specific classes without modification. It lets you add and remove products at run-time. It lets you specify new objects by varying values. 22

Singleton Intent: Ensure a class only has one instance, and provide a global l point of access to it. 23

Singleton: Applicability Use the Singleton pattern when there must be exactly one instance of a class, and it must be accessible to clients from a well known access point. when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code. 24

Singleton: Consequences It provides Controlled access to sole instance. It reduces the name space by avoiding global variables. It permits refinement of operations and representation through subclassing. It permits a variable number of instances. It is more flexible than class operations. 25

Reference Gamma, E., Helm, R., Johnson, R., and Vlissides, id J., Design Patterns: Elements of Reusable Object-oriented Software. Addison-Wesley, 1995. 26