Course "Softwaretechnik Modeling with UML Stephan Salinger

Similar documents
Course "Softwaretechnik" Book Chapter 2 Modeling with UML

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

Chapter 2, lecture 2 Modeling with UML

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

Chapter 2, Modeling with UML, Part 2

Chapter 2, Modeling with UML

Chapter 2, Modeling with UML, Part 2

Object Relationships UML Class diagrams. Software Requirements and Design CITS 4401 Lecture 4

Chapter 2, Modeling with UML

Chapter 2, Modeling with UML, Part 2

Chapter 2, Modeling with UML

Design Patterns. Design Patterns

Chapter 2, Modeling with UML, Part 2

Chapter 2, lecture 1, Modeling with UML

Unified Modeling Language (UML)

Recap : UML artefacts. Black Box Requirements. Functional Specification. System. System. Test. Design. System. System. Development.

Software Engineering

CSE 308. UML Overview Use Case Diagrams. Reference. Class diagrams. Session 6 UML Intro/Use cases. Robert Kelly, B. Bruegge,

CSE 308. UML Overview Use Case Diagrams. Reference. en.wikipedia.org/wiki/class_diagram. Robert Kelly, B. Bruegge,

Unified Modeling Language (UML)

Modern methods in Software Engineering UML.

2. Modeling with UML

Overview of the OOA Process...

Software Service Engineering

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

Chapter 5, Analysis: Dynamic Modeling

Object Oriented Modeling

Introduction to Software Engineering. 5. Modeling Objects and Classes

CMSC 132: Object-Oriented Programming II

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

Meltem Özturan

UML 2.0 State Machines

Engineering Design w/embedded Systems

Lecture 16+17: Modeling with UML

Lecture 15: Modeling with UML

Introduction to Software Engineering. 6. Modeling Behaviour

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

Course 3 7 March

Object-Oriented and Classical Software Engineering

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

UML Primer. -Elango Sundaram

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

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

Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 09/29/2015

Index. Add Diagram > Sequence Diagram command,

UML: Unified Modeling Language

Introduction to Software Engineering. 5. Modeling Objects and Classes

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

SOFTWARE ENGINEERING UML FUNDAMENTALS. Saulius Ragaišis.

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

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

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

Software Engineering Fall 2014

12 Tutorial on UML. TIMe TIMe Electronic Textbook

Model Driven Development Unified Modeling Language (UML)

Ingegneria del Software Corso di Laurea in Informatica per il Management. Introduction to UML

Interactions A link message

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

Interaction Modelling: Sequence Diagrams

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

Object-Oriented Design

Chapter 4. Capturing the Requirements. 4th Edition. Shari L. Pfleeger Joanne M. Atlee

Introduction to Unified Modelling Language (UML)

Basic Structural Modeling. Copyright Joey Paquet,

The Unified Modeling Language User Guide

Lecture 17: (Architecture V)

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

Unified Modeling Language (UML)

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

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

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

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

Advanced Software Engineering

From Analysis to Design. LTOOD/OOAD Verified Software Systems

UML part I. UML part I 1/41

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

Unified Modeling Language

CS 451 Software Engineering

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

UML (Unified Modeling Language)

SOFTWARE MODELING AND DESIGN. UML, Use Cases, Patterns, and. Software Architectures. Ki Cambridge UNIVERSITY PRESS. Hassan Gomaa

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

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

Software Development Methodologies

CIS 771: Software Specifications

Course "Softwaretechnik" Book Chapter 5 Analysis: Dynamic Modeling

Metamodeling. Janos Sztipanovits ISIS, Vanderbilt University

Software Engineering Lab Manual

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

CS 370 REVIEW: UML Diagrams D R. M I C H A E L J. R E A L E F A L L

Developing Shlaer-Mellor Models Using UML

Page 1. Dynamic Modeling. How do you find classes? Dynamic Modeling with UML. UML Interaction Diagrams. UML State Chart Diagram.

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

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

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

Chapter 5, Analysis: Dynamic Modeling

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

UML Diagrams & And Some Of Their Elements

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

Models are used for several purposes. We believe that some of the most important are:

Transcription:

Course "Softwaretechnik Modeling with UML Stephan Salinger (Foliensatz/Inhalt: Lutz Prechelt, Bernd Bruegge, Allen H. Dutoit) Freie Universität Berlin, Institut für Informatik http://www.inf.fu-berlin.de/inst/ag-se/ Modeling, models and UML Static view: Class diagrams Dynamic view: Sequence diagrams Statechart diagrams Activity diagrams Other UML diagram types component d., collaboration d, deployment d., communication d., interaction overview d. UML Metamodel, Profiles Some notation details Classes, associations, interfaces, states [4] 1 / 59

What is modeling? Modeling consists of building an abstraction of reality Models ignore irrelevant details (i.e., they simplify) and only represent the relevant details What is relevant or irrelevant depends on the purpose of the model. We typically want to draw complicated conclusions about reality with simple steps in the model in order to get insights into the past or presence or make predictions Reality R: Real things, people, etc. Processes happening during some time Relationships between things etc. Model M: Abstractions of any or all of the above [4] 2 / 59

What is a "good" model? In a good model, relationships which are valid in reality R are also valid in model M. I : Mapping of reality R to the model M (abstraction) f M : relationship between abstractions in M f R : equivalent relationship between real things in R In a good model the following diagram is commutative: M! f M M! I R! R! f R I [4] 3 / 59

Models of models of models... Modeling is relative We can think of a model as reality and can build another model from it (with additional abstractions) The development of software systems is a transformation of models: Analysis, Design, Implementation M 2!. f M2 M 2! Analysis I 2 Requirements Elicitation M 1! f M1 f R M 1! R! R! I 1 [4] 4 / 59

Systems, models and views A model is an abstraction describing relevant aspects of a system A view ("Sicht") depicts selected aspects of a model Any view is a model itself Calling a model a view makes clear it is part of a larger model Complex models are often shown as many views only never as a whole A notation is a set of rules for depicting models graphically or textually Example: System: Aircraft Models: Flight simulator, scale model, construction plan, Views: All blueprints (e.g. electrical wiring, fuel system) [4] 5 / 59

What is UML? UML (Unified Modeling Language): The de-facto standard for software modeling For both requirements modeling (application domain) and software modeling (solution domain) A set of related notations Quite complex, we will use a subset only Resulted from the convergence of notations from three leading object-oriented methods: OMT (James Rumbaugh) OOSE (Ivar Jacobson) Booch (Grady Booch) The authors are known as "The Three Amigos" Supported by CASE tools http://de.wikipedia.org/wiki/uml-werkzeug [4] 6 / 59

Common UML diagram types Use Case diagrams (functional view) Catalog scenarios that describe the functional behavior of the system as seen by the user [see lecture "use cases"] Class diagrams / Object diagr. (static view and examples) Describe the static structure of the system: Classes, attributes, object associations (class diagram) or snapshots of possible resulting configurations (object diagram) Sequence diagrams (dynamic view examples) Describe examples of the dynamic behavior between objects of the system (and possibly actors) Statechart diagrams (dynamic view) Describe some aspects of the dynamic behavior of the individual object of a class by a finite state automaton Activity diagrams (dynamic view) Model the dynamic behavior of a system, in particular the workflow (essentially a flowchart, but with concurrency) [4] 7 / 59

Less common UML diagram types Hardly covered in this course: Implementation diagrams Component diagrams Deployment diagrams Communication diagrams Equivalent to sequence diagrams, but embedded in an object diagram (shows both static structure and dynamic interaction) Interaction overview diagrams Related to activity diagrams, for describing control flow There is also a non-graphical language for expressing conditions: Object constraint language (OCL) Introduced in lecture on Object Design [4] 8 / 59

UML core conventions Diagrams are mostly graphs Nodes are entities Edges are relationships between entities Rectangles are classes or instances Ovals are functions or use cases An instance is denoted with an underlined name mywatch:simplewatch or with no type: mywatch Joe:Firefighter or with no name: :Firefighter A type is denoted with a non-underlined name SimpleWatch Firefighter [4] 9 / 59

UML class diagrams Class diagrams represent the structure of the system Association Class Multiplicity 2 state push() release() Attribute PushButton 1 1 LCDDisplay blinkidx blinkseconds() blinkminutes() blinkhours() stopblinking() refresh() Operations Watch 1 1 1 2 Battery load 1 Time now [4] 10 / 59

Class diagrams: Classes Name TariffSchedule Table zone2price Enumeration getzones() Price getprice(zone) TariffSchedule zone2price getzones() getprice() Attributes Operations Signature TariffSchedule A class represents a concept A class encapsulates state (attributes) and behavior (operations) Each attribute has a type Each operation has a signature But the class name is the only mandatory information in a UML class description [4] 11 / 59

Instances ("Exemplare", "Objekte") tariff1974:tariffschedule zone2price = { { 1,.20}, { 2,.40}, { 3,.60}} An instance represents a phenomenon The name of an instance is underlined and may indicate the class of the instance May indicate instance name or class or both Attributes may be represented with their values [4] 12 / 59

Associations TariffSchedule TripLeg Iterator getzones() Price getprice(zone) n m Price Zone Associations denote relationships between classes The multiplicity of an association end denotes how many objects the source object can legitimately reference: Any one TariffSchedule object is associated with m TripLeg objects Any one TripLeg object is associated with n TariffSchedule objects n and m can be numbers ("5") or ranges ("1..5") A missing annotation means 1 Informally, if there are no annotations anywhere, it may also mean * * means "arbitrarily many" (zero, one, or several) [4] 13 / 59

1-to-1 and 1-to-many associations Country City 0..1 Capital 1 name:string name:string One-to-one association Too restrictive?: Some countries have a separate seat of government Polygon draw() 1 * Point x: Integer y: Integer Too flexible?: Does a Polygon with 0, 1, or 2 Points really make sense? One-to-many association [4] 14 / 59

Many-to-many associations Problem Statement: "A stock exchange lists many companies. Each company is uniquely identified by a ticker symbol." StockExchange * lists * Company tickersymbol StockExchange * tickersymbol lists 0..1 (Now a Company could have different tickersymbols at each StockExchange) Company [4] 15 / 59

Aggregation An aggregation is a special case of association denoting a "consists of"/"is part of" hierarchy The object representing the whole is called the aggregate, the objects representing the parts are called components Exhaust system Exhaust system 1 0..2 1 0..2 Muffler Tailpipe Muffler Tailpipe diameter diameter diameter diameter A solid diamond denotes composition, a strong form of aggregation where components never exist without the aggregate The association is in force TicketMachine throughout the life of the parts objects 3 ZoneButton [4] 16 / 59

Inheritance (Java: "extends") Button CancelButton ZoneButton The children classes inherit the attributes and operations of the parent class Read the triangle as an arrowhead, meaning "inherits from" CancelButton inherits from Button ZoneButton inherits from Button [4] 17 / 59

Realization (Java: "implements") [4] 18 / 59

Example: Plato s and Aristotle s world views Plato Aristotle Reality Reality * Thing * Substance Form Matter Particular Form [4] 19 / 59

Association classes Individual associations between objects can have attributes Described by an association class [4] 20 / 59

Association constraints Associations can be described by further details: [4] 21 / 59

Class diagrams: theater example..and some more notation details: role name (XOR) constraint static operation [4] 22 / 59

Packages A package is a UML mechanism for organizing elements (e.g. classes or whole class diagrams) into groups Does not usually represent an application domain concept Packages are the basic grouping construct with which you may organize UML models to increase their readability DispatcherInterface Notification IncidentManagement A complex system can be decomposed into subsystems, where each subsystem is modeled as a package [4] 23 / 59

UML sequence diagrams :TicketMachine Passenger selectzone() insertcoins() pickupchange() pickupticket() Used during requirements analysis To refine use case descriptions to find additional objects ("participating objects") Used during system design to refine subsystem interfaces Objects are represented by columns (objname:classname) Messages are represented by arrows Activations are represented by narrow rectangles Lifelines are represented by dashed lines [4] 24 / 59

Nested messages Passenger :ZoneButton :TariffSchedule :Display selectzone() lookupprice(selection) Dataflow price displayprice(price) to be continued... The source of an arrow indicates the activation which sent the message An activation is as long as all nested activations (for normal calls) Horizontal dashed arrows indicate data flow Vertical dashed lines indicate lifelines [4] 25 / 59

Sequence diagram: theater example external call, external return [4] 26 / 59

Advanced features creation nesting iteration conditions, branching destruction [4] 27 / 59

Sequence diagram summary UML sequence diagrams represent behavior in terms of object interactions Useful to find missing objects Useful for explaining design ideas Describes examples only, no general specification dynamic view Time-consuming to build, but may be worth it static view Complement the class diagrams (which represent structure) [4] 28 / 59

Statechart diagrams Initial state Action Event Transition Activity State [4] 29 / 59

Transitions can be subject to guard conditions [4] 30 / 59

Parallel (orthogonal) states, explicit exits [4] 31 / 59

A transition is the consequence of an event [4] 32 / 59

There can be multiple transitions at one state Actions can be annotated inside the state box to avoid redundancy also: do / some_activity for an activity occuring throughout the state [4] 33 / 59

Activity Diagrams An activity diagram shows flow control within a system Handle Incident Document Incident Archive Incident A simple activity diagram is a special case of a statechart diagram in which states are activities ("functions") Two types of states: Action state: Cannot be decomposed any further Happens "instantaneously" with respect to the level of abstraction used in the model Activity state: Can be decomposed further The activity is modeled by another activity diagram [4] 34 / 59

Statechart diagram vs. activity diagram Statechart diagram for Incident (similar to Mealy Automaton) (State represents some set of attribute values) Event causes State transition Active Inactive Closed Archived Incident- Incident- Incident- Handled Documented Archived Activity diagram for Incident (similar to Moore Automaton) (State represents some collection of operations) Handle Incident Document Incident Archive Incident Completion of activity causes state transition Completion Transition [4] 35 / 59

Activity diagram: decisions Open Incident [lowpriority] [fire & highpriority] Allocate Resources [not fire & highpriority] Notify Fire Chief Notify Police Chief [4] 36 / 59

Activity diagrams: concurrency Synchronization of multiple activities Splitting the flow of control into multiple threads corresponds to split states as seen above Splitting Allocate Resources Synchronization Open Incident Coordinate Resources Archive Incident Document Incident [4] 37 / 59

Activity diagrams: theater example [4] 38 / 59

Further UML diagram types Static view: Component diagrams, internal structure diagram Subsystems (components) and their interfaces Deployment diagrams Computers and which part of the system runs on which Dynamic view: Communication diagrams Equivalent to sequence diagrams, but embedded in an object diagram (shows both static structure and dynamic interaction) Interaction overview diagrams Related to activity diagrams, for describing control flow [4] 39 / 59

Components Components represent classes or subsystems (multiple classes) The focus is on their interfaces [4] 40 / 59

Component diagram, internal structure diagram Compositions of components Component diagram: any composition Internal structure diagram: forming another component [4] 41 / 59

Collaboration diagram A view describing the associations of objects (instances!) for one specific purpose only and describing the objects' roles for that context [4] 42 / 59

Deployment diagram for distributed systems: describes which code runs on which computer ("node") [4] 43 / 59

Communication diagram An object diagram with interaction annotations Indicates interactions (like a sequence diagram) as well as object relationships (by the object diagram) [4] 44 / 59

Interaction overview diagram A combination of activity diagram and sequence diagram: activities may be sequence diagram fragments [4] 45 / 59

Diagram types overview (UML 2.2) source: Wikimedia Commons [4] 46 / 59

UML is described in UML itself The UML model describing UML is called the UML metamodel It consists of UML class diagrams plus descriptive text Class level: Every kind of UML element (e.g. "association") is a class in that metamodel The characteristics are described by attributes or associated classes e.g. the UML metamodel contains a class Association Instance level: Every association in a specific UML model can be interpreted as an instance of the Association class in the UML metamodel But actually there is much more than just one class: [4] 47 / 59

The UML Metamodel of associations Source: UML 2.0 Superstructure, section 7.2 http://www.omg.org [4] 48 / 59

UML is extensible Profiles add elements to the UML metamodel A profile is a package that defines «stereotypes» and constraints that can be applied to certain metamodel elements stereotype of the metamodel stereotype of the EJB profile [4] 49 / 59

UML is fairly precise In this course, we will be using UML in a rather informal and imprecise manner Our models are usually not very detailed They leave many things unspecified (i.e., they are incomplete) However, one can produce fairly precise UML models Such models have a reasonably well-defined meaning, as UML itself is specified in a semi-formal manner No complete semantics have been specified for UML overall, though There is much more to UML than can be said here UML Infrastructure document: 200 pages UML Superstructure document: 800 pages Precise UML usage is relevant for automatic code generation from the UML model In some domains, such as telecommunication, complete subsystems are sometimes code-generated from UML models today [4] 50 / 59

What should you know about UML? For all application domains: Learn as much as you can about class diagrams (object diagrams help in doing this) (soon probably also component diagrams) Learn the basics of use case, sequence, communication, statechart, and activity diagrams For realtime and formally specifiable (sub)domains: Also learn a lot about statechart diagrams If you want to make full use of UML CASE tools: Learn a lot about packages and about profiles If you want to build UML CASE tools: Learn about the UML metamodel (Warning: tough!) [4] 51 / 59

UML summary UML provides a wide variety of notations for representing many aspects of software development Powerful, but complex language Can be misused to generate unreadable models Can be misunderstood when using too many exotic features Many people who claim to "know UML" actually know very little For now we concentrate on a few notations: Functional model: Use case diagram Object model: class diagram Dynamic model: sequence diagrams, statechart and activity diagrams [4] 52 / 59

Literature James Rumbaugh, Ivar Jacobson, Grady Booch: "The Unified Modeling Language Reference Manual", Second Edition (UML 2.0), Addison-Wesley 2005. this is also the source of the figures with blue annotations James Rumbaugh, Ivar Jacobson, Grady Booch: "The Unified Modeling Language User Guide", Second Edition (UML 2.0), Addison-Wesley 2005. actually teaches how to use the UML this lecture did not do this, but some of the rest of the course will less misleading than some other books on the topic The current version of UML is 2.3 (May 2010). [4] 53 / 59

Thank you! [4] 54 / 59

UML language elements details The next few slides present a number of details in the notation of Classes (Class diagrams) Associations (Class diagrams) Interfaces (Class diagrams) States (Statechart and Activity diagrams) [4] 55 / 59

Details: Class [4] 56 / 59

Details: Association [4] 57 / 59

Details: Interfaces [4] 58 / 59

Details: States And for activity diagrams: Action: a primitive operation i.e., primitive at the UML level Activity: a composite operation describable as an activity diagram, i.e., composed of actions, other activities, splits, joins, branches, loops etc. [4] 59 / 59