K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 8: Modeling & documenting collaborations Topics: –Synthesis of multiple.

Slides:



Advertisements
Similar presentations
Chapter 13 Application Framework. Outline Definition & anatomy Fulfilling the framework contract Building frameworks Examples.
Advertisements

K. Stirewalt CSE 335: Software Design Synthetic OOD concepts and reuse Lecture 4: Separation of concerns Topics: –Complex concern: Memory management –
UML (Sequence Diagrams, Collaboration and State Chart Diagrams) Presentation By - SANDEEP REDDY CHEEDEPUDI (Student No: ) - VISHNU CHANDRADAS (Student.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Introduction To System Analysis and Design
1 Software Testing and Quality Assurance Lecture 26 (a) – Testing Interactions (Chapter 6)
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Lecture 4 Class Responsibility Collaboration Cards
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Advanced Object-Oriented Programming Features
Unified Modeling Language (UML)
K. Stirewalt CSE 335: Software Design Foundations: Language Mechanisms and Primitive OO Concepts Lecture 2: Polymorphism Topics: – Polymorphism and virtual.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 2: Abstract classes and composite structures Topics: –Elaboration of.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 7: Roles and Collaborations Topics: – Interactive applications, their.
E. Kraemer CSE 335: Software Design Administrivia Exam 2 : Wednesday, March pm Room: TBA Wed, March 12th - exam outline in class Mon, March 17th.
C++ Training Datascope Lawrence D’Antonio Lecture 11 UML.
K. Stirewalt CSE 335: Software Design Outline of course topics Foundational OO concepts Synthetic concepts: –Program families, program fragments, and abstract.
© Copyright Eliyahu Brutman Programming Techniques Course.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 9: Collaboration synthesis Topics: –Composition of existing collaborations.
K. Stirewalt CSE 335: Software Design Software architecture and larger system design issues Lecture 1: Simulating concurrency Topics: –High-level software.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 5: Mixins and reusable strategies Topics: – More on the use of mixins.
Foundations: Language Mechanisms and Primitive OO Concepts Lecture 3: Introduction to OO Modeling E. Kraemer adapted from K. Stirewalt.
K. Stirewalt CSE 335: Software Design Software Architecture and Larger System Design Issues Lecture 4: Life cycles of concurrent actors Topics: –The “life.
Sharif University of Technology Session # 7.  Contents  Systems Analysis and Design  Planning the approach  Asking questions and collecting data 
Unified Modeling Language
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
Design Patterns.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
An Introduction to Software Architecture
Introduction To System Analysis and Design
Object-Oriented Analysis and Design An Introduction.
Odyssey A Reuse Environment based on Domain Models Prepared By: Mahmud Gabareen Eliad Cohen.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
UML diagrams What is UML UML diagrams –Static modeoing –Dynamic modeling 1.
ניתוח מערכות מידע 1 Unified Modeling Language (UML) § § The Unified Modeling Language (UML) is the industry-standard language for: Specifying, Visualizing,
CBSE 2014 Modeling Components with UML. Bibliography Modelling components in UML – Main text: Kim Hamilton, Russell Miles, Learning UML 2.0, OReilly,
UML as a Specification Language for Embedded Systems. By, Mir Ahmed Ali, Asst. Professor, ECM department, SNIST. By, Prof. Narsiah sir, Director of School.
Design Jon Walker. More UML ● What is UML again?
Domain Classes – Part 1.  Analyze Requirements as per Use Case Model  Domain Model (Conceptual Class Diagram)  Interaction (Sequence) Diagrams  System.
Software Engineering Lecture 8 Object-Oriented Analysis.
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
Foundations: Language mechanisms and primitive OO concepts Lecture 1: Classification and Inheritance Michigan State University Spring 2008 E. Kraemer Notes.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 5: Mixins and reusable strategies Topics: – More on the use of mixins.
22 August, 2007Information System Design IT60105, Autumn 2007 Information System Design IT60105 Lecture 8 Use Case Diagrams.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 15. Review Interaction-Oriented Software Architectures – MVC.
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Appendix Object-Oriented Analysis and Design: Use Cases and Sequence Diagrams Modern Systems Analysis and Design Fifth Edition Jeffrey A. Hoffer Joey F.
CS 501: Software Engineering Fall 1999 Lecture 15 Object-Oriented Design I.
Object Oriented Analysis & Design By Rashid Mahmood.
WELCOME TO OUR PRESENTATION UNIFIED MODELING LANGUAGE (UML)
UML AN OVERVIEW. Topics covered in this Session 1. Introducing UML. 2. What constitutes the UML. 3. Concepts of UML.
R R R CSE870: UML Component Diagrams Implementation Diagrams.
1 Lecture Material Design Patterns Visitor Client-Server Factory Singleton.
Microsoft Foundation Classes MFC
UML Diagrams By Daniel Damaris Novarianto S..
Unified Modeling Language
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Dynamic Modeling of Banking System Case Study - II
UML Diagrams Jung Woo.
UML dynamic Modeling (Behavior Diagram)
Object-Oriented Design
Interaction diagrams.
SYS466 Domain Classes – Part 1.
An Introduction to Software Architecture
CIS 375 Bruce R. Maxim UM-Dearborn
Design.
Presentation transcript:

K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 8: Modeling & documenting collaborations Topics: –Synthesis of multiple collaborations –Documenting collaborations with abstract roles –A “model” of reuse in role-based designs

K. Stirewalt CSE 335: Software Design New concepts Collaboration: Contextual relationship among instances that interact to implement a desired functionality –pattern of message exchange among those instances to achieve some goal –protocol Role: that subset of an object’s characteristics needed to fulfill its responsibilities in a collaboration –alternatively, a “slot” that can be filled by objects that wish to participate in the collaboration –such objects are said to “play” the role Observe: Both definitions refer to instances Goals: 1.Design reusable collaborations 2.Compose applications by synthesizing collaborations

K. Stirewalt CSE 335: Software Design Example Suppose we want to design a graphical browser that allows users to view and print documents Two collaborations here: 1.A viewPort that displays lines of text, which it receives by collaborating with a docMgr ; and 2.A printButton that sends messages to docMgr to cause it to print. Observe: –docMgr object is involved in both collaborations –It plays a different role in each

K. Stirewalt CSE 335: Software Design Graphical depiction of example app #ifndef VIEWPORT_H #define VIEWPORT_H #include <FL/Fl_Multiline #include “ViewPortModel.h class ViewPort : public public: ViewPort( int x, int y, unsigned numberOfLines Print Note: The unseen document manager is serving lines from file “ViewPort.h”

K. Stirewalt CSE 335: Software Design Motivation: Explaining a design Modern OO systems comprise lots of collaborations To understand such systems, requires visualizing: –the inter-connection of these objects (i.e., structure) –the dynamic interactions among these objects (i.e., behavior) Problem: How can we visualize these phenomena in a useful way?

K. Stirewalt CSE 335: Software Design Sequence diagrams Illustrate one instance of one collaboration among multiple objects Feature: –Use of spatial position to reflect time dimension –Use of vertical bars to denote object “activity” –Graphic denotation of returns from operations Note: Because it depicts only one instance, a single sequence diagram rarely sufficient to fully document a collaboration

K. Stirewalt CSE 335: Software Design Example sequence diagram userEvent() buttonPressed(“Print”) print : ButtondocMgr : MyDocManager sd clickPrint printDocument()

K. Stirewalt CSE 335: Software Design Example sequence diagram (continued) userEvent() buttonPressed(“Print”) print : ButtondocMgr : MyDocManager sd clickPrint printDocument() activations

K. Stirewalt CSE 335: Software Design Example sequence diagram (continued) userEvent() buttonPressed(“Print”) print : ButtondocMgr : MyDocManager sd clickPrint printDocument() messages

K. Stirewalt CSE 335: Software Design Example sequence diagram (continued) userEvent() buttonPressed(“Print”) print : ButtondocMgr : MyDocManager sd clickPrint printDocument() return messages

K. Stirewalt CSE 335: Software Design New concept: Role Defn: A “slot” that can be filled by many different object (or link) instances Example: The ButtonListener “object” in a design that uses buttons –Not really any such thing as a ButtonListener “object” –But lots of objects can be “plugged into” that slot. Design tip: Identification of roles enables the design of reusable collaborations

K. Stirewalt CSE 335: Software Design Reusable interaction, defined using a role userEvent() buttonPressed(…) : Buttonlistener : ButtonListener sd clickButton

K. Stirewalt CSE 335: Software Design Instance of an abstract class? userEvent() buttonPressed(…) : Buttonlistener : ButtonListener sd clickButton Notice: OK to depict what appears to be an “instance” of an abstract class in this situation

K. Stirewalt CSE 335: Software Design Collaboration diagram listener : ButtonListener [0..*]button : Button listeners Button–ButtonListener Example of a collaboration diagram.

K. Stirewalt CSE 335: Software Design Collaboration diagram listener : ButtonListener [0..*]button : Button listeners Button–ButtonListener Example of a collaboration diagram. role role nametypemultiplicityrole nametype connector

K. Stirewalt CSE 335: Software Design Collaboration + seq diagrams A reusable collaboration is specified using: –One collaboration diagram that names all of the roles and connectors and specifies any relevant multiplicities –Multiple sequence diagrams, each depicting a “key” behavior among the objects that and links that play roles in the collaboration Such documentation much more useful than “header” comments in the code

K. Stirewalt CSE 335: Software Design Another useful collaboration Viewport–ViewPortModel

K. Stirewalt CSE 335: Software Design Recall the running example... #ifndef VIEWPORT_H #define VIEWPORT_H #include <FL/Fl_Multiline #include “ViewPortModel.h class ViewPort : public public: ViewPort( int x, int y, unsigned numberOfLines Print Note: The unseen document manager is serving lines from file “ViewPort.h”

K. Stirewalt CSE 335: Software Design Exercise Draw a sequence diagram that depicts the interaction between a viewport object (vp) and a DocumentManager object (docMgr) when vp is resized

K. Stirewalt CSE 335: Software Design Example: Class DocManager class DocManager { public: … void printDocument() const; unsigned docSize() const; const string& docLine( unsigned ) const; void insertLine( unsigned, const string& ); void appendLine( const string& ); void deleteLine( unsigned ); };

K. Stirewalt CSE 335: Software Design Example: Sequence diagram docMgr : MyDocManagervp : ViewPort resize() retrieve( 0,.... ) docSize() docLine(0,...) update() retrieve( 1,.... ) docLine(1,...) retrieve( n-1,.... ) docLine(n-1,...) docSize() sd resizeView

K. Stirewalt CSE 335: Software Design Question Consider the interaction between the document manager and a viewport that displays its contents. Are there any opportunities for role abstraction in this interaction?

K. Stirewalt CSE 335: Software Design When vp collaborates with a docMgr... docMgr : MyDocManagervp : ViewPort resize() retrieve( 0,.... ) docSize() docLine(0,...) update() retrieve( 1,.... ) docLine(1,...) retrieve( n-1,.... ) docLine(n-1,...) docSize() sd resizeView

K. Stirewalt CSE 335: Software Design More general (reusable) interaction using the abstract role “model” update() retrieve(n) * : ViewPortmodel : ViewPortModel sd refreshView

K. Stirewalt CSE 335: Software Design Collaboration diagram vpm : ViewPortModelvp : ViewPort model ViewPort–ViewPortModel Example of a collaboration diagram.

K. Stirewalt CSE 335: Software Design Reusable class ViewPort class ViewPort : public Fl_Multiline_Output { public: ViewPort( int x, int y, int w, int h ); unsigned capacity() const; void setModel( ViewPortModel* ); protected: ViewPortModel* model; void resize(int, int, int, int); void update(); }; Question: Why is this method protected, rather than public?

K. Stirewalt CSE 335: Software Design ViewportModel interface class ViewPortModel { public: virtual bool retrieve( unsigned lineNumber, string& line ) const =0; };

K. Stirewalt CSE 335: Software Design Example: ViewPort::Update method void ViewPort::update() { if (!model) return; string contents, str; const string endofline("\n"); for (int i=0; i < upperBound; i++) { if( model->retrieve(i, str) ) { contents += str; contents += endofline; } value(contents.c_str()); }

K. Stirewalt CSE 335: Software Design Example: Synthesis of multiple roles class MyDocManager : public DocManager, public ButtonListener, public ViewPortModel { public: void buttonPressed( const string& s ) { if(s == “print”) DocManager::printDocument(); } bool retrieve( unsigned lineNo, string& line ) const { bool retVal = (lineNo < DocManager::docSize()); if (retVal) line = DocManager::docLine(lineNo); return retVal; } };

K. Stirewalt CSE 335: Software Design Configuration code int main(void) { ContainerWindow myContainer(500,150); MyDocManager docMgr(...); Button printButton(200, 80, “Print"); ViewPort viewPort(0,0, 350, 120); printButton.addListener(&docMgr); viewPort.setModel(&docMgr); myContainer.end(); myContainer.show(); return Fl::run(); }

K. Stirewalt CSE 335: Software Design Terminology Collaboration: Contextual relationship among instances that interact to implement a desired functionality Collaboration diagram: A diagram describing the structural relationship among the roles in a collaboration Collaboration role: A “slot” for an object or link within a collaboration. It specifies the kind of object or link that may appear in an instance of the collaboration.

K. Stirewalt CSE 335: Software Design ScrollBar collaboration userEvent() announceNewValue(n) : ScrollBarlistener : ValuatorListener sd moveHandle

K. Stirewalt CSE 335: Software Design Exercise Integrate a scrollbar object into our viewport – docManager collaboration. Draw a sequence diagram to illustrate what happens when the user drags the slider handle to a new position.