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

UML - Part 3.
Introduction to UML Part 2.
© Copyright Eliyahu Brutman Programming Techniques Course.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
1 CS 501 Spring 2002 CS 501: Software Engineering Lecture 16 Object Oriented Design I.
Object Oriented Software Development
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.
Introduction to the Unified Modeling Language “The act of drawing a diagram does not constitute analysis or design. … Still, having a well-defined and.
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
Systems Analysis and Design in a Changing World, 3rd Edition
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Unified Modeling Language* Keng Siau University of Nebraska-Lincoln *Adapted from “Software Architecture and the UML” by Grady Booch.
An Introduction to the Unified Modeling Language
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.
Logical view –show classes and objects Process view –models the executables Implementation view –Files, configuration and versions Deployment view –Physical.
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.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
The Unified Modeling Language (UML)
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.
Class Diagram Chapter 21 Applying UML and Patterns Craig Larman.
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
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
CS 501: Software Engineering Fall 1999 Lecture 15 Object-Oriented Design I.
Basic Characteristics of Object-Oriented Systems
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
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
Object-Oriented Modeling with UML
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
Today’s Objectives Define the Problem Domain
University of Central Florida COP 3330 Object Oriented Programming
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Object Oriented Analysis and Design
The Unified Modeling Language
Unified Modeling Language
Introduction to Unified Modeling Language (UML)
Chapter 20 Object-Oriented Analysis and Design
And Some Of Their Elements
Copyright 2007 Oxford Consulting, Ltd
Visual Modeling Using Rational Rose
Class Diagram.
CIS 375 Bruce R. Maxim UM-Dearborn
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 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 - 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; }

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.

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. 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

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