Introduction to UML Part 2.

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

® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 04. Other.
UML: An Introduction.
Object-Oriented Analysis and Design
L4-1-S1 UML Overview © M.E. Fayad SJSU -- CmpE Software Architectures Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I.
UML Overview Unified Modeling Language Basic Concepts.
UML - Part 3.
CS 501: Software Engineering Fall 2000 Lecture 11 Object-Oriented Design I.
Unified Modeling (Part I) Overview of UML & Modeling
C++ Training Datascope Lawrence D’Antonio Lecture 11 UML.
© Copyright Eliyahu Brutman Programming Techniques Course.
Itntroduction to UML, page 1 Introduction to UML.
1 CS 501 Spring 2002 CS 501: Software Engineering Lecture 16 Object Oriented Design I.
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
Modeling Web Based Applications with UML Terry Quatrani Rose Evangelist Terry Quatrani Rose Evangelist.
Unified Modeling Language* Keng Siau University of Nebraska-Lincoln *Adapted from “Software Architecture and the UML” by Grady Booch.
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
16 August, 2007Information System Design IT60105, Autumn 2007 Information System Design IT60105 Lecture 7 Unified Modeling Language.
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.
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.
Michael Schloh von Bennewitz 1. Oktober 2002 The Unified Modeling Language Overview of theory and practice of the OMG Unified Modeling.
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.
 Building Block Building Block  Things in the UML Things in the UML  Structural Things Structural Things  Behavioral Things Behavioral Things  Grouping.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
1 Technical & Business Writing (ENG-715) Muhammad Bilal Bashir UIIT, Rawalpindi.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
Introduction to UML Hazleen Aris Software Eng. Dept., College of IT, UNITEN. …Unified Modeling Language.
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
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 UML and Rational Rose UML - Unified Modeling Language Rational Rose 98 - a GUI tool to systematically develop software through the following.
1 An Overview of UML. 2 The Unified Modeling Language UML is a graphical language used by software engineers to model software systems during development.
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
Unified Modeling Language (UML)
Evolution of UML.
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Object-Oriented Analysis and Design
UML: An Introduction.
Systems Analysis and Design With UML 2
Unified Modeling Language
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
Introduction to Object Oriented Analysis, Design and Unified Modeling Language (UML) Shanika Karunasekera.
The Unified Modeling Language
Unified Modeling Language
And Some Of Their Elements
Analysis models and design models
And Some Of Their Elements
Visual Modeling Using Rational Rose
Interfaces.
And Some Of Their Elements
CS 501: Software Engineering
Presentation transcript:

Introduction to UML Part 2

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

1 Modeling elements You have modeling elements for: 1.1 Structural things 1.2 Behavioral things 1.3 Grouping things 1.4 Annotational things

1.1 Structural elements Identified with nouns, e.g. Person; Typically representing static parts of the model. In UML you will find 7 different types of structual elements: 1.1.1 Class 1.1.2 Interface 1.1.3 Active class 1.1.4 Colloboration 1.1.5 Component 1.1.6 Node 1.1.7 Use Case

1.1.1 Class: Describes a Set of Objects class name attributes operations visibility operation signature Rose: The icons , and can be used instead of +, # and - Rational Rose 2000 Point - x : int - y : int + getX() : int + setX(aX : int) : void + getY() : int + setY(aY : int) : void

Encapsulation - Also Called Data Hiding Encapsulation: hiding the the implementation of the data from users of the object. Users are typically objects of other classes. The users don’t see if the data is stored in fields, calculated or if they are retrieved from a database, they only call a method. Encapsulation is achieve by never letting objects directly access fields. Fields should only be accessed through the object’s methods. Making the fields private (or protected) ensures encapsulation. If you want objects of different types to access the fields, then make public methods (or package accessibility) for this purpose.

Operation Versus Method (C++ member function) A method is an implementation of an operation. A method specifies the algorithm or procedure that produces the results of an operation.

1.1.2 Interface: A Named Set of Operations That Describes Some Behavior (No Implementation) stereotype interface name ISortable operation compartment interface - iconic form interface - expanded form

An Interface Can Be Seen As a Protocol An interface is an agreement on behavior. A class which implements an interface agrees on supporting the specified behavior. An interface can also be seen as a definition of a role, classes which implements the role are able to play that role. Example: The auto-pilot of an airplane can act as a pilot the same is true about some humans. The auto-pilot and the human is quit different types of objects, but they can both play the same role. Many different types of objects can implement the interface, so the interface is not the same as a “class to subclass from”. Interface, HiA by J.P.Nytun 2 2

1.1.3 Active Class Snake pos:Point move() bite() Active class: describes objects that owns their own thread; The behavior of this objects can be concurrent with others

1.1.4 Colloboration Listener Colloboration: describes a colloboration between roles to achieve a particular goal. A collaboration can represent an implementation of a use case or a particular pattern. Listener

1.1.5 Component calculate.class Component: a physical part of the system which implements a set of interfaces.

Different types of Components (in UML) Deployment Components: this components can be assembled to form a complete executable system. Example: A complete executable application, a dynamic library (DLL), a JavaBean, a COM+ object. Work Product Components: this components are the basis for making the deployment components. They are not a part of the executable system, but results from the development process. Example: Source code. Execution Components: this components are created by an executing system. Example: a JavaBean created during runtime.

Web Example Menu.html ------ ------ Menu --- Menu.java Menu.jpg Working product component Deployment component Menu.html ------ ------ --- Menu Menu.java Could be an execution component, e.g. Produced by a servelet Deployment component Menu.jpg

1.1.6 Node Node: a physical element that represent a computational resource (e.g. processor and memory). videoServer

1.1.7 Use Case Register for exam Use case: describes a sequence of actions that yields an observable result for an actor. With use cases you can structure the behavioral things in a model. Register for exam

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

1.2 Behavioral Elements Describing the dynamically parts of the model. Behavioral elements are identified with the help of verbs. 1.2.1 Interaction 1.2.2 State

1.2.1 Interaction Interaction: A behavior that comprises a set of messages sent between a set of objects to archive a special purpose, like in a sequence diagram.

1.2.2 State Machine State machine: A description of the different states an object can go through in response to events. Events generated by the object is also shown. An activity diagram is a special case of a state diagram.

1.3 Grouping Elements You can group elements with the help of packages. [1]: ”A package may own other elements, including classes, ..., diagrams, and even other packages.” You can use packages to orginaze your classes (interfaces,..) and your diagrams. java applet +Applet

1.4 Annotational Elements You can add comments to a diagram with the help of notes. A comment

2 Relations You have 4 different relationships: 2.1 Dependency 2.2 Association 2.3 Generalitation 2.4 Realization

2.1 Dependency: A relationship between to modeling elements, indicate that a change in the destination may effect the source. Company add(e : employee) Employee The method add has an employee as argument, so Company-class (source) is dependent of the Employee-class (destination).

2.2 Association: This relationship indicate that there is a connection from one type of objects to another type. An important type of association is aggregation which indicates that one object contains objects of a given type. Company association name composition or strong aggregation 1 1..* 1..* LocatedAt Department Office multiplicity * * ordinary association

A bird is a specialization 2.3 Generalization: A relationship between a more general element and a more specific one. For example: a bird is also an animal. Animal Bird A bird is a specialization of an animal.

The class Snake implements 2.4 Realization: UML: ”A semantic relationships between classifiers, in which one classifiers specifies a contract that another classifier guarantees to carry out”. ”interface” Movable move(x,y) Snake move(x,y) The class Snake implements the interface Movable.

3 Diagrams A diagram is typically a view of a part of the model, showing modeling elements and some of the relationships between them. A diagram do not have to be complete, some elements may be missing or presented in a simplified fashion. UML: ”A well-formed model is one that is semantically self-consistent and in harmony with all related models.”

There are 9 types of diagrams in UML Dynamic views Static views Use Case Diagrams Sequence Diagrams Some part of the model might not be visible on any diagram Class Diagrams Collaboration Diagrams Object Diagrams Model Activity Diagrams Component Diagrams Statechart Diagrams Deployment Diagrams

3.1 Use case diagram actor register a person association use case system boundary include relationship register a person edit a registration/ delete a registration User navigate/view the register ”include” view next person view previous person ”include”

Use Case Diagram - One More Example ”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

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

A Class Diagram With Navigation 1 responsible for * Course Person CourseModule name : String description : String name : String imail : String homePage : String 1 tech. responsible for * * 1..* name : String description : String 1 1 * * 1 StudentCourseProfile * Student finished : boolean

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 Person() { } public class Student extends Person { // // Navigation public StudentCourseProfile[] studentCourseProfile; public Student() { }

A Class Diagram - Example With Interface IStorable Register -reg 0..* 0..* edit() write() relization read() public void read(){ Person terminal.print("Name: "); name = terminal.readLine(); edit() ... write() } read() relization/implements To different representation of nearly the same dependency

A Class Diagram - One More Example With Interface

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

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

Object diagram and Rational Rose 2000 Rational Rose 2000 does not have object diagrams, but you can achieve much the same with a collobartion diagram You can not specify attributes inside object; One solution to this short-coming is to use a comment!

3.4 Sequence diagram ”create” register user controllerViewer person <command r> <name,e-mail,..> person ”create” setData(name, ..) insert(person)

3.5 Colloboration diagram 1.2: ”create” 1: register() 1.3: setDate(data) user controllerViewer person 1.1: data := getData() 1.4: insert(person) register

3.6 Statechart diagram StateChart for microwave oven "control unit"

Statechart for Applet Not Loaded Running Loaded Stopped init/init() stop/ stop() Stopped start /start() start/start() destroy/destroy()

3.7 Activity diagram - Capture Dynamic Behaviour (Activity-oriented)

Activity diagram - One More Example product of activity

Activity diagram - One More Example user controller person register request registration create person (object) supply person-data forward person-data process person-data insert person

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

Component diagram - One More Example Person.class Register.class ISortable

3.9 Deployment diagram Extended VLAN ”Server” ”network” LAN ”PC” ”PC”

Multi-tier Architecture - MVC - view: browser/jsp/servlet controller: jsp/servlet model: businessObjects 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

References [1] Grady Booch, James Rumbaugh and Ivar Jacobson: The Unified Modeling Language User Guide. Addison-Wesley, 1999 James Rumbaugh, Michael Blaha, William Premerlani, Frederick Eddy and William Lorenzen: Object-Oriented Modeling and Design. Prentice Hall, 1991 Martin Fowler with Kendall Scott: UML Distilled. Addison-Wesley, 1997 Terry Quatrani: Visual Modeling with Rational Rose and UML. Addison-Wesley, 1998 Ari Jaaksi: A Method for Your First Object-Oriented Project. JOOP - The Journal of Object-Oriented Programming, Januar 1998 Rational software: http://www.rational.com/uml/documentation.html