And Some Of Their Elements

Slides:



Advertisements
Similar presentations
A Brief Introduction. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
Advertisements

Object-Oriented Analysis and Design
UML - Part 3.
Unified Modeling (Part I) Overview of UML & Modeling
Introduction to UML Part 2.
© Copyright Eliyahu Brutman Programming Techniques Course.
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
1 CS 501 Spring 2002 CS 501: Software Engineering Lecture 16 Object Oriented Design I.
What is UML? What is UP? [Arlow and Neustadt, 2005] January 23, 2014
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.
CIT UPES | Sept 2013 | Unified Modeling Language - UML.
Introduction to the Unified Modeling Language “The act of drawing a diagram does not constitute analysis or design. … Still, having a well-defined and.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
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.
Slide 1 UML Review Chapter 2: Introduction to Object-Oriented Systems Analysis and Design with the Unified Modeling Language, Version 2.0 Alan Dennis,
Unified Modeling Language, Version 2.0
Unified Modeling Language* Keng Siau University of Nebraska-Lincoln *Adapted from “Software Architecture and the UML” by Grady Booch.
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
1 The Unified Modeling Language. 2 The Unified Modeling Language (UML) is a standard language for writing software blueprints. The UML may be used to.
UML as a Specification Language for Embedded Systems. By, Mir Ahmed Ali, Asst. Professor, ECM department, SNIST. By, Prof. Narsiah sir, Director of School.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Unified Modeling Language. Object Oriented Methods ► What are object-oriented (OO) methods?  OO methods provide a set of techniques for analyzing, decomposing,
Design Model Lecture p6 T120B pavasario sem.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Software Engineering Lecture 8 Object-Oriented Analysis.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Week 04 Object Oriented Analysis and Designing. What is a model? A model is quicker and easier to build A model can be used in simulations, to learn more.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Chapter 3: Introducing the UML
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
CS 501: Software Engineering Fall 1999 Lecture 15 Object-Oriented Design I.
Basic Characteristics of Object-Oriented Systems
UML (Unified Modeling Language)
Itntroduction to UML by Jan Pettersen Nytun, page 1 Introduction to UML Part 2.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
UML Class & Object Diagram II RELATIONS UML Class Diagram & Object Diagram II, Jan Pettersen Nytun, page no 1.
Modeling with UML – Class Diagrams
Appendix 3 Object-Oriented Analysis and Design
CHAPTER
Unified Modeling Language (UML)
UML Diagrams By Daniel Damaris Novarianto S..
Evolution of UML.
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Object-Oriented Analysis and Design
What is UML? What is UP? [Arlow and Neustadt, 2005] October 5, 2017
Systems Analysis and Design With UML 2
Unified Modeling Language
Introduction to Unified Modeling Language (UML)
Introduction to Unified Modeling Language (UML)
Systems Analysis and Design With UML 2
UML Class & Object Diagram II
University of Central Florida COP 3330 Object Oriented Programming
UML Diagrams Jung Woo.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
The Unified Modeling Language
Chapter 20 Object-Oriented Analysis and Design
CIS 375 Bruce R. Maxim UM-Dearborn
Appendix A Object-Oriented Analysis and Design
Dynamic Modeling Lecture # 37.
And Some Of Their Elements
Copyright 2007 Oxford Consulting, Ltd
Visual Modeling Using Rational Rose
Design Yaodong Bi.
CIS 375 Bruce R. Maxim UM-Dearborn
Appendix A Object-Oriented Analysis and Design
Appendix A Object-Oriented Analysis and Design
And Some Of Their Elements
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Presentation transcript:

And Some Of Their Elements UML Diagrams & And Some Of Their Elements

Building blocks of the UML As part of a model you have: modelling elements relationships between the modeling elements diagrams that group and visualize the modeling elements and the relations between them. E.g. class diagram: Company Department Office * 1 1..* LocatedAt

Comment You can add comments on all type of diagrams, attaching them to all kinds of elements. Semantically insignificant.

UML 2.0 The taxonomy of diagrams “Structure diagrams show the static structure of the objects in a system. That is, they depict those elements in a specification that are irrespective of time... example, a structure diagram for an airline reservation system may include classifiers that represent tickets.” Diagram Structure Diagram Behaviour Diagram “Behavior diagrams show the dynamic behavior of the objects in a system, including their methods, collaborations, activities and state histories. The dynamic behavior of a system can be described as a series of changes to the system over time... the boundaries between the various kinds of diagram types are not strictly enforced.” Moment and Movement!!

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Composite Structure Diagram Ref.Man. UML2.0: ”A diagram that shows the internal structure of a structured classifier or a collaboration. There is no rigid line between a composite structure diagram and a general class diagram.” Communication D. Deployment D. Interaction Overview D. Timing D.

Grouping Elements You can group elements with the help of packages and by this organize your classes, diagrams, etc. java applet +Applet

Dependency: A relationship between two modeling elements indicates that a change in the destination may effect the source. Example – dependency between classes: Company is dependent on Employee Company add(e : Employee) Employee The operation add has an employee object as argument: A change in Employee may inflict a change of the add operation.

Dependency on Package Diagram From MagicDraw

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Composite Structure Diagram Ref.Man. UML2.0: ”A diagram that shows the internal structure of a structured classifier or a collaboration. There is no rigid line between a composite structure diagram and a general class diagram.” Communication D. Deployment D. Interaction Overview D. Timing D.

Stereotype From Wikipedia “Allow designers to extend the vocabulary of UML in order to create new model elements, derived from existing ones, but that have specific properties that are suitable for a particular problem domain or otherwise specialized usage.”

Some Extensibility Mechanisms «container» EventQueue {version 2.1} tagged value add(e:event) remove(n:int) «query» length():int «helper function» reorder() {add runs in O(1) time} stereotype constraint (not expressed in OCL)

Class: Describes a Set of Objects class name attributes compartment operations compartment visibility operation signature Point - x : int - y : int + getX() : int + setX(aX : int) : void + getY() : int + setY(aY : int) : void Modelling tool: Rational Rose 2000 Coming slides will say more about visibility… Additional compartments may be supplied, e.g., a constraints compartment.

Attribute (Implemented as Field in Java, data member in C++) [5] ”An attribute is the description of a named slot of a specified type in a class; each object of the class separately holds a value of the type.” <<stereotype>>opt / optvisibilityopt name multiplicityopt : typeopt … Used if the value of the attribute can be derived from other information. - (private) only the class can see this attribute # (protected) only the class and all of its subclasses + (public) all classes that can see the class can also see the attribute ~ (package) only classes in the package can see the attribute E.g. <<unique>> Example: Circle: attribute radius, circumference can de derived (2 x pi x radius) position: x, y with default values 0

Attribute continues Example: Tagged value e.g. Author = Kari … name multiplicityopt : typeopt = initial-valueopt {property-string}opt Example: email[1..*] : String Indicating one or more email addresses. (If no email is present you will still have the empty string (””).) If email[0..*] : String is specified, then email can be null. Example: Circle: attribute radius, circumference can de derived (2 x pi x radius) position: x, y with default values 0

Operation (Implemented as method in Java, as member function in C++) [5]: ”An operation is a specification of a transformation or query that an object may be called to execute…. A method is a procedure that implements an operation. It has an algorithm or procedure description.” Examples: + <<query>> getX() : double + setX(newX : double) <<stereotype>>opt visibilityopt name(parameter-list) : return-typeopt

Encapsulation (Information Hiding) Point - x : int - y : int + getX() : int + setX(aX : int) : void + getY() : int + setY(aY : int) : void Hiding design decisions in a computer program that are most likely to change. E.g.: Store data in slots or Calculate them or Retrieve them from a database? Wanted effect: Protection of other parts of the program from extensive modification if the design decision is changed. Realized by having the attributes private/protected and supplying public operations to access the hidden data. Also concurrency…

Static Features (i.e., attributes and operations) Features are usually defined for instances of the class (e.g., an attribute gives a slot for each instance of the class). Static or class scoped features are also possible: The class is then like an object with these features. No object of the class is needed to use. Static features are underline in UML. [8]

Association Classes The association between classes may have attributes of its own. This can be modeled by connecting a class to the association. Institute Person works for Job description salary Eclipse Modeling Tools

Different Model Same Information [2] Reified Association

Reification To treat as an object something that normally is not considered an object. Example: Association class ~ “links as objects” – links are often considered to have no internal structure, association classes allows internal structures to be defined. Another example: Invocation / activation. Actually also words reifying abstract concepts…

Active Class Snake pos:Point move() bite() Active class: Describes objects that owns their own thread. The behavior of these objects can be concurrent with others. It does not seems like MagicDraw supports this!? BOUML notation:

Association A relationship that describes a set of links between classes of objects, indicating some sort of connection between objects of the involved classes. Example: student follows a course. In UML class diagrams you can distinguish between ordinary association, simple aggregation and composition (strong aggregation).

Ordinary Association: This relationship indicate that there is a connection from one type of objects to another type. From the UML 2.1 specification - semantic description of association : “An association declares that there can be links between instances of the associated types. A link is a tuple with one value for each end of the association, where each value is an instance of the type of the end.” Company association name composition or strong aggregation 1 1..* 1..* LocatedAt Department Office multiplicity * * ordinary association

Ordinary Assocaition With Navigability: If you have a Quiz-object, the associated Question-objects can be directly reach from the Quiz-object. I.e., there will be a reference to each Question-object inside the Quiz-object but not the other way around. Quiz direction of navigation Question base class * 1..* association with navigation One possible mapping to Java class Quiz{ // A list of questions Question [] questions; .... } class Question { // no reference to Quiz .... }

Navigability And Use Of Rolename E.g. implementation in Java: editAnswerAlternative() may contain the following code: rightAnswer.setTxt(”Some smart answer”) Role name Question rightAnswer AnswerAlternative 1 1 txt : String editAnswerAlternative() setTxt(txt : String)

A Class Diagram With Navigation responsible for 1 * Course Person CourseModule name : String description : String name : String imail : String homePage : String 1 * * 1..* name : String description : String tech. responsible for 1 reached 1 * * 1 StudentCourseProfile * Student finished : boolean When a student register for course a StudentCourseProfile object will be made!

A Class Diagram - Mapping to Java 1 responsible for * Course Person -name : String -description : String #name : String #imail : String #homePage : String 1 tech. responsible for * 1 * * 1 StudentCourseProfile Student -finished : boolean public class Person { protected String name; protected String imail; protected String homePage; // // Navigation protected Course[] responsibleFor; protected Course[] techResponsibleFor; } public class Student extends Person { // // Navigation public StudentCourseProfile[] studentCourseProfile; }

Composition: Aggregation: An important type of association is composition and aggregation which indicates that one object contains objects of a given type (i.e., a whole/part relationship). No cycles are allowed (over all compositions/aggregations) and it should be understood to be a transitive relation. Only binary associations can be aggregations. Composition aggregation (strong aggregation) Company Department 1 1..* aggregation Company Department 1 1..*

Composition: Company Department 1 1..* UML 2.1 specification: “Composite aggregation is a strong form of aggregation that requires a part instance be included in at most one composite at a time. If a composite is deleted, all of its parts are normally deleted with it… Compositions may be linked in a directed acyclic tree with transitive deletion characteristics; that is, deleting an element in one part of the graph will also result in the deletion of all elements of the subgraph below that element.” Composition aggregation (strong aggregation) Company Department 1 1..*

2.2.3 Aggregation: This is a weaker form of aggregation than composition Unlike composition a part instance might be included in more than one aggregation at a time. Composition defines a directed tree and an aggregation defines a directed graph that does not have cycles. aggregation Address Mail 1 1..* MailBody 1 1

Generalization: Eagle A relationship between a more general element and a more specific one. For example: A bird is also an animal. (Generalization is not an association, but it do relate objects in regard to classification.) Animal A bird is a specialization of an animal. It inherits the structure and behaviour of Animal. Bird Eagle Generalization is a transitive relation!

Realization: UML: ”A semantic relationships between classifiers, in which one classifier specifies a contract that another classifier guarantees to carry out”. <<interface>> Movable Snake inherits the behaviour specified by the operations of Movable (as an interface Movable has no internal structure). move(x,y) Snake move(x,y) The class Snake realises (implements) the interface Movable.

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Communication D. Deployment D. Interaction Overview D. Timing D.

Object Diagram - Capture Instances and Links Class Object Company HiA: Company noOfEmploees=600 noOfEmploees : int Possible object name object class slot with value

Object Diagram with Links Class Diagram Object Diagram Language: Department :LocatedAt Gimlemoen: Office Company 1 HiA: Company 1..* LocatedAt Possible object diagram Department Office * 1..* Engineering : Department :LocatedAt Grooseveien: Office Link - A link is an instance of an association, analogous to an object being an instance of a class.

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Composite Structure Diagram Ref.Man. UML2.0: ”A diagram that shows the internal structure of a structured classifier or a collaboration. There is no rigid line between a composite structure diagram and a general class diagram.” Communication D. Deployment D. Interaction Overview D. Timing D.

Composite Structure Diagram [2] : ”A diagram that shows the internal structure of a structured classifier or a collaboration. There is no rigid line between a composite structure diagram and a general class diagram.”

Structured Classifier Car :powers : Enginee front : Wheel 2 back : Wheel 2 [2] : ”A classifier containing parts or roles that form its data structure and realize its behavior.” Forhjulsdrevet = with front drive

From [6]: Alternative notation [6]:

 A decomposition of a classifier into its properties, parts and relationships[9]: Vault = Velv

Port An element that represents an externally visible part of a containing classifier instance. It may have state and perform actions, e.g., convert input from one format (e.g., C++) to another (e.g., Smalltalk). Ports define the interaction between a classifier and its environment in the form of provided interfaces and required interfaces.

Collaboration Written Examination Examination Candidate : Student examinant : Employee exam : Exam : ExaminationCertificate student delivery: WrittenDocument : ExaminationPaper : Place [2]: ”A specification of a contextual relationship among instances that interact within a context to implement a desired functionality.”

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. State Machine D. Composite Structure D. Interaction D. Sequence D. Component D. Communication D. Deployment D. Interaction Overview D. Timing D.

Component diagram Captures the Physical Structure of the Implementation applet1.class applet1.java Demo.html applet2.class applet2.java logo.gif

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Communication D. Deployment D. Interaction Overview D. Timing D.

Deployment Diagram Extended WLAN << Server >> <<Network >> LAN ”PC” ”PC”

Multi-tier Architecture - MVC - view: browser/jsp/servlet controller: jsp/servlet model: businessObjects + DB client: Internet browser: server1: :WebServer :html :html :ServletContainer Intranet s1:Servlet s2:Servlet j1:Jsp j2:Jsp b1:BusinessObject b3:BusinessObject b2:BusinessObject b4:BusinessObject server2: :DB

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. State Machine D. Composite Structure D. Interaction D. Sequence D. Component D. Communication D. Deployment D. Interaction Overview D. Timing D.

Activity diagram - Capture Dynamic Behaviour (Activity-oriented) [2] BoxOffice = place for managing tickets, e.g. tickets for concert.

Activity Diagram With Swim Lanes

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Composite Structure Diagram Ref.Man. UML2.0: ”A diagram that shows the internal structure of a structured classifier or a collaboration. There is no rigid line between a composite structure diagram and a general class diagram.” Communication D. Deployment D. Interaction Overview D. Timing D.

”A use case is a specific way of using the system by performing some part of the functionality. Each use case constitutes a complete course of events initiated by an actor, and it specifies the interaction that takes place between an actor and the system....” I. Jacobson

Use case diagram actor register a person association use case system boundary include relationship (stereotype) register a person edit a registration/ delete a registration User navigate/view the register «include» view next person view previous person «include» Include is used to define functionality that is common to several use cases – it’s a modularization technique.

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Composite Structure Diagram Ref.Man. UML2.0: ”A diagram that shows the internal structure of a structured classifier or a collaboration. There is no rigid line between a composite structure diagram and a general class diagram.” Communication D. Deployment D. Interaction Overview D. Timing D.

Statechart Diagram Microwave Owen as Example

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Communication D. Deployment D. Interaction Overview D. Timing D.

Interaction User: :Oven-control -unit :Oven-light SetTemperature(250C) heatOn() lightOn() Interaction: A behaviour that comprises a set of messages sent between a set of objects to archive a special purpose, like in a sequence diagram.

Synchronous & Asynchronous Message Communication Asynchronous flow of control: the sender continue its execution as soon as the message has been sent Synchronous flow of control: the sender is blocked until it receives a reply (e.g., procedural call in C, …).

Sequence Diagram Example: object message activation bar life line

[2] Sequence Diagram with Asynchronous Flow of Control sequence diagram (sd) asynchronous communication is when the sender does not wait for the reply of the message sent

[2] One More Sequence Diagram with Conditional Fragment

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Communication D. Deployment D. Interaction Overview D. Timing D.

Communication diagram Focus is on objects, links and flow of messages!

[5] Communication Diagram Example

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Composite Structure Diagram Ref.Man. UML2.0: ”A diagram that shows the internal structure of a structured classifier or a collaboration. There is no rigid line between a composite structure diagram and a general class diagram.” Communication D. Deployment D. Interaction Overview D. Timing D.

Interaction Overview Diagram [2]: ”A variation on an activity diagram incorporating sequence diagram fragments together with flow of control constructs.” [7]

Interaction Overview D. Diagram Structure D. Behaviour D. Package D. Activity D. Class D. Use Case D. Object D. StateChart D. Composite Structure D. Interaction D. Sequence D. Component D. Communication D. Deployment D. Interaction Overview D. Timing D.

Timing Diagrams [3] Timing diagrams (UML 2.0) are a specific type of interaction diagram, where the focus is on timing constraints. Timing diagrams are used to explore the behaviors of objects throughout a given period of time. [4] The different states of the traffic light are shown

References [1] Grady Booch, James Rumbaugh and Ivar Jacobson: The Unified Modeling Language User Guide. Addison-Wesley, 1999 [2] James Rumbaugh, Ivar Jacobson and Grady Booch: The Unified Modeling Language Reference Manual Second Edition. Addison-Wesley, 2005 [3] http://en.wikipedia.org/wiki/UML_Timing_Diagram [4] http://www.altova.com/features_timing_diagram.html [5] Ref: http://dn.codegear.com/article/31863#sequence-diagrams [6] http://www.jot.fm/issues/issue_2004_11/column5/ [7] Accessed 7th September 2011: http://www.uml-diagrams.org/interaction-overview-diagrams-examples.html [8] Accessed 7th September 2011: http://www.uml-diagrams.org/class-diagrams.html [9] Accessed 12th September 2013: http://www.uml-diagrams.org/composite-structure-diagrams.html