EECS 4314 Advanced Software Engineering. Topic 03: UML Overview Zhen Ming (Jack) Jiang

Similar documents
Software Service Engineering

Engineering Design w/embedded Systems

Introduction to Software Engineering. 5. Modeling Objects and Classes

Today s Agenda UML. CompSci 280 S Introduction to Software Development. 1.Introduction UML Diagrams. Topics: Reading:

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

Lecture 33 April 4, Unied Modelling Language. ECE155: Engineering Design with Embedded Systems Winter Patrick Lam version 1

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

Unified Modeling Language (UML)

LABORATORY 1 REVISION

administrivia today UML start design patterns Tuesday, September 28, 2010

Advanced Software Engineering

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

Introduction to Software Engineering. 5. Modeling Objects and Classes

Introduction to UML. Danang Wahyu utomo

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

Software Engineering Lab Manual

UML Primer. -Elango Sundaram

Software Development Cycle. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language.

MSc programme (induction week) Department of Informatics INTRODUCTION TO UML

OO Analysis and Design with UML 2 and UP

Software Development Methodologies

Object-Oriented Analysis and Design. Pre-UML Situation. The Unified Modeling Language. Unification Efforts

UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011

CHAPTER 1. Topic: UML Overview. CHAPTER 1: Topic 1. Topic: UML Overview

Software Engineering from a

UNIT-4 Behavioral Diagrams

UML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

Today s Topic. Lecture 5. What is UML? Why Use UML. UML Diagrams. Introduction to UML. What is UML Why use UML? UML Diagrams

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

UNIT-II Introduction to UML

12 Tutorial on UML. TIMe TIMe Electronic Textbook

Meltem Özturan

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

UML Tutorial. Unified Modeling Language UML Tutorial

Lab Manual. Object Oriented Analysis And Design. TE(Computer) VI semester

Interactions A link message

Basic Structural Modeling. Copyright Joey Paquet,

UML diagrams. Software artifacts include: SRS, SDS, test cases, source code, technical/user manual, software architecture, etc.

Model Driven Development Unified Modeling Language (UML)

Index. Add Diagram > Sequence Diagram command,

UML & OO Fundamentals. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 3 09/04/2012

UNIT II. Syllabus. a. An Overview of the UML: Visualizing, Specifying, Constructing, Documenting

Unified Modeling Language

IS 0020 Program Design and Software Tools

OO Techniques & UML Class Diagrams

INTRODUCTION TO UNIFIED MODELING MODEL (UML) & DFD. Slides by: Shree Jaswal

UML: Unified Modeling Language

An Introduction To Object Modeling System Concept for Object Modeling The Overall View Components of UML Diagram

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

Topics. Overview- The UML Functional Model. Structural Model. Behavioral Models. Use Case Diagram (essential and system)

UNIT-I Introduction of Object Oriented Modeling

Lecture 17: (Architecture V)

Architecture and the UML

UNIT 5 - UML STATE DIAGRAMS AND MODELING

OMG Modeling Glossary B

UML (Unified Modeling Language)

Index. : (colon), 80 <<>> (guillemets), 34, 56

2 UML for OOAD. 2.1 What is UML? 2.2 Classes in UML 2.3 Relations in UML 2.4 Static and Dynamic Design with UML. UML for OOAD Stefan Kluth 1

UNIT-IV BASIC BEHAVIORAL MODELING-I

UNIT I. 3. Write a short notes on process view of 4+1 architecture. 4. Why is object-oriented approach superior to procedural approach?

Pertemuan 8. Object Oriented Modeling and Design

Rational Software White paper

CS 451 Software Engineering

Systems Analysis and Design in a Changing World, Fourth Edition

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Course 3 7 March

Modeling System Behavior. Events Scenarios Sequence Diagrams Collaboration Diagrams

Object-Oriented Design

Class Diagrams in Analysis

Object-Oriented Software Engineering Practical Software Development using UML and Java

Modeling with UML. (1) Use Case Diagram. (2) Class Diagram. (3) Interaction Diagram. (4) State Diagram

UML Views of a System

Object Oriented Modeling

SEEM4570 System Design and Implementation Lecture 11 UML

Exercise Unit 2: Modeling Paradigms - RT-UML. UML: The Unified Modeling Language. Statecharts. RT-UML in AnyLogic

Lecture Notes UML UNIT-II. Subject: OOAD Semester: 8TH Course No: CSE-802

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

SEEM4570 System Design and Implementation. Lecture 10 UML

Unified Modeling Language (UML)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

Object-Oriented Systems Development: Using the Unified Modeling Language

History of object-oriented approaches

Domain Engineering And Variability In The Reuse-Driven Software Engineering Business.

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Software Development. Modular Design and Algorithm Analysis

COSC 3351 Software Design. An Introduction to UML (I)

Business Process Modelling

Week 9 Implementation

UML 2.0 UML 2.0. Scott Uk-Jin Lee. Division of Computer Science, College of Computing Hanyang University ERICA Campus

Unit-1 INTRODUCTION 1.1 CATEGORIES OF INFORMATION SYSTEMS SYLLABUS:

The Unified Modeling Language (UML)

From Analysis to Design. LTOOD/OOAD Verified Software Systems

Practical UML - A Hands-On Introduction for Developers

SE 1: Software Requirements Specification and Analysis

Unified Modeling Language (UML)

How and Why to Use the Unified Modeling Language. among software components, architectural-based

Vidyalankar. T.Y. Diploma : Sem. VI [IF/CM] Object Oriented Modeling and Design Prelim Question Paper Solution

MechEng SE3 Lecture 7 Domain Modelling

Transcription:

EECS 4314 Advanced Software Engineering Topic 03: UML Overview Zhen Ming (Jack) Jiang

Acknowledgement Some slides are from Ahmed E. Hassan, Richard Paige, and Spiros Mancoridis

Unified Modelling Language (UML) UML is a set of notations, not a methodology or process. Version 2.x is the latest standard There are now ~12 kinds of diagrams! UML does have an official standard, backed by OMG Rational (now owned by IBM) is the big mover behind UML, but they don t own it. Lots of history and politics behind it. Many expensive tools, seminars, books, hype, etc. but UML is just a bunch of notations. UML doesn t solve your problems for you, it gives you a way of writing them down. Guaranteed cockroach killer [Gause/Weinberg]

A short history of analysis and design notations 1970s: Procedural languages (COBOL, FORTRAN, PL/I, C) Systems are structured as TDFD (TDFD == top-down functional decomposition) Data is mostly global and passive Notations and tools: ER diagrams (for DB design) DFDs, CFGs, flowcharts STDs (for state-oriented engineering applications) Data dictionaries Methodologies: Structured analysis 1980s: Some OO languages start to creep in (C++, OO-Cobol) Systems structured as modules, use info-hiding & interfaces. Data is encapsulated; must use interfaces. Notations and tools: Class/object diagrams (ER++) for analysis modelling Statecharts (formal STDs for engineering appls.) Message sequence charts (aka scenario diags) Use cases (Jacobson) Methodologies: OMT (Rumbaugh) Booch notation many others 1990s: Most of the software industry is tired of tool/notation wars. They want some form of agreement on a notation without an accompanying state religion. The three amigos gather at Rational; they confer, then announce war is over (if you want it). UML takes a kitchen-sink approach to language design. It contains many kinds of diagrams(!), and makes few restrictions on how to use them. UML diagrams are used to model various requirements views as well as architecture, design, implementation, and run-time views

UML in a Nutshell Early reqs views: Use cases: Identify actors, SUD boundaries/scope Map out basic SUD functionality at coarsely-grained level; consider variations Elaborate analysis model: Class diagrams: Shows static, structural domain model Model abstract relationships between problem-space entities Sequence / communication (a.k.a., collaboration) diagrams: Expand use cases into a set of scenarios Model interactions and flow of information between objects Show inter-object dynamic properties (can be coarse or fine)

UML in a Nutshell (Very) detailed reqs view: State diagrams (Statecharts) + (detailed) sequence diagrams: Show detailed view of how objects work. Statecharts model:» intra-object dynamic behaviour Sequence diagrams model:» inter-object dynamic behaviour Usually models reactive objects that respond to external stimuli/events, e.g., embedded systems. Objects basically rest in a state until they are informed of an event; they then perform some action and then go rest in another state. Mainly used for real-time, embedded, and other engineering applications; less useful for other types of systems.

1. Fowler on UML religions 1. UML as religion : How rigorously should you create and maintain the UML diagrams? How much detail to show? Is XXX legal UML? Does it matter? 2. Different perspectives for UML diagrams Using the same kinds of diagrams for different purposes (analysis vs. design)

1. Fowler on UML religions UML as blueprint Goal is rigorous, complete specification of analysis and/or design of a software system: Analysis UML models are kept consistent with design UML models There is traceability between analysis and design models UML design artifacts are kept consistent with code Usually, this means extracting design info from code (reverse engineering) and verifying current reality matches the specified design model. UML diagrams express partial semantics of system e.g., structure, communication paths, control / data / other dependencies UML diagrams do not completely specify low-level semantics e.g., full details of what happens inside a method body

1. Fowler on UML religions UML as blueprint Tool support is key: round trip engineering Code generation from UML models Typically of interfaces / class skeletons, not method bodies Reverse engineering of UML models from source code Class (design) diagrams extracted from static source structure Sequence / communication diagrams extracted from system execution traces Typically, we choose a desired level of detail; the models are then complete with respect to that level of detail e.g., static class structure and some set of relations (instantiates, calls, inherits, package membership, )

1. Fowler on UML religions UML as programming language Tool support is even more important! Unfortunately, we are not quite there yet Practical UML MDA tools are on the horizon. The UML diagrams are the system They are the maintenance artifacts of the system, not the code! The code is auto-generated from detailed state models (and class diagrams) Rarely done But it s the grand goal of the MDA movement (model-driven architecture) See http://www.omg.org/mda

2. Fowler on UML perspectives Conceptual (domain / reqs) perspective Can involve use case diagrams & use cases, class diagrams, scenarios with actors & SUD, The conceptual class diagram also called the domain model Entities are things in the domain, and actors Classes in this model do not (usually) correspond to programming language classes; that s what design is! Associations are abstract relationships between classes/objects (including inheritance and aggregation).

2. Fowler on UML perspectives Software (design) perspective Can include class diagrams, scenarios, The key difference is that the things modeled here correspond to source code entities The class diagram shows Java classes, their interrelationships that can be seen in the code Attributes are fields, operations are methods Associations model responsibilities e.g., updates, manages Scenarios show sequences of real method calls

Additional UML References UML Distilled - Applying the Standard Object Modeling Language by Martin Fowler and Kendall Scott Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process (3rd Edition) by Craig Larman

UML Tools Anything you can find to use ArgoUML, MagicDraw, Rational, Microsoft Visio, etc. Different tools produce slightly different diagrams Don t get stuck in the details Make sure the notations in the diagrams are consistent

Software Design Static Modeling using the Unified Modeling Language (UML)

Classes ClassName attributes operations A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics. Graphically, a class is rendered as a rectangle, usually including its name, attributes, and operations in separate, designated compartments.

Class Names ClassName attributes The name of the class is the only required tag in the graphical representation of a class. It always appears in the top-most compartment. operations

Class Attributes Person name : String address : Address birthdate : Date ssn : Id An attribute is a named property of a class that describes the object being modeled. In the class diagram, attributes appear in the second compartment just below the name-compartment.

Class Operations Person name : String address : Address birthdate : Date ssn : Id eat sleep work play Operations describe the class behavior and appear in the third compartment.

Class Operations (Cont d) PhoneBook newentry (n : Name, a : Address, p : PhoneNumber, d : Description) getphone ( n : Name, a : Address) : PhoneNumber You can specify an operation by stating its signature: listing the name, type, and default value of all parameters, and, in the case of functions, a return type.

Depicting Classes When drawing a class, you needn t show attributes and operation in every diagram. Person Person name address birthdate Person Person eat play Person name : String birthdate : Date ssn : Id eat() sleep() work() play()

Relationships In UML, object interconnections (logical or physical), are modeled as relationships. There are three kinds of relationships in UML: dependencies generalizations associations

Dependency Relationships A dependency indicates a semantic relationship between two or more elements. The dependency from CourseSchedule to Course exists because Course is used in both the add and remove operations of CourseSchedule. CourseSchedule add(c : Course) remove(c : Course) Course

Generalization Relationships Person Student A generalization connects a subclass to its superclass. It denotes an inheritance of attributes and behavior from the superclass to the subclass and indicates a specialization in the subclass of the more general superclass.

Generalization Relationships (Cont d) UML permits a class to inherit from multiple superclasses, although some programming languages (e.g., Java) do not permit multiple inheritance. Student Employee TeachingAssistant

Association Relationships If two classes in a model need to communicate with each other, there must be link between them. An association denotes that link. Student Instructor

Association Relationships (Cont d) We can indicate the multiplicity of an association by adding multiplicity adornments to the line denoting the association. The example indicates that a Student has one or more Instructors: Student 1..* Instructor

Association Relationships (Cont d) The example indicates that every Instructor has one or more Students: Student 1..* Instructor

Association Relationships (Cont d) We can also indicate the behavior of an object in an association (i.e., the role of an object) using rolenames. Student teaches 1..* learns from 1..* Instructor

Association Relationships (Cont d) We can also name the association. Student membership 1..* 1..* Team

Association Relationships (Cont d) We can specify dual associations. member of Student 1..* 1..* Team 1 president of 1..*

Association Relationships (Cont d) Associations can also be objects themselves, called link classes or an association classes. Registration modelnumber serialnumber warrentycode Product Warranty

Association Relationships (Cont d) A class can have a self association. next LinkedListNode previous

Association Relationships (Cont d) We can model objects that contain other objects by way of special associations called aggregations and compositions. An aggregation specifies a whole-part relationship between an aggregate (a whole) and a constituent part, where the part can exist independently from the aggregate. Aggregations are denoted by a hollow-diamond adornment on the association. Car Manufacturer Owner

Association Relationships (Cont d) A composition (aggregation in Eiffel s term) indicates a strong ownership and coincident lifetime of parts by the whole (i.e., they live and die as a whole). Compositions are denoted by a filled-diamond adornment on the association. 1 1 Scrollbar Window 1 1 Titlebar 1 1.. * Menu

Interfaces <<interface>> ControlPanel An interface is a named set of operations that specifies the behavior of objects without showing their inner structure. It can be rendered in the model by a one- or two-compartment rectangle, with the stereotype <<interface>> above the interface name.

Interface Services <<interface>> ControlPanel getchoices : Choice[] makechoice (c : Choice) getselection : Selection Interfaces do not get instantiated. They have no attributes or state. Rather, they specify the services offered by a related class.

Interface Realization Relationship <<interface>> ControlPanel specifier implementation A realization relationship connects a class with an interface that supplies its behavioral specification. It is rendered by a dashed line with a hollow triangle towards the specifier. VendingMachine

Enumeration <<enumeration>> Boolean false true An enumeration is a user-defined data type that consists of a name and an ordered list of enumeration literals.

Exceptions <<exception>> Exception getmessage() printstacktrace() Exceptions can be modeled just like any other class. Notice the <<exception>> stereotype in the name compartment. <<exception>> KeyException <<exception>> SQLException

Packages A package is a container-like element for organizing other elements into groups. Compiler A package can contain classes and other packages and diagrams. Packages can be used to provide controlled access between classes in different packages.

Packages (Cont d) Classes in the FrontEnd package and classes in the BackEnd package cannot access each other in this diagram. Compiler FrontEnd BackEnd

Packages (Cont d) Classes in the BackEnd package now have access to the classes in the FrontEnd package. Compiler FrontEnd BackEnd

Packages (Cont d) Compiler We can model generalizations and dependencies between packages. JavaCompiler Java

Component Diagram Component diagrams are one of the two kinds of diagrams found in modeling the physical aspects of an object-oriented system. They show the organization and dependencies between a set of components. Use component diagrams to model the static implementation view of a system. This involves modeling the physical things that reside on a node, such as executables, libraries, tables, files, and documents. - The UML User Guide, Booch et. al., 1999

Component Diagram path.dll collision.dll driver.dll version = 8.1.3.2 Here s an example of a component model of an executable release. [Booch,99] IDrive ISelfTest

Deployment Diagram Deployment diagrams are one of the two kinds of diagrams found in modeling the physical aspects of an object-oriented system. They show the configuration of run-time processing nodes and the components that live on them. Use deployment diagrams to model the static deployment view of a system. This involves modeling the topology of the hardware on which the system executes. - The UML User Guide, [Booch,99]

Deployment Diagram A component is a physical unit of implementation with welldefined interfaces that is intended to be used as a replaceable part of a system. Well designed components do not depend directly on other components, but rather on interfaces that components support. - The UML Reference Manual, [Rumbaugh,99] component Dictionary spell-check synonyms interfaces

Deployment Diagram <<database>> Account stereotyped component Transactions Update interface component usage dependency realization dependency ATM-GUI [Rumbaugh,99]

Deployment Diagram server:hostmachine :Scheduler <<direct channel>> clientmachine:pc <<database>> meetingsdb reservations Deployment diagram of a client-server system. [Rumbaugh,99] :Planner

Software Design Dynamic Modeling using the Unified Modeling Language (UML)

Use Case A use case specifies the behavior of a system or a part of a system, and is a description of a set of sequences of actions, including variants, that a system performs to yield an observable result of value to an actor. - The UML User Guide, [Booch,99] An actor is an idealization of an external person, process, or thing interacting with a system, subsystem, or class. An actor characterizes the interactions that outside users may have with the system. - The UML Reference Manual, [Rumbaugh,99]

Use Case (Cont d) Register for Courses A use case is rendered as an ellipse in a use case diagram. A use case is always labeled with its name.

Use Case (Cont d) An actor is rendered as a stick figure in a use case diagram. Each actor participates in one or more use cases. Student

Use Case (Cont d) Actors can participate in a generalization relation with other actors. Student Person

Use Case (Cont d) Actors may be connected to use cases only by associations. Register for Courses Student

Use Case (Cont d) Here we have a Student interacting with the Registrar and the Billing System via a Register for Courses use case. Billing System Student Register for Courses Registrar

State Machine The state machine view describes the dynamic behavior of objects over time by modeling the lifecycles of objects of each class. Each object is treated as an isolated entity that communicates with the rest of the world by detecting events and responding to them. Events represent the kinds of changes that objects can detect... Anything that can affect an object can be characterized as an event. - The UML Reference Manual, [Rumbaugh,99]

State Machine An object must be in some specific state at any given time during its lifecycle. An object transitions from one state to another as the result of some event that affects it. You may create a state diagram for any class, collaboration, operation, or use case in a UML model. There can be only one start state in a state diagram, but there may be many intermediate and final states.

State Machine start state final state simple state concurrent composite state sequential composite state

State Machine unscheduled download course offerings downloading make a course selection selecting make a different selection verify selection verifying select another course check schedule sign schedule checking schedule scheduled

Sequence Diagram A sequence diagram is an interaction diagram that emphasizes the time ordering of messages. It shows a set of objects and the messages sent and received by those objects. Graphically, a sequence diagram is a table that shows objects arranged along the X axis and messages, ordered in increasing time, along the Y axis. - The UML User Guide, [Booch,99]

Sequence Diagram an Order Line An object in a sequence diagram is rendered as a box with a dashed line descending from it. The line is called the object lifeline, and it represents the existence of an object over a period of time.

Sequence Diagram an Order Line a Stock Item check() [check = true ] remove() Messages are rendered as horizontal arrows being passed from object to object as time advances down the object lifelines. Conditions ( such as [check = true ] ) indicate when a message gets passed.

Sequence Diagram an Order Line a Stock Item check() [check = true ] remove() Notice that the bottom arrow is different. The arrow head is not solid, and there is no accompanying message. This arrow indicates a return from a previous message, not a new message.

Sequence Diagram an Order a Order Line * prepare() Iteration marker An iteration marker, such as * (as shown), or *[i = 1..n], indicates that a message will be repeated as indicated.

an Order Entry window an Order an Order Line a Stock Item [Fowler, 97] Object prepare() * prepare() check() Condition Message [check = true ] remove() needstoreorder() Iteration Return Self-Delegation [needstoreorder = true ] new A Reorder Item [check = true ] new A Delivery Item Creation

Collaboration Diagram A collaboration diagram emphasizes the relationship of the objects that participate in an interaction. Unlike a sequence diagram, you don t have to show the lifeline of an object explicitly in a collaboration diagram. The sequence of events are indicated by sequence numbers preceding messages. Object identifiers are of the form objectname : classname, and either the objectname or the classname can be omitted, and the placement of the colon indicates either an objectname:, or a :classname.

Collaboration Diagram : Order Entry Window : Order 1: prepare() Object Message Self-Delegation Sequence Number 5: needtoreorder() : Order Line 2*: prepare() 3: check() 4: [check == true] remove() : Stock Item :Delivery Item 7: [check == true] new :Reorder Item 6: new [Fowler,97]

Collaboration Diagram Sequence Diagram Both a collaboration diagram and a sequence diagram derive from the same information in the UML s metamodel, so you can take a diagram in one form and convert it into the other. They are semantically equivalent.

Activity Diagram An activity diagram is essentially a flowchart, showing the flow of control from activity to activity. Use activity diagrams to specify, construct, and document the dynamics of a society of objects, or to model the flow of control of an operation. Whereas interaction diagrams emphasize the flow of control from object to object, activity diagrams emphasize the flow of control from activity to activity. An activity is an ongoing non-atomic execution within a state machine. - The UML User Guide, [Booch,99]

Receive Order [Fowler,97] Multiple Trigger * for each line item on order Cancel Order [failed] Authorize Payment Check Line Item [succeeded] [in stock] Assign to Order Synchronization Condition [stock assigned to all line items and payment authorized] Dispatch Order [need to reorder] Reorder Item