K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 9: Collaboration synthesis Topics: –Composition of existing collaborations.

Slides:



Advertisements
Similar presentations
Design, prototyping and construction
Advertisements

CHOOSING A RESEARCH PROJECT © LOUIS COHEN, LAWRENCE MANION, KEITH MORRISON.
18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Human Computer Interaction
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 1: Program fragments and abstract classes Topics: –Economics of software.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 2: Abstract classes and composite structures Topics: –Elaboration of.
Creating Architectural Descriptions. Outline Standardizing architectural descriptions: The IEEE has published, “Recommended Practice for Architectural.
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.
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
K. Stirewalt CSE 335: Software Design Outline of course topics Foundational OO concepts Synthetic concepts: –Program families, program fragments, and abstract.
1 CS1001 Lecture Overview Object Oriented Design Object Oriented Design.
Meaningful Learning in an Information Age
K. Stirewalt CSE 335: Software Design Software architecture and larger system design issues Lecture 1: Simulating concurrency Topics: –High-level software.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Distribution of Marks Internal Sessional Evaluation Assignments – 10 Quizzes – 10 Class Participation Attendence – 5 Mid – Term Test – 25 External Evaluation.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Abstraction: Polymorphism, pt. 1 Abstracting Objects.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
Design Patterns.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Software Engineering Reuse.
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
CSE 303 – Software Design and Architecture
OHTO -99 SOFTWARE ENGINEERING “SOFTWARE PRODUCT QUALITY” Today: - Software quality - Quality Components - ”Good” software properties.
Understanding User Requirements. Documenting Use Cases 2 At this stage of the exploration, the participants should be thinking of essential use cases.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Introduction To System Analysis and Design
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
1 Software Process Models-ii Presented By; Mehwish Shafiq.
Software Design Deriving a solution which satisfies software requirements.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 1: Program fragments and abstract classes Topics: –Economics of software.
GRASP: Designing Objects with Responsibilities
Sept. 18, 2003CS WPI1 CS 509 Design of Software Systems Lecture #3 Thursday, Sept. 18, 2003.
240 3/30/98 CSE 143 Object-Oriented Design [Chapter 10]
CS 4850: Senior Project Fall 2014 Object-Oriented Design.
Aspect-Oriented Requirements Engineering David Schaefer, Joao Araujo, Isabel Brito, Awais Rashid, Claudia Mesquita.
1 Capturing Requirements As Use Cases To be discussed –Artifacts created in the requirements workflow –Workers participating in the requirements workflow.
Software Engineering Design & UML.
1 A Brief Introduction to Design Patterns Based on materials from Doug Schmidt 1.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 8: Modeling & documenting collaborations Topics: –Synthesis of multiple.
Abstraction ADTs, Information Hiding and Encapsulation.
Human Computer Interaction
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Design Pattern Catalog - Page L3-1 PS95&96-MEF-L10-1 Dr. M.E. Fayad Creationa.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 6: Using Design Patterns.
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
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.
Lecture 14 22/10/15. The Object-Oriented Analysis and Design  Process of progressively developing representation of a system component (or object) through.
Task Analysis Lecture # 8 Gabriel Spitz 1. Key Points  Task Analysis is a critical element of UI Design  It describes what is a user doing or will.
Task Analysis Lecture # 8 Gabriel Spitz 1. Key Points  Task Analysis is a critical element of UI Design  It specifies what functions the user will need.
Session 7 Introduction to Inheritance. Accumulator Example a simple calculator app classes needed: –AdderApp - contains main –AddingFrame - GUI –CloseableFrame.
Overview Prototyping Construction Conceptual design Physical design Generating prototypes Tool support.
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
1 Using const in C++ Classes In the presence of pointers we must take steps to ensure the integrity of the object Can use const method definitions The.
K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 1: Program fragments and abstract classes Topics: –Economics of software.
Software Development Life Cycle. The Software Life Cycle  Encompasses all activities from initial analysis until end of work  Formal process for software.
Chapter 33 Introduction to the Nursing Process
Object-Oriented Analysis and Design
Chapter 5:Design Patterns
A Brief Introduction to Design Patterns
Distribution and components
Object-Oriented Design
Design Tips.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Presentation transcript:

K. Stirewalt CSE 335: Software Design Synthetic OO Design Concepts & Reuse Lecture 9: Collaboration synthesis Topics: –Composition of existing collaborations to define more complex collaborations –The need to be “conscious” of design alternatives –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 Documenting collaborations Collaborations documented via: –Collaboration diagram Declares two or more roles to which application objects will be bound to participate in collaboration Depicts connectors required between objects that play the various roles –One or more sequence diagrams Each diagram depicts a meaningful interaction among the roles, i.e., a single behavior. Most collaborations require multiple sequence diagrams to document their behavior sufficiently

K. Stirewalt CSE 335: Software Design Recall from last time Exercise: Integrate a scrollbar object into the Viewport–DocManager collaboration.

K. Stirewalt CSE 335: Software Design Scrollbar–listener collaboration l : ValuatorListener [0..*]sb : ScrollBar listens Scrollbar – Listener

K. Stirewalt CSE 335: Software Design Behavior of Scrollbar–Listener collaboration userEvent() announceNewValue(n) : ScrollBarlistener : ValuatorListener sd moveHandle

K. Stirewalt CSE 335: Software Design Designing composite collaborations Composite collaborations must be designed Strategy: –Model concrete interactions in this new collaboration E.g., sequence diagram illustrating what should happen when user drags the slider to new position In this context, design sketches are sufficient –Create roles of the new collaboration by synthesizing the roles of existing (and possibly some new) collaborations Sometimes, an entire application can be modeled as a (large) composite collaboration

K. Stirewalt CSE 335: Software Design Design sketch (alternative #1) vp : …sb : …dm : … announceNewValue(X) update() retrieve(0,...)getLine(X, …) retrieve(n,...)getLine(X+n, …) … userEvent() announceNewValue(X) sd design1

K. Stirewalt CSE 335: Software Design Sketches are necessarily incomplete... vp : …sb : …dm : … announceNewValue(X) update() retrieve(0,...)getLine(X, …) retrieve(n,...)getLine(X+n, …) … userEvent() announceNewValue(X) sd design1 Note: Class names elided

K. Stirewalt CSE 335: Software Design Design sketches When designing a new collaboration, often helpful to defer some design decisions –E.g., actual class of the participants that are interacting OK in the early stages of design, as we may end up designing a reusable collaboration, in which case the participants are roles rather than objects –E.g., names/signatures of messages OK in the early stages, as these names/signatures are highly dependent upon the protocol we end up adopting, and we might wish to explore lots of alternatives before choosing! Design tip: Use the notations as precisely as possible, but elide details that are likely to change while exploring alternatives

K. Stirewalt CSE 335: Software Design Design sketch (alternative #2) vp : …sb : …dm : … announceNewValue(X) update() retrieve(0,...) getLine(X, …) retrieve(n,...) getLine(X+n, …) … userEvent() ??? sd design2

K. Stirewalt CSE 335: Software Design Another note on sketchiness... vp : …sb : …dm : … announceNewValue(X) update() retrieve(0,...) getLine(X, …) retrieve(n,...) getLine(X+n, …) … userEvent() ??? sd design2 Note: Message name/signature elided

K. Stirewalt CSE 335: Software Design Questions Is one alternative “better” than the other? What criteria might we use to evaluate these two alternatives? Can you envision any other alternatives?

K. Stirewalt CSE 335: Software Design Evaluating a design Often, there is no “best” design in the abstract What makes a design “good” is its fitness to the purpose and clientele for which it was intended –A superior design in one context might be inferior in another –Your chances of “stumbling” onto the superior design for your context are miniscule if you don’t understand the context Thus: –Design process should begin with a clear understanding of context (requirements) –Design decisions should be reflective and deliberate and should be justifiable in terms of (traceable back to) this context (requirements)

K. Stirewalt CSE 335: Software Design Exercise Critique each of the afore-mentioned designs by listing “pros” and “cons” of each. General hints: –look for difficulties a user might encounter while using the code that implements each design –look for obstacles to verification/testing –look for long-term maintenance “gotchas” –look for possible performance problems

K. Stirewalt CSE 335: Software Design Example “Con” Both design alternatives place the “knowledge” of the offset (and the responsibility for retrieving lines using the offset) in the document manager object Potential problems: –Limits the reusability of the scrollbar and viewport in isolation---this might be a useful composite collaboration, which we should carefully design and test –Makes configuration difficult

K. Stirewalt CSE 335: Software Design Design sketch (alternative #3) vp : …sb : …vpm : …dm : … announceNewValue(X) update() retrieve(0,...)getLine(X, …) retrieve(n,...) getLine(X+n, …) … userEvent() announceNewValue(X) sd design3

K. Stirewalt CSE 335: Software Design Design sketch (alternative #3) vp : …sb : …vpm : …dm : … announceNewValue(X) update() retrieve(0,...)getLine(X, …) retrieve(n,...) getLine(X+n, …) … userEvent() announceNewValue(X) sd design3 Note: Invented a new role to “localize” knowledge of the machinery to retrieve lines using offsets

K. Stirewalt CSE 335: Software Design Design sketch (alternative #4) vp : …sb : …vpm : …dm : … announceNewValue(X) update() retrieve(0,...)getLine(X, …) retrieve(n,...) getLine(X+n, …) … userEvent() ??? sd design4

K. Stirewalt CSE 335: Software Design Exercise Synthesize a class MyVpModel from which we could instantiate objects that play the vpm role in the new collaboration.

K. Stirewalt CSE 335: Software Design Classes ViewPort and ViewPortModel 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(); }; class ViewPortModel { public: virtual bool retrieve( unsigned lineNumber, string& line ) const =0; };

K. Stirewalt CSE 335: Software Design Synthesis of collaborations Defn: The process of constructing a new collaboration by composing multiple smaller collaborations Process: –Gather together all constituent collaborations –Group together roles to should be played by the same object (alternatively the new role) in the new collaboration –For each new type of object (role), create an adaptor class to synthesize the role classes in the group for that object –Document structure of new collaboration in a collaboration diagram and its behavior in one or more sequence diagrams

K. Stirewalt CSE 335: Software Design Synthesis: (1) align collaborations : ViewPort: ViewPortModel : ScrollBar : DocManager : ValuatorListener model dm listens : ValuatorListener listens sb vpvpm dm

K. Stirewalt CSE 335: Software Design Synthesis: (2) group roles to be played by same object : ViewPort: ViewPortModel : ScrollBar : DocManager : ValuatorListener model dm listens : ValuatorListener listens sb vpvpm dm

K. Stirewalt CSE 335: Software Design Synthesis: (3) adaptor classes class MyViewPort : public ValuatorListener, public ViewPort { … void announceNewValue( unsigned ) { ViewPort::update(); } }; class MyVpModel : public ValuatorListener, public ViewPortModel { public: MyVpModel( DocManager*, … ) … {} // adapt operations … protected: unsignedoffset; DocManager*dm; };

K. Stirewalt CSE 335: Software Design Synthesis (4) model new collaboration vp : MyViewPort vpm : MyVpModelsb : ScrollBardm : DocManager model fm listens ScrollableDocumentViewer

K. Stirewalt CSE 335: Software Design Synthesis (5): Write config. code ScrollBar sb( … ); MyViewPort vp( … ); FileManager fm( … ); MyVpModel vpm(&fm, … ); sb.registerListener(&vpm); sb.registerListener(&vp); vp.setModel(&vpm); } Note: Uses knowledge about the order in which sb notifies its registered listeners. Inferred from collaboration and sequence diagrams.

K. Stirewalt CSE 335: Software Design Exercise Might it make sense for a ViewPort to act as its own ViewPortModel? Draw a sequence diagram to model the interaction with the scrollbar and the document manager assuming such a design.

K. Stirewalt CSE 335: Software Design Exercise Suppose we now want to add a reset button to the assembly. Pressing the button should clear the file. Obviously, the viewport should reflect that the file is empty. Draw a sequence diagram that illustrates this collaboration.

K. Stirewalt CSE 335: Software Design Design methodologies Role–collaboration based design is an example of a design methodology: –Tells you “how to think” by suggesting sorts of code structures and properties that you should value. –Provides new concepts for thinking about and organizing these valuable structures and properties. E.g., roles and collaborations, listeners and models, etc. –Strategies for reifying these concepts in code Often provide mechanical methods for composing systems from parts

K. Stirewalt CSE 335: Software Design Discussion question Why is it important to be given guidance on “what to value” when you design a system?

K. Stirewalt CSE 335: Software Design Discussion (continued) There is no perfect design! Design is always about trade-offs and priorities: –E.g., extensibility is often at odds with efficiency –Which is more valuable depends on the problem E.g., in a weather simulation, efficiency is valued more highly than extensibility –Methodologies codify priorities and provide guidance in designing software that supports them

K. Stirewalt CSE 335: Software Design Follow-up question Why is it important to fix on design priorities early? Answers (non-exhaustive): –Often difficult to know “where to begin,” especially for less experienced programmers. –Most real programs designed in teams; if team members disagree on the priorities, their code will likely not interoperate. –Extremely expensive to re-engineer a corpus of code when an important priority is discovered late in the process.