Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.

Slides:



Advertisements
Similar presentations
Notice: Surgery Sessions (Weeks 6-10)
Advertisements

Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Software analysis and design tools T120B pavasario sem.
Slides by Bruegee and Dutoit, Modified by David A. Gaitros COP 3331 Object Oriented Analysis and Design Chapter 2: Object Oriented Modeling using UML Jean.
Chapter 2, Modeling with UML, Part 2
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Chapter 3,Class Diagram.
Chapter 2, Modeling with UML
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 UML First Pass: Class Diagrams Battery load()
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 UML Sequence Diagrams  Used during system.
Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Software Engineering September 5, 2001 Introduction.
Using UML, Patterns, and Java Object-Oriented Software Engineering Modeling with UML Chapter 2 Object-Oriented Software Engineering: Using UML, Patterns,
Unified Modeling Language (UML)
1 Modeling with UML CMPE 131 Fall Overview What is modeling? What is UML? Use case diagrams Class diagrams Sequence diagrams Activity diagrams.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Introduction to UML CS A401. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Course information and deadline reminders
COP 3331 Object-Oriented Analysis and Design 1 Modeling and UML  UML = Unified Modeling Language  Graphical Notation  Topics  Modeling  Basics of.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
© SERG Software Design (UML) Software Design Static Modeling using the Unified Modeling Language (UML) Material based on [Booch99, Rambaugh99, Jacobson99,
Introduction to Software Engineering ECSE-321 Unit 5 – Modeling with UML.
Modeling with UML Chapter 2 Object-Oriented Software Engineering: Using UML, Patterns, and Java, 2 nd Edition By B. Bruegge and A. Dutoit Prentice Hall,
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
UNB CS3013 Software Engineering II lectures adapted from Bernd Bruegge & Allen Dutoit, Object-Oriented Software Engineering: Conquering Complex and Changing.
Chapter 2, Modeling with UML, Part 2
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: Review Session (Optional)
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: Review Session (Optional)
Sept. 25, 2003CS WPI1 CS 509 Design of Software Systems Lecture #4 Thursday, Sept. 25, 2003.
UML Review of diagram types. 2 Unified Modeling Language The Unified Modeling Language™ (UML) was developed jointly by Grady Booch, Ivar Jacobson, and.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Software Engineering September 19, 2001 UML.
Jan. 26, 2004CS WPI1 CS 509 Design of Software Systems Lecture #2 Monday, Jan. 26, 2004.
Introduction to UML 임현승 강원대학교 Revised from the slides by Bernd Bruegge and Allen H. Dutoit for the book “Object-Oriented Software Engineering: Using UML,
Using UML, Patterns, and Java Object-Oriented Software Engineering More on UML Note: Slides are adapted by Linda Sherrell from the Software Engineering.
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
COP 3331 OBJECT-ORIENTED ANALYSIS AND DESIGN Bob Myers Department of Computer Science.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
UML Review of Use case diagrams. 2 Unified Modeling Language The Unified Modeling Language™ (UML) was developed jointly by Grady Booch, Ivar Jacobson,
UML Review Overview: modeling with UML  What is modeling?  What is UML?  Use case diagrams  Class diagrams  Sequence diagrams  Activity diagrams.
CEN 5011 Advanced Software Engineering
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
1 Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 14 Slide 1 Object-Oriented Design.
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.
L5-1. L5-2 Recap : UML artefacts Black Box Requirements System Design System Development System Test System Validation Functional Specification Actors.
Chapter 2, Modeling with UML
UML Review.
Modeling with UML Chapter 2
Chapter 2, Modeling with UML, Part 2
Chapter 2, Modeling with UML
Introduction to UML.
Introduction to UML.
Before we start Project Group A note about class project ArgoUML
CS410 – Software Engineering Lecture #17: UML I
Chapter 2, Modeling with UML
Introduction to Unified Modeling Language (UML)
Chapter 2, Modeling with UML
Chapter 2, Modeling with UML
Chapter 2, Modeling with UML
Chapter 2, Modeling with UML
Chapter 2, Modeling with UML
Chapter 2, Modeling with UML
Recap : UML artefacts Black Box Requirements Functional Specification
CS410 – Software Engineering Lecture #9: UML
Chapter 2, Modeling with UML
Presentation transcript:

Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 2 Overview  What is modeling?  What is UML?  Use case diagrams  Class diagrams  Sequence diagrams  Activity diagrams  Summary

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 3 Systems, Models, and Views  A model is an abstraction describing system or a subset of a system  A view depicts selected aspects of a model  A notation is a set of graphical or textual rules for representing views

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 4 Systems, Models, and Views Airplane Flightsimulator Scale Model Blueprints Electrical Wiring

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 5 Why model software? Software is already an abstraction: why model software?  Software is getting larger  NT 5.0 ~ 40 million lines of code  A single programmer cannot manage this amount of code.  Code is often not directly understood by those who did not develop it  We need simpler representations for complex systems  Modeling is a means for dealing with complexity

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 6 Concepts and Phenomena  Phenomenon: An object in a domain as you perceive it, e.g.:  The lecture you are attending  My black watch  Concept: The common properties of phenomena, e.g.:  Lectures on software engineering  Black watches  A concept is a 3-tuple:  Its Name distinguishes it from other concepts.  Its Members are the phenomena represented by the concept.  Its Purpose is the set of properties that characterize its members.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 7  Abstract: Classification of phenomena into concepts  Model: Develop abstractions to answer specific questions about a set of phenomena, ignoring irrelevant details. MembersName Clock Purpose A device that measures time. Concepts and Phenomena

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 8 Class  Class: An abstraction in the context of OO languages  Like an abstract data type, a class encapsulates both state (variables) & behavior (methods)  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

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 9 Object-Oriented Modeling UML Package

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 10 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

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 11 What is UML?  UML (Unified Modeling Language)  A language for modeling object-oriented (OO) software.  It is the convergence of notations from 3 OO methods:  OMT (James Rumbaugh)  OOSE (Ivar Jacobson)  Booch (Grady Booch)  Reference: “The Unified Modeling Language User Guide”, Addison Wesley,  Supported by several CASE tools  Rational ROSE  Together/J ...

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 12 UML and This Course  You can model 80% of most problems with 20% of UML  We look at that 20%

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 13 UML First Pass  Use case diagrams  Describe the function of the system as seen by the user.  Class diagrams  Describe the system’s static structure: Objects, Attributes, & Associations.  Sequence diagrams  Describe the dynamic behavior between actors & the system & between the system’s objects.  Statechart diagrams  Describe the dynamic behavior of an individual object as a finite state machine.  Activity diagrams  Model the dynamic behavior of a system as a flowchart.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 14 UML First Pass: Use Case Diagrams WatchUserWatchRepairPerson ReadTime SetTime ChangeBattery Actor Use case Package SimpleWatch Use case diagrams represent the functionality of the system from user’s point of view

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 15 UML First Pass: Class Diagrams Battery load() 1 2 Time now() PushButton state push() release() blinkIdx blinkSeconds() blinkMinutes() blinkHours() stopBlinking() referesh() LCDDisplay SimpleWatch Class Association Multiplicity Attributes Operations Class diagrams represent the structure of the system

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 16 UML First Pass: Sequence Diagram Object Message Activation Sequence diagrams represent the behavior as interactions blinkHours() blinkMinutes() incrementMinutes() refresh() commitNewTime() stopBlinking() pressButton1() pressButton2() pressButtons1And2() pressButton1() :WatchUser :Time:LCDDisplay:SimpleWatch

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 17 button1&2Pressed button1Pressed button2Pressed button1Pressed button1&2Pressed Increment Minutes Increment Hours Blink Hours Blink Seconds Blink Minutes Increment Seconds Stop Blinking UML First Pass: Statechart Diagrams State Initial state Final state Transition Event

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 18 Other UML Notations Other UML notations may be introduced in subsequent lectures.  Implementation diagrams  Component diagrams  Deployment diagrams  For System Design  Object Constraint Language (OCL)  For Object Design

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 19 UML Core Conventions  Rectangles are classes or instances  Ovals are functions or use cases  Instance names are underlined  myWatch:SimpleWatch  Joe:Firefighter  Class names are not underlined  SimpleWatch  Firefighter

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 20 UML Second Pass: Use Case Diagrams Used during requirements elicitation to represent external behavior  Actors represent roles, that is, a type of user of the system  Use cases represent a sequence of interaction for a type of functionality  The use case model is the set of all use cases.  It is a complete description of the functionality of the system & its environment Passenger PurchaseTicket

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 21 Actors  An actor models an external entity that communicates with the system:  User  External system  Physical environment  An actor has a unique name & an optional description.  Examples:  Passenger: A person in the train  GPS satellite: Provides the system with GPS coordinates Passenger

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 22 Use Case A use case represents a class of functionality provided by the system as an event flow. A use case consists of:  Unique name  Participating actors  Entry conditions  Flow of events  Exit conditions  Special requirements PurchaseTicket

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 23 Use Case Example Name: Purchase ticket Participating actor: Passenger Entry condition:  Passenger standing in front of ticket distributor.  Passenger has sufficient money to purchase ticket. Exit condition:  Passenger has ticket. Event flow: 1. Passenger selects the number of zones to be traveled. 2. Distributor displays the amount due. 3. Passenger inserts money, of at least the amount due. 4. Distributor returns change. 5. Distributor issues ticket. Anything missing ? Exceptional cases!

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 24 The > Relationship  > relationships represent exceptional or seldom invoked cases.  Exceptional event flows are factored out of the main event flow for clarity.  Use cases representing exceptional flows can extend more than 1 use case.  The direction of an > relationship is to the extended use case Passenger PurchaseTicketTimeOut > NoChange > OutOfOrder > Cancel >

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 25 Passenger PurchaseSingleTicketPurchaseMultiCardNoChange > Cancel > CollectMoney > The > Relationship  An > relationship represents behavior that is factored out of the use case.  An > represents behavior that is factored out for reuse.  The direction of a > relationship is to the using use case.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 26 Class Diagrams  Class diagrams represent the structure of the system.  Class diagrams are used  during requirements analysis to model problem domain concepts  during system design to model subsystems & interfaces  during object design to model classes. Enumeration getZones() Price getPrice(Zone) TariffSchedule * * Trip zone:Zone price:Price

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 27 Classes  A class represent a concept.  A class encapsulates state (attributes) and behavior (operations).  Each attribute has a type.  Each operation has a signature.  The class name is the only mandatory information. zone2price getZones() getPrice() TariffSchedule Table zone2price Enumeration getZones() Price getPrice(Zone) TariffSchedule Name Attributes Operations Signature TariffSchedule

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 28 Instances  An instance represents a phenomenon.  An instance name is underlined & can contain the class name.  The attributes are represented with their values. zone2price = { {‘1’,.20}, {‘2’,.40}, {‘3’,.60}} tariff_1974:TariffSchedule

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 29 Actor vs. Instances  What is the difference between an actor, a class & an instance?  Actor:  An entity outside the system to be modeled, interacting with the system (“Pilot”)  Class:  An abstraction modeling an entity in the problem domain, inside the system to be modeled (“Cockpit”)  Object:  A specific instance of a class (“Joe, the inspector”).

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 30 Associations  Associations denote relationships between classes.  The multiplicity of an association end denotes how many objects the source object can legitimately reference. Enumeration getZones() Price getPrice(Zone) TarifSchedule * price zone TripLeg *

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 31 1-to-1 and 1-to-Many Associations 1-to-1 association 1-to-many association * draw() Polygon x:Integer y:Integer Point 1 Has-capital name:String Country name:String City 11

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 32 Aggregation  An aggregation is a special case of association denoting a “consists of” hierarchy.  The aggregate is the class containing the components classes. 1 Exhaust SystemMufflerTailpipe 0..2

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 33 Composition  A solid diamond denote composition, a strong form of aggregation where components cannot exist without the aggregate. 3 TicketMachine ZoneButton

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 34 Generalization  Generalization is an inheritance relationship.  Child classes inherit the parent class’s attributes & operations.  Generalization simplifies the model by eliminating redundancy. Button ZoneButtonCancelButton

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 35 From Problem Statement to Code Problem Statement A stock exchange lists many companies. Each company is identified by a ticker symbol Class Diagram Java Code public class StockExchange { public Vector m_Company = new Vector(); }; public class Company { public int m_tickerSymbol; public Vector m_StockExchange = new Vector(); }; * StockExchange tickerSymbol Company * lists

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 36 UML Sequence Diagrams  Used during requirements analysis  To refine use case descriptions  to find additional objects (“participating objects”)  Used during system design  to refine subsystem interfaces  Classes are represented by columns  Messages are represented by  Activations are represented by  Lifelines are represented by selectZone() pickupChange() pickUpTicket() insertCoins() Passenger TicketMachine

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 37 UML Sequence Diagrams: Nested Messages  An arrow’s source indicates is activation that sent the message  An activation is as long as all nested activations selectZone() Passenger ZoneButton TariffScheduleDisplay lookupPrice(selection) displayPrice(price) price Dataflow …to be continued...

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 38 Sequence Diagram Observations  UML sequence diagrams represent behavior in terms of interactions.  Class diagrams represent structure.  Used to find participating objects.  Time consuming to build but worth the investment.

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 39 Activity Diagrams  An activity diagram shows flow control within a system  An activity diagram is a special case of a state chart diagram in which states are activities (“functions”)  Two types of states:  Action state:  Cannot be decomposed any further - atomic  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

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 40 Activity Diagram: Modeling Decisions

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 41 Activity Diagrams: Modeling Concurrency  Synchronization of multiple activities  Splitting the flow of control into multiple threads Synchronization Splitting Archive Incident Open Incident Document Incident Allocate Resources Coordinate Resources Concurrent Activities

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 42 Activity Diagrams: Swimlanes  Actions may be grouped into swimlanes to denote the object or subsystem that implements them. Archive Incident Dispatcher FieldOfficer Open Incident Document Incident Allocate Resources Coordinate Resources

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 43 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  We concentrate only on a few notations:  Functional model: use case diagram  Object model: class diagram  Dynamic model: sequence diagrams, statechart & activity diagrams