60-322 Object-Oriented Analysis and Design Feb 11, 2009.

Slides:



Advertisements
Similar presentations
Chapter 15 UML Interaction Diagrams 1CS6359 Fall 2012 John Cole.
Advertisements

©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
Interaction Diagram Notation From Chapter 15 of Craig Larman, Applying UML and Patterns John Dalesandro.
Object-Oriented Analysis and Design
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Chapter 15 Interaction Diagrams. Most Common Sequence Diagram Communication Diagram Sequence Diagrams illustrate interactions between classes of a program.
Unified Modeling Language (UML)
SE-565 Software System Requirements More UML Diagrams.
Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s.
Object-Oriented Analysis and Design
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Object-Oriented Design. From Analysis to Design Analysis Artifacts –Essential use cases What are the problem domain processes? –Conceptual Model What.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
An Object-Oriented Approach to Programming Logic and Design
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
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.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
1 On to Object Design Chapter 14 Applying UML and Patterns.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
Object-Oriented Analysis and Design Feb 25, 2009.
Systems Analysis and Design in a Changing World, 3rd Edition
Copyright © Hsiao-Lan Wei All Rights Reserved Design Model Interaction diagram.
Starting Object Design
Chapter 4: UML Interaction Diagrams. Objective Provide a reference for frequently used UML interaction diagram notation- sequence and communication diagrams.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Design Class Diagrams (DCDs)
Chapter 16 Applying UML and Patterns Craig Larman
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
What to remember from Chap 13 (Logical architecture)
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
DOMAIN MODEL: ADDING ATTRIBUTES Identify attributes in a domain model. Distinguish between correct and incorrect attributes.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
1 Class Diagrams. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are for visualizing, specifying and documenting.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Collaboration diagrams. Purpose A collaboration diagram is an alternate way to show a scenario. A collaboration diagram shows the objects and relationships.
Chapter 16: UML Class Diagrams
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Chapter 16 UML Class Diagrams.
Chapter 3: Introducing the UML
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
Dr. Kivanc DincerCS319 Week 6 - Oct.17,20051 Chapter 14 Onto Object Design Objectives Understand dynamic and static object design modeling. Try agile modeling,
ITEC1301 Object-Oriented Systems Construction Lecture Notes #4 1.
UML Diagrams By Daniel Damaris Novarianto S..
The Movement To Objects
Design Class Diagrams
UML Interaction Diagrams
Object-Oriented Analysis and Design
Chapter 16 UML Class Diagrams.
Chapter 11: Collaboration Diagram - PART1
Design Class Diagrams
UML Diagrams Jung Woo.
Requirements To Design In This Iteration
System Sequence Diagrams
IMAT5205 Systems Analysis and Design
Unified Modelling Language
Class Diagrams.
Chapter 16 UML Class Diagrams
UML Interaction Diagrams
Presentation transcript:

Object-Oriented Analysis and Design Feb 11, 2009

2 We were discussing Object Design. There are two kinds of object models: dynamic and static. What's important is knowing how to think and design in objects, and apply object design best-practice patterns, which is a very different and much more valuable skill than knowing UML notation. The UML includes interaction diagrams to illustrate how objects interact via messages. They are used for dynamic object modeling. There are two common types: – sequence and communication interaction diagrams. Last lecture covered….

Feb 11, Diagram Frames in UML Sequence Diagram Basic Sequence Diagram Notation To support conditional and looping constructs (among many other things), the UML uses frames. Frames are regions or fragments of the diagrams; they have an operator or label (such as loop) and a guard(conditional clause).

Feb 11, Diagram Frames in UML Sequence Diagram Basic Sequence Diagram Notation

Feb 11, Diagram Frames in UML Sequence Diagram Basic Sequence Diagram Notation

Feb 11, Diagram Frames in UML Sequence Diagram Basic Sequence Diagram Notation

Feb 11, Diagram Frames in UML Sequence Diagram Basic Sequence Diagram Notation

Feb 11, How to Relate Interaction Diagrams Basic Sequence Diagram Notation

Feb 11, How to Relate Interaction Diagrams Basic Sequence Diagram Notation An interaction occurrence (also called an interaction use) is a reference to an interaction within another interaction. It is useful, for example, when you want to simplify a diagram and factor out a portion into another diagram, or there is a reusable interaction occurrence. UML tools take advantage of them, because of their usefulness in relating and linking diagrams.

Feb 11, How to Relate Interaction Diagrams Basic Sequence Diagram Notation They are created with two related frames: – a frame around an entire sequence diagram, labeled with the tag sd and a name, such as AuthenticateUser. – a frame tagged ref, called a reference, that refers to another named sequence diagram; it is the actual interaction occurrence. Guideline: – Any sequence diagram can be surrounded with an sd frame, to name it. Frame and name one when you want to refer to it using a ref frame

Feb 11, Message to Classes to Invoke Static Methods Basic Sequence Diagram Notation You can show class or static method calls by using a lifeline box label that indicates the receiving object is a class, or more precisely, an instance of a metaclass

Feb 11, Message to Classes to Invoke Static Methods Basic Sequence Diagram Notation

Feb 11, Polymorphic Messages and Cases Basic Sequence Diagram Notation Polymorphism is fundamental to OO design. How to show it in a sequence diagram? One approach is to use multiple sequence diagrams - one that shows the polymorphic message to the abstract super class or interface object, and then separate sequence diagrams detailing each polymorphic case, each starting with a found polymorphic message.

Feb 11, Polymorphic Messages and Cases Basic Sequence Diagram Notation

Feb 11, Ch 15.5 Basic Communication Diagram Notation - Link A link is a connection path between two objects; it indicates some form of navigation and visibility between the objects is possible. link More formally, a link is an instance of an association. For example, there is a link - or path of navigation - from a Register to a Sale, along which messages may flow, such as the makePayment message.

Feb 11, Message Each message between objects is represented with a message expression and small arrow indicating the direction of the message. Many messages may flow along this link. A sequence number is added to show the sequential order of messages in the current thread of control. Don't number the starting message. It's legal to do so, but simplifies the overall numbering if you don't.

Feb 11, Message to “self” or “this” A message can be sent from an object to itself. This is illustrated by a link to itself, with messages flowing along the link.

Feb 11, Creation of Instance The convention in the UML is to use a message named create for this purpose (some use new). If another (less obvious) message name is used, the message may be annotated with a UML stereotype, like so: «create». The create message may include parameters, indicating the passing of initial values. – This indicates, for example, a constructor call with parameters in Java. – Furthermore, the UML tagged value {new} may optionally be added to the lifeline box to highlight the creation. Tagged values are a flexible extension mechanism in the UML to add semantically meaningful information to a UML element.

Feb 11, :create(cashier) :Register:Sale create message,with optional initializing parameters.This will normally be interpreted as a constructor call. «create» 1:make(cashier) :Register:Sale if an unobvious creation message name is used,the message may be stereotyped for clarity 1:create(cashier) :Register:Sale{new} Three ways to show creation in a communication diagram The convention in the UML is to use a message named create for this purpose (some use new). If another (less obvious) message name is used, the message may be annotated with a UML stereotype, like so: «create».

Feb 11, Message Numbering The order of messages is illustrated with sequence numbers. The numbering scheme is: – The first message is not numbered. Thus, msg1 is unnumbered. – The order and nesting of subsequent messages is shown with a legal numbering scheme in which nested messages have a number appended to them. You denote nesting by prepending the incoming message number to the outgoing message number.

Feb 11, Message Numbering – A More Complex Case

Feb 11, Conditional Message You show a conditional message by following a sequence number with a conditional clause in square brackets, similar to an iteration clause. The message is only sent if the clause evaluates to true.

Feb 11, Mutually Exclusive Conditional Paths

Feb 11, Iteration or Looping

Feb 11, Iteration or Looping

Feb 11, Message to Classes to Invoke Static Methods Basic Sequence Diagram Notation You can show class or static method calls by using a lifeline box label that indicates the receiving object is a class, or more precisely, an instance of a metaclass

Feb 11, Messages to a Classes to Invoke Static (Class) Methods – Communication Diagram 1:locs=getAvailableLocales :Foo «metaclass» Calendar doX message to class,or a static method call

Feb 11, Polymorphic Messages and Cases Basic Sequence Diagram Notation

Feb 11, Polymorphic Messages–Communication Diagram :Register authorizedoX :Payment{abstract} polymorphic message object in role of abstract superclass :DebitPayment authorize :Foo stop at this point– don’t show any further details for this message separate diagrams for each polymorphic concrete case doA doB :CreditPayment authorize :Bar doX

Feb 11, The UML includes class diagrams to illustrate classes, interfaces, and their associations. They are used for static object modeling. – We've already introduced and used this UML diagram while domain modeling, applying class diagrams in a conceptual perspective. This chapter summarizes more of the notation, irrespective of the perspective (conceptual or software). As with the prior interaction diagram chapter, this is a reference. – Subsequent chapters focus on a more important question: What are key principles in OO design? Those chapters apply UML interaction and class diagrams to help explain and demonstrate object design. Ch 16 UML Class Diagram

Feb 11, Ch 16 UML Class Diagram Much of the high-frequency class diagram notation can be summarized (and understood) in the figure below. Most elements in the figure are optional (e.g., +/- visibility, parameters, compartments). Modelers draw, show or hide them depending on context and the needs of the reader or UML tool.visibility

Feb 11, As we know, the same UML diagram can be used in multiple perspectives. In a conceptual perspective the class diagram can be used to visualize a domain model. For discussion, we also need a unique term to clarify when the class diagram is used in a software or design perspective. A common modeling term for this purpose is design class diagram (DCD). In the UP, the set of all DCDs form part of the Design Model. Other parts of the Design Model include UML interaction and package diagrams. Definition: Design Class Diagram

Feb 11, A UML classifier is "a model element that describes behavioral and structure features". Classifiers can also be specialized. They are a generalization of many of the elements of the UML, including classes, interfaces, use cases, and actors. In class diagrams, the two most common classifiers are regular classes and interfaces. Definition: Classifier

Feb 11, Attributes of a classifier (also called structural properties in the UML) are shown several ways: – attribute text notation, such as currentSale : Sale. – association line notation – both together Show UML Attributes: Attribute Text and Association Lines

Feb 11, Show UML Attributes: Attribute Text and Association Lines

Feb 11, The full format of the attribute text notation is: visibility name : type multiplicity = default {property-string} Also, the UML allows any other programming language syntax to be used for the attribute declaration. visibility marks include + (public), - (private), and so forth. visibility Guideline: Attributes are usually assumed private if no visibility is given. Show UML Attributes: Attribute Text and Association Lines

Feb 11, Notice in the previous figure that this attribute-as-association line has the following style: – a navigability arrow pointing from the source (Register) to target (Sale) object, indicating a Register object has an attribute of one Sale – a multiplicity at the target end, but not the source end – a rolename (currentSale) only at the target end to show the attribute name – no association name Show UML Attributes: Attribute Text and Association Lines

Feb 11, Guideline: When showing attributes-as- associations, follow this style in DCDs, which is suggested by the UML specification. Guideline: On the other hand, when using class diagrams for a domain model do show association names but avoid navigation arrows, as a domain model is not a software perspective. Show UML Attributes: Attribute Text and Association Lines

Feb 11, Guideline: Use the attribute text notation for data type objects and the association line notation for others. When to Use Attribute Text versus Association Lines for Attributes?

Feb 11, these different styles exist only in the UML surface notation; in code, they boil down to the same thing - the Register class will have three attributes. For example, in Java: public class Register { private int id; private Sale currentSale; private Store location; // … } When to Use Attribute Text versus Association Lines for Attributes?

Feb 11, The UML Notation for an Association End

Feb 11, The end of an association can have a navigability arrow. It can also include an optional rolename (officially, an association end name) to indicate the attribute name. The association end may also show a multiplicity value, such as '*' or '0..1'.multiplicity The rolename is used to indicate the attribute name The UML Notation for an Association End

Feb 11, A property string such as {ordered} or {ordered, List} is possible for an association end. {ordered} is a UML-defined keyword that implies the elements of the collection are ordered. Another related keyword is {unique}, implying a set of unique elements. The keyword {List} illustrates that the UML also supports user-defined keywords. One may define {List} to mean the collection attribute lineItems will be implemented with an object implementing the List interface The UML Notation for an Association End

Feb 11, Collection Attributes