Lecture 4: Observer Pattern, Event Library and Componentization

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

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

UNIT I Introduction to Design Patterns

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

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

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

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

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

UNIT I Introduction to Design Patterns

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

Using Design Patterns in Java Application Development

Lecture 7: Visitor, Strategy, State, Chain of Responsibility, Command

Software Architecture

Applying Design Patterns to SCA Implementations

SDC Design patterns GoF

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

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

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

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

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

DESIGN PATTERN - INTERVIEW QUESTIONS

Design Patterns. An introduction

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

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

Design Patterns: Structural and Behavioural

Object-oriented Software Design Patterns

INSTITUTE OF AERONAUTICAL ENGINEERING

Applying the Observer Design Pattern

Software Development Project. Kazi Masudul Alam

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

TDDB84. Lecture 2. fredag 6 september 13

C++ for System Developers with Design Pattern

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

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

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

Application Architectures, Design Patterns

I, J. Key-value observing (KVO), Label component, 32 text property, 39

TDDB84: Lecture 6. Adapter, Bridge, Observer, Chain of Responsibility, Memento, Command. fredag 4 oktober 13

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

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

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

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

A Reconnaissance on Design Patterns

1 Software Architecture

A Case Study of Gang of Four (GoF) Patterns: Part 3

CSSE 374: More Object Design with Gang of Four Design Patterns

Tuesday, October 4. Announcements

DESIGN PATTERNS MOCK TEST DESIGN PATTERNS MOCK TEST II

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

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

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

A few important patterns and their connections

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

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

CS251 Software Engineering Lectures 18: Intro to DP

Pro Objective-C Design Patterns for ios

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

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

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

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

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

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

Design patterns. Jef De Smedt Beta VZW

Overview of Patterns: Introduction

CS/CE 2336 Computer Science II

Review Software Engineering October, 7, Adrian Iftene

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

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

Object Oriented Paradigm

Applying the Decorator Design Pattern

Object-Oriented Oriented Programming

Software Engineering I (02161)

A Metric of the Relative Abstraction Level of Software Patterns

Object-Oriented Design

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

A Rapid Overview of UML

Lecture 20: Design Patterns II

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

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

Extensibility Design Patterns From The Initial Stage of Application Life-Cycle

Chapter 8, Design Patterns Visitor

A Metric for Measuring the Abstraction Level of Design Patterns

Information systems modelling UML and service description languages

Design patterns generic models

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

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

A Primer on Design Patterns

From Patterns to Components: The Factory Library Example

TDDB84: Lecture 09. SOLID, Language design, Summary. fredag 11 oktober 13

Applying Some Gang of Four Design Patterns CSSE 574: Session 5, Part 3

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

Software Eningeering. Lecture 9 Design Patterns 2

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

COSC 3351 Software Design. Design Patterns Behavioral Patterns (I)

Design patterns. OOD Lecture 6

Design Patterns Lecture 2

Creational Design Patterns

CS 247: Software Engineering Principles. Design Patterns

Advanced C++ Programming Workshop (With C++11, C++14, C++17) & Design Patterns

Transcription:

Software Architecture Bertrand Meyer & Till Bay ETH Zurich, February-May 2008 Lecture 4: Observer Pattern, Event Library and Componentization Program overview Date Topic Who? last week Introduction; A Basic Architecture Example Till 26. Feb. Modularity and reusability; Abstract Data Types Till 4. Mar. Project description and Delta Debugging Jason, Andy Today Patterns 1: observer + event library, componentization Till 18. Mar. Design by Contract Prof. Meyer 25. Mar. No course :-) 1. Apr. Patterns 2: visitor, strategy, state, chain of responsibility Till 8. Apr. Patterns 3: factory, builder, singleton Till 15. Apr. Patterns 4: bridge, composite, decorator, facade Michela 22. Apr. Patterns 5: Wrap up Till 29. Apr. Language constructs for mod. and info. hiding Till Program overview Date Topic Who? 6. May Exception handling Martin 13. May Concurrent programming Jason 20. May Project presentation Everybody 27. May Exam Everybody Exercises overview Date Topic 28. Feb. Abstract Data Types 3. Apr. Design by Contract 8. May Exception Handling Rest Project

design patterns? [Design Patterns] are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context. Design Patterns, GOF hierarchy of reuse Library Bottleneck Language Wizard / Tool Design Pattern Documented Solution Communicated Solution ( CutʼnʼPaste ) Ad-hoc Solution reuse and quality Reuse Reuse increases quality Only by reuse, the extra effort of quality pays off Given enough eyeballs, all bugs are shallow (Eric Raymond) Quality increases reuse Understandable Trust gained by quality Quality

Some design patterns Creational Abstract Factory Builder Factory Method Prototype Singleton Structural Adapter Bridge Composite Decorator Façade Flyweight Proxy Behavioral Chain of Responsibility Command (undo/redo) Interpreter Iterator Mediator Memento Observer State Strategy Template Method Visitor Observer Pattern Observers or subscribers or subject, or publisher A = 50% B = 30% C = 20% Observed observer pattern Loose coupling between caller and call target. Implement a publish-subscribe and MVC architecture.

observer pattern SUBJECT observers LIST[] CONCRETE_ SUBJECT CONCRETE_ observer example CLICKABLE observers LIST[] CLICK_ BUTTON ON_CLICK_ ACTION observer as library SUBJECT event_x EVENT_TYPE Library class target ( agent ) subscribers Language feature

EVENT_TYPE class EVENT_TYPE [G -> TUPLE] feature -- Subscription subscribers: LIST [ [ANY, G]] subscribe (an_action: [ANY, G]) -- Add `an_actionʼ to the subscription list. require not_void: an_action /= Void ensure subscribed: subscribers.has (an_action) feature -- Publish publish (arguments: G) -- Publish event with `argumentsʼ. require not_void: arguments /= Void events in MVC class DATABASE feature -- Slots remove_customer is class BUTTON feature -- Signals clicked: EVENT_TYPE [TUPLE []] gui_remove_button.clicked.subscribe (agent db.remove_customer) dropping arguments class DATABASE feature -- Slots remove_customer is TUPLE[] class BUTTON TUPLE[INTEGER] feature -- Signals clicked: EVENT_TYPE [TUPLE [INTEGER]] gui_remove_button.clicked.subscribe (agent db.remove_customer)

type system caveat 1 [ANY,TUPLE[INTEGER]] not [ANY,TUPLE[ANY]] print (what:any) clicked: EVENT_TYPE [TUPLE [INTEGER]] clicked.subscribe (print (?)) Does not type check! type system caveat 2 [ANY,TUPLE[ANY]] print_integer (v: INTEGER) network.received: EVENT_TYPE [TUPLE [ANY]] [ANY,TUPLE[INTEGER]] received.subscribe (print_integer (?)) Compiles with type error (CAT call!) observer: summary Not needed as pattern Language powerful enough (agents, generics, tuple) to implement as library Available library classes: ACTION_SEQUENCE (used by Vision2) EVENT_TYPE (early implementation at ETH) Not yet in GOBO GOBO did support compilers w. o. agents will change in the future

End of lecture 4