Modeling with UML Chapter 2, lecture 1, Overview: modeling with UML - - PDF document

modeling with uml chapter 2 lecture 1 overview modeling
SMART_READER_LITE
LIVE PREVIEW

Modeling with UML Chapter 2, lecture 1, Overview: modeling with UML - - PDF document

Object-Oriented Software Engineering Using UML, Patterns, and Java Modeling with UML Chapter 2, lecture 1, Overview: modeling with UML What is modeling? What is UML? Use case diagrams Class diagrams Sequence diagrams Bernd


slide-1
SLIDE 1

Using UML, Patterns, and Java

Object-Oriented Software Engineering

Chapter 2, lecture 1, Modeling with UML

slide-2
SLIDE 2

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2

Overview: modeling with UML

♦ What is modeling? ♦ What is UML? ♦ Use case diagrams ♦ Class diagrams ♦ Sequence diagrams

slide-3
SLIDE 3

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3

What is modeling?

♦ Modeling consists of building an abstraction of reality. ♦ Abstractions are simplifications because:

! They ignore irrelevant details and ! They only represent the relevant details.

♦ What is relevant or irrelevant depends on the purpose of the

model.

slide-4
SLIDE 4

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4

Example: street map

slide-5
SLIDE 5

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5

Why model software?

Why model software?

♦ Software is getting increasingly more complex

! Windows XP > 40 mio lines of code ! A single programmer cannot manage this amount of code in its entirety.

♦ Code is not easily understandable by developers who did not

write it

♦ We need simpler representations for complex systems

! Modeling is a mean for dealing with complexity

slide-6
SLIDE 6

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6

Systems, Models and Views

♦ A model is an abstraction describing a subset of a system ♦ A view depicts selected aspects of a model ♦ A notation is a set of graphical or textual rules for depicting views ♦ Views and models of a single system may overlap each other

Examples:

♦ System: Aircraft ♦ Models: Flight simulator, scale model ♦ Views: All blueprints, electrical wiring, fuel system

slide-7
SLIDE 7

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7

Systems, Models and Views

System View 1 Model 2 View 2 View 3 Model 1

Aircraft Flightsimulator Scale Model Blueprints Electrical Wiring

slide-8
SLIDE 8

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8

Models, Views and Systems (UML)

System Mode l View * * Depic t ed by Descr i bed by

Ai rp lane: Sys tem Bluepri n ts : V i ew Fue l Sys tem: V iew Elec t r i ca l Wi r i ng : V i ew Sca le Mode l : Mode l F l igh t Simulato r : Mode l

slide-9
SLIDE 9

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9

Concepts and Phenomena

Phenomenon

! An object in the world of a domain as you perceive it ! Example: The lecture you are attending ! Example: My black watch

Concept

! Describes the properties of phenomena that are common. ! Example: Lectures on software engineering ! Example: Black watches

Concept is a 3-tuple:

! Name (To distinguish it from other concepts) ! Purpose (Properties that determine if a phenomenon is a member of a concept) ! Members (The set of phenomena which are part of the concept)

slide-10
SLIDE 10

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10

♦ Abstraction

! Classification of phenomena into concepts

♦ Modeling

! Development of abstractions to answer specific questions about a set of phenomena while ignoring irrelevant details.

Members Name Clock Purpose A dev i ce that measures t i me.

Concepts and phenomena

slide-11
SLIDE 11

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11

Concepts in software: Type and Instance

♦ Type:

! An abstraction in the context of programming languages ! Name: int, Purpose: integral number, Members: 0 ,

  • 1

, 1 , 2 ,

  • 2

, . . .

♦ Instance:

! Member of a specific type

♦ The type of a variable represents all possible instances the

variable can take The following relationships are similar:

! “type” <–> “instance” ! “concept” <–> “phenomenon”

slide-12
SLIDE 12

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12

Abstract Data Types & Classes

♦ Abstract data type

! Special type whose implementation is hidden from the rest of the system.

♦ Class:

! An abstraction in the context of object-

  • riented languages

♦ Like an abstract data type, a class

encapsulates both state (variables) and behavior (methods)

! Class Vector

♦ Unlike abstract data types, classes can be

defined in terms of other classes using inheritance

Watch time date CalculatorWatch SetDate(d) EnterCalcMode() InputNumber(n) calculatorState

slide-13
SLIDE 13

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13

Application and Solution Domain

♦ Application Domain (Requirements Analysis):

! The environment in which the system is operating

♦ Solution Domain (System Design, Object Design):

! The available technologies to build the system

slide-14
SLIDE 14

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14

Object-oriented modeling

Application Domain Solution Domain Application Domain Model System Model Ai rc ra f t Tra f f i cCont ro l l e r F l igh tP lan Ai rpor t MapDispl ay F l igh tP lanDatabase Su m maryDisp lay Tra f f i cCont ro l Tra f f i cCont ro l

UML Package

slide-15
SLIDE 15

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15

What is UML?

♦ UML (Unified Modeling Language)

! An emerging standard for modeling object-oriented software. ! Resulted from the convergence of notations from three leading

  • bject-oriented methods:

" OMT (James Rumbaugh) " OOSE (Ivar Jacobson) " Booch (Grady Booch)

♦ Reference: “The Unified Modeling Language User Guide”,

Addison Wesley, 1999.

♦ Supported by several CASE tools

! Rational ROSE ! TogetherJ

slide-16
SLIDE 16

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16

UML: First Pass

♦ You can model 80% of most problems by using about 20 %

UML

♦ We teach you those 20%

slide-17
SLIDE 17

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17

UML First Pass

♦ Use case Diagrams

! Describe the functional behavior of the system as seen by the user.

♦ Class diagrams

! Describe the static structure of the system: Objects, Attributes, Associations

♦ Sequence diagrams

! Describe the dynamic behavior between actors and the system and between objects of the system

♦ Statechart diagrams

! Describe the dynamic behavior of an individual object (essentially a finite state automaton)

♦ Activity Diagrams

! Model the dynamic behavior of a system, in particular the workflow (essentially a flowchart)

slide-18
SLIDE 18

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18

UML first pass: Use case diagrams

WatchUser WatchRepa i rPerson ReadT i me SetT ime ChangeBat te ry

Actor Use case Package

Watch

Use case diagrams represent the functionality of the system from user’s point of view

slide-19
SLIDE 19

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19

UML first pass: Class diagrams

1 2 push( ) re lease ( ) 1 1 b l ink Idx b l inkSeconds( ) b l inkMinut es ( ) b l inkHours ( ) s topBl inki ng ( ) re fe resh( ) LCDDisp l ay Bat te ry l

  • ad

1 2 1 T ime now 1 Watch

Class Association Multiplicity Attribute Operations Class diagrams represent the structure of the system

s ta te PushBut t

  • n
slide-20
SLIDE 20

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20

UML first pass: Sequence diagram

:LCDDisp lay b l inkHours ( ) b l inkMinutes ( ) re f resh ( ) com mi tNewTime( ) :T ime i nc rementMinu tes ( ) s topBl ink ing ( ) :Watch pressButton1 ( ) pressButton2 ( ) pressButtons1And2 ( ) pressButton1 ( ) :WatchUser

Object Message Activation Sequence diagrams represent the behavior as interactions Actor Lifeline

slide-21
SLIDE 21

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21

UML first pass: Statechart diagrams for objects with interesting dynamic behavior

BlinkHours BlinkMinutes IncrementHrs IncrementMin. BlinkSeconds IncrementSec. StopBlinking [button1&2Pressed] [button1Pressed] [button2Pressed] [button2Pressed] [button2Pressed] [button1Pressed] [button1&2Pressed] [button1&2Pressed]

State Initial state Final state Transition Event Represent behavior as states and transitions

slide-22
SLIDE 22

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22

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

♦ 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