Summary of the course lectures

Similar documents
Design Patterns. Gunnar Gotshalks A4-1

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. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Topics in Object-Oriented Design Patterns

SDC Design patterns GoF

Using Design Patterns in Java Application Development

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

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

Object-Oriented Design

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

Object-Oriented Design

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

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

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

Design Patterns. An introduction

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

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

Information systems modelling UML and service description languages

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

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

Software Engineering

Object-Oriented Design

COURSE 2 DESIGN PATTERNS

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

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

What is Design Patterns?

Design patterns. OOD Lecture 6

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

Applying the Observer Design Pattern

Review Software Engineering October, 7, Adrian Iftene

Design patterns. Jef De Smedt Beta VZW

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.

CS/CE 2336 Computer Science II

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

Applying the Decorator Design Pattern

Design Patterns V Structural Design Patterns, 2

Object-Oriented Design

Lecture 17: Patterns Potpourri. Copyright W. Howden 1

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

Object Oriented Paradigm

3 Product Management Anti-Patterns by Thomas Schranz

The following topics will be covered in this course (not necessarily in this order).

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

Improve Your SystemVerilog OOP Skills

Material and some slide content from: - GoF Design Patterns Book. Design Patterns #1. Reid Holmes. Lecture 11 - Tuesday October

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D

CHAPTER 6: CREATIONAL DESIGN PATTERNS

Applying Design Patterns to accelerate development of reusable, configurable and portable UVCs. Accellera Systems Initiative 1

1 Software Architecture

CS251 Software Engineering Lectures 18: Intro to DP

CPSC 310 Software Engineering. Lecture 11. Design Patterns

DESIGN PATTERN - INTERVIEW QUESTIONS

Software Engineering Prof. Rushikesh K.Joshi IIT Bombay Lecture-15 Design Patterns

Facade and Adapter. Comp-303 : Programming Techniques Lecture 19. Alexandre Denault Computer Science McGill University Winter 2004

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

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

Coordination Patterns

Chapter 8, Design Patterns Visitor

CHAPTER 6: CREATIONAL DESIGN PATTERNS

Application Architectures, Design Patterns

Lecture 20: Design Patterns II

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

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

Reuse at Design Level: Design Patterns

SOFTWARE ENGINEERING SOFTWARE DESIGN. Saulius Ragaišis.

Applying the Factory Method Design Pattern

The GoF Design Patterns Reference

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

Advanced WCF 4.0 .NET. Web Services. Contents for.net Professionals. Learn new and stay updated. Design Patterns, OOPS Principles, WCF, WPF, MVC &LINQ

EINDHOVEN UNIVERSITY OF TECHNOLOGY

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming

Software Engineering CSC40232: SOFTWARE ENGINEERING. Guest Lecturer: Jin Guo SOLID Principles sarec.nd.edu/courses/se2017

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

Object-Oriented Oriented Programming

CHAPTER 5: PRINCIPLES OF DETAILED DESIGN

CSE870: Advanced Software Engineering (Cheng) 1

Design Pattern- Creational pattern 2015

Object-oriented Software Design Patterns

What is a Pattern? Lecture 40: Design Patterns. Elements of Design Patterns. What are design patterns?

Creational Design Patterns

CS560. Lecture: Design Patterns II Includes slides by E. Gamma et al., 1995

Introduction and History

17. GRASP: Designing Objects with Responsibilities

6.3 Patterns. Definition: Design Patterns

SOLID Principles. Equuleus Technologies. Optional Subheading October 19, 2016

An Introduction to Patterns

Tuesday, October 4. Announcements

Exam in TDDB84: Design Patterns,

Design Patterns 2. Page 1. Software Requirements and Design CITS 4401 Lecture 10. Proxy Pattern: Motivation. Proxy Pattern.

Design of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference. Roel Wuyts

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

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

Unit Wise Questions. Unit-1 Concepts

What is Design Patterns?

Designing and Writing a Program. Divide and Conquer! The Design-Code-Debug Cycle. Documentation is Code. Pair Programming 3/8/2012

A Reconnaissance on Design Patterns

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

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

Transcription:

Summary of the course lectures 1

Components and Interfaces Components: Compile-time: Packages, Classes, Methods, Run-time: Objects, Invocations, Interfaces: What the client needs to know: Syntactic and Semantic About instances of this particular class About all instances of this class and its descendants (LSP) Levels of Description Architectural, Package, Class, Method T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 2

UML Class Diagrams Classes and Interfaces Association Plain Aggregation Composition Navagbility Multiplicity Specialization and Realization Dependence T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 3

UML Sequence Diagrams The tree of calls. Just an example of behaviour T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 4

Use Cases Like a movie script 1. Ilsa: But of course that was the day the Germans marched into Paris. 2. Rick: Not an easy day to forget. 3. Ilsa: No 4. Rick: I remember every detail. The Germans wore gray, you wore blue. 5. Customer: Inserts her bank card belonging to our bank 6. ATM: Swallows card and prompts for PIN 7. Customer : Types in PIN and presses OK 8. ATM: Shows the main menu. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 5

Use Cases Describe Happy day Scenarios, but also alternatives. 3a: The customer enters a PIN and presses cancel 4a: The card is returned and the use case ends. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 6

Use Cases Can be used to verify external design with customer as a basis for testing to sequence iterations to drive development T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 7

Classes and Responsibilities Each class has responsibilities that are Specific, Few, & Easily understood Kinds of responsibilities Information Storage, Algorithmic, Device Interface, OS Interface, I/O formatting, Adaptation, Structural, Creators, Arbitrary Facts. Information Hiding Classes can hide design decisions and external constraints from the rest of the system. Ideally each axis of change is confined to one class (Information Hiding Principle) And each class deals with one axis of change (SRP) T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 8

Model / View Analysing the problem of Models and Views we found a way to protect the model from changes to the number of views changes to the class(es) of the views specific requirements of specific views And to protect the views from implementation details of the model such as data storage methods the need to inform other views of changes to the model T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 9

Observer Pattern Our solution to the Model / View problem turns out to have a name and be more widely applicable. It is the observer pattern: T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 10

Design Patterns Design patterns are reusable solutions to recurring problems in software design Many patterns are identified and discussed in Gamma, Helm, Johnson, & Vlissides, Design Patterns: Elements of Reusable OO Software, AW, 1994. Standard Format: Intent, Also known as, Motivation, Applicability, Structure, Collaborations, Consequences, Implementations, and Variations, Known Uses T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 11

Design Patterns Recurring theme: Design patterns structure classes to minimize dependence and thus allow aspects to be reusable. E.g. Application Layer Reusable Layer T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 12

Design Patterns Application Layer Reusable Layer Even if you don t plan to reuse an aspect of the design, this separation of concerns simplifies your software. (SRP, ISP) T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 13

Observer Pattern Separates the concern of observer notification from the implementation of the model and the implementation of the views. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 14

Command Pattern Separates what needs to be done from when to do it. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 15

Composite Pattern Compose objects into trees structures to represent part-whole hierarchies Calls are sent down the tree T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 16

Proxy Pattern Provides a surrogate or placeholder for another object The Subject object and the Proxy object implement the same interface. The Proxy may hide the true location or other aspects of the Subject [Full disclosure: My notes actually describe both the Decorator pattern and the Proxy pattern, but use only the name Proxy pattern. Here s the difference: When new functionality is added by the intermediate object, it s the Decorator pattern. When location or other aspects of the subject are hidden by the intermediate object, it s the Proxy pattern. The JSnoopy example is properly a case of the Decorator pattern. Adding to the confusion, Java s Proxy class is often used to automate implementation of the Decorator pattern. See Gamma et al. or Freeman and Freeman for more.] T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 17

State Pattern Represents each state in a state machine by a class. Events are mapped to method calls. The context keeps a pointer to the current state and delegates events to its current state T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 18

Factory Method Pattern Create objects via an interface Different implementations will produce different products. Relieves the client of having to depend on the concrete class of the product in order to create it AbstractProduct p = new ConcreteProduct() ; is replaced by AbstractProduct p = creator.create() ; In effect the creator is a strategy for creating products. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 19

Builder Pattern Reuse a parser (or other client) with multiple representations. The interface between the parser and the representation is defined. A generalization of the Factory Method. Whereas, in the factory method, it only takes one call to build the product, with the builder, multiple calls are used in sequence to build the product. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 20

The Builder Pattern The Builder object typically may be the product. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 21

Other Patterns Abstract Factory Create families of objects via an interface Singleton Ensure a class only has one instance Adapter Change the interface without changing funtionality Façade Provide a single interface to a set of objects T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 22

Other Patterns Iterator Give sequential access to the items of a collection without exposing its representation Mediator Use an object to mediate all interaction between two or more other objects Template Method Vary details of algorithm by filling in abstract methods Strategy Configure objects with strategy objects that encapsulate different policies T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 23

Single Responsibility Principle (SRP) A class should only have one reason to change Consequently most changes will affect only a small proportion of your classes T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 24

Open / Closed Principle Software entities (classes, modules, functions etc) should be open for extension but closed for modification Design software entities so that future changes on an axis require no modification Consider the template method pattern and strategy pattern T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 25

Refactoring Respond to change by first improving the structure of the software so that the portion that is not affected is isolated from change on the axis. Then accommodate the change. I.e. first restructure according to the SRP, the IHP, and the OCP. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 26

Liskov Substitution Principle (LSP) If S is a subtype of T, objects of type S should behave as objects of type T, if they are treated as objects of type T Each type T has two interfaces Direct Interface: What the client can expect of x, if x is known to be a direct instance of T Indirect Interface: What the client can expect of x, if x is known to be a (possibly indirect) instance of T The LSP can be understood as saying that the code of S should respect the indirect interface of S and all supertypes T of S The direct interface should be documented, but may (usually) be discovered from the code, The indirect interface must be documented. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 27

Dependence Inversion Principle (DIP) a. High-level modules should not depend on low-level modules. Both should depend on abstractions. b. Abstractions should not depend on details. Details should depend on abstractions. Whereas (package) dependence usually follows the direction of the calls, the DIP suggest otherwise T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 28

DIP Server Server Layer Client Layer Client Server Interface The DIP is crucial to reusable frameworks. The DIP supports the OCP by making the client open to changes of the server The DIP requires the LSP so that the client can depend on properties of the server without depending on a specific server. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 29

DIP and Frameworks Generic Framework Generic Framework <<calls>> Application Specific <<calls>> Application Specific Object Structure for a Framework Class Structure for a Framework T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 30

Specifications Contracts for methods Contracts for objects Clear box. Contracts are in terms of the actual state of the objects Inheritance: LSP Preconditions may be weakened. Postconditions may be strengthened. Black box. Contracts are in terms of abstract (model) states. Automated verification Modern tools can verify respect for contracts. T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 31

The End Go forth and create marvels T. S. Norvell Engineering 5895 Memorial University Lecture Summary Slide 32