CPSC 371/872 UML / SysML Modeling

33
CPSC 371/872 UML / SysML Modeling J. YATES MONTEITH, CLEMSON UNIVERSITY, FALL 2014

description

CPSC 371/872 UML / SysML Modeling. J. Yates Monteith , Clemson University, Fall 2014. UML Modeling. Contents Modeling UML Modeling A brief history of UML Types of Models A Quick Exercise? SysML Modeling PolarSys. What is Modeling?. What is a model? - PowerPoint PPT Presentation

Transcript of CPSC 371/872 UML / SysML Modeling

Page 1: CPSC  371/872 UML /  SysML Modeling

CPSC 371/872UML / SysML ModelingJ. YATES MONTEITH, CLEMSON UNIVERSITY, FALL 2014

Page 2: CPSC  371/872 UML /  SysML Modeling

UML Modeling Contents

◦ Modeling◦ UML Modeling

◦ A brief history of UML◦ Types of Models◦ A Quick Exercise?

◦ SysML Modeling◦ PolarSys

Page 3: CPSC  371/872 UML /  SysML Modeling

What is Modeling? What is a model?

◦ It’s an abstraction of a ‘thing’. Lets look at some models.

Page 4: CPSC  371/872 UML /  SysML Modeling

Architectural Models

Page 5: CPSC  371/872 UML /  SysML Modeling

Scientific Models

Page 6: CPSC  371/872 UML /  SysML Modeling

Mathematical Models

Page 7: CPSC  371/872 UML /  SysML Modeling

High Level Models

Page 8: CPSC  371/872 UML /  SysML Modeling

Low Level Models

Page 9: CPSC  371/872 UML /  SysML Modeling

What is Modeling? What is a model?

◦ It’s an abstraction of a ‘thing’. ◦ A model is used to represent something else.◦ A model is used to describe and convey information and understanding about the thing which it

represents.

What is a model in Software and Systems Engineering?◦ Just a pretty picture.◦ Eratta: A pretty picture that [hopefully] has some semantic meaning.

Models help us specify a piece of software's design in a more abstract way than source code itself.

And we’ll accomplish this through the Unified Modeling Language (UML)

Page 10: CPSC  371/872 UML /  SysML Modeling

Unified Modeling Language (UML)

UML is a standardized general purpose modeling standard.◦ Standardized in the same way that JavaDocs, Java code, naming conventions, etc are standardized.◦ General purpose in that it can model nearly any type of application.

UML is primarily object oriented.◦ It could be used in non-OO systems, but a little tougher, a little less expressive.

Standard way to visualize◦ Activities and Actors◦ Programming Structures and Software Components◦ Deployment Models and Physical Models.

And much much more…

Page 11: CPSC  371/872 UML /  SysML Modeling

UML: A [Very] Brief History Object Oriented Languages Modeling languages

◦ During the 1980s and 1990s, during the rise OO Programming, tons of modeling languages existed.◦ Needed something better.◦ Too many languages meant our models might not work with other organizations models.

UML unified the best in modeling techniques at the time:◦ Jacobsen

◦ Use Classes

◦ Rumbaugh (OMT)◦ Object Models (Object Diagrams)◦ Dynamic Models (State Machines)◦ Functional Models (Process Models)

◦ Booch◦ Class Diagrams

Page 12: CPSC  371/872 UML /  SysML Modeling

So why modeling and UML? By providing a non-textual way of specifying a software system, models provide us with:

◦ An at-a-glance view of a software system◦ A method of documentation that can be ingested and digested easier than a bajillion lines of source.◦ Modeling also provides us with a mechanism for delivering different stakeholder views of a system.

◦ We might not want to provide the same information to the CEO as we do the Project Manager

Page 13: CPSC  371/872 UML /  SysML Modeling

UML: Types of Models

Profile

Class

Composite Structure

Component

Deployment

Object

Package

Activity

Use Case

State Machine

Interaction◦ Sequence◦ Timing◦ Communication◦ Interaction Overview

BEHAVIORAL STRUCTURAL

Page 14: CPSC  371/872 UML /  SysML Modeling

UML Diagram of UML Diagrams

It’s so meta

Page 15: CPSC  371/872 UML /  SysML Modeling

UML Diagrams We’re only concerned with two diagrams right now:

◦ Use Case Diagram◦ Requirements Diagram

Page 16: CPSC  371/872 UML /  SysML Modeling

My Most Used Model: Use Case Pronounced YOUS-CASE

Depicts a set of high level functionalities from the perspective of different actors.

What is an actor?◦ Anyone or anything that will interact with the system. Usually stick figures. With top hats.

What is a YOUS-CASE?◦ High level functionality that is associated with various actors or other Use Cases through relationships.

Usually a circle. With top hats.

Page 17: CPSC  371/872 UML /  SysML Modeling

Use Case Composed from Scenarios.

◦ Scenarios are English description of a high level functionality. Scenarios are engineered during Requirements Ellicitation/Specification.

Example Scenario:◦ “User is typing an SMS message and receives a phone call. Incomplete message is stored in local

memory during call and recalled once call is completed.”

What sort of Use Cases do we see here?

Page 18: CPSC  371/872 UML /  SysML Modeling

Use Case Composed from Scenarios.

◦ Scenarios are English description of a high level functionality. Scenarios are engineered during Requirements Ellicitation/Specification.

Example Scenario:◦ “User is typing an SMS message and receives a phone call. Incomplete message is stored in local

memory during call and recalled once call is completed.”

What sort of Use Cases do we see here?◦ A single scenario incorporates multiple use cases.◦ Many scenarios might incorporate the same use case.

Page 19: CPSC  371/872 UML /  SysML Modeling

Lets do a UML diagram Pretend we’re going out to dinner.

Who are the actors?

Page 20: CPSC  371/872 UML /  SysML Modeling

Lets do a UML diagram Pretend we’re going out to dinner.

Who are the actors?◦ Waiter◦ Cashier◦ Chef◦ Client

Page 21: CPSC  371/872 UML /  SysML Modeling

Use Case Discussion When would we create a Use Case Diagram?

Page 22: CPSC  371/872 UML /  SysML Modeling

Use Case Discussion When would we create a Use Case Diagram?

◦ Requirements Specification phase. We specify the software via scenarios, and scenarios = {Use Cases}

What do we use Use Cases?

Page 23: CPSC  371/872 UML /  SysML Modeling

Use Case Discussion When would we create a Use Case Diagram?

◦ Requirements Specification phase. We specify the software via scenarios, and scenarios = {Use Cases}

What do we use Use Cases for?◦ Everything. Literally everything.

◦ Requirements Analysis◦ Test Planning◦ Client Communication◦ Even more

When do we use the Use Case Diagram?

Page 24: CPSC  371/872 UML /  SysML Modeling

Use Case Discussion When would we create a Use Case Diagram?

◦ Requirements Specification phase. We specify the software via scenarios, and scenarios = {Use Cases}

What do we use Use Cases for?◦ Everything. Literally everything.

◦ Requirements Analysis◦ Test Planning◦ Client Communication◦ Even more

When do we use the Use Case Diagram?◦ Every phase of the SDLC.

Page 25: CPSC  371/872 UML /  SysML Modeling

Use Case Discussion What are the limitations of Use Cases?

Page 26: CPSC  371/872 UML /  SysML Modeling

Use Case Discussion What are the limitations of Use Cases?

◦ They are difficult to write. There’s a lot of research on how to write good Use Cases.◦ They don’t reflect non-functional requirements. At all.

◦ That’s not the point, but they don’t reflect those.

Page 27: CPSC  371/872 UML /  SysML Modeling

SysML UML was great for specifying software products

◦ Structural diagrams allowed us to specify the structure of modules, classes and components.◦ Behavioral diagrams allowed us to specify the behavior and interaction of the programming structures.

But as software systems grew more complex, we needed more expressive models to help in the development of systems.

Enter SysML, the Systems Modeling Language.◦ SysML is an extension of the UML meta-model / profile that is primarily targeted at systems modeling.

◦ As opposed to software or source code modeling.

◦ Managed by the Object Management Group.◦ Adds several additional diagrams to the UML Profile.◦ Notably the Requirements diagram.

Page 28: CPSC  371/872 UML /  SysML Modeling

Modeling Tools Lots of tools exist for performing UML and SysML Modeling.

Some can reverse engineer models from code◦ Take code and create a model from it.

Some can forward engineer code from models◦ Take a model and generate code from it.

Some can perform round trip engineering◦ Take a (Model or Code) and generate / forward engineer (Code or Models)◦ Take the generated (Code or Models) and generate / reverse engineer (Models or Code) from them.◦ Ensure consistency.

Many tools exist:◦ Bouml, TopCASED, PolarSys, others…

Lets look at PolarSys and see if we can do some modeling.

Page 29: CPSC  371/872 UML /  SysML Modeling

PolarSys – Getting Started Step 1: Download and Install the PolarSys IDE

◦ Located at: http://polarsys.org/downloads/◦ Current version: 1.*?◦ Available for Linux/GTK and Windows. Should also work on Mac, because Eclipse Java and Mac GTK

Step 2: Unzip into the C:\ directory or another ‘short’ base directory (/opt would work well).◦ Using another base directory might result in path names that are too long, especially on Windows.

Step 3: Install JDK 6u35.◦ You could also install JDK 7u* or perhaps 8u*. I have not used / tested it with JDK 7 or 8.

Step 4: Open the folder at the extraction point and launch the polarsys application.

Page 31: CPSC  371/872 UML /  SysML Modeling

Extra

Page 32: CPSC  371/872 UML /  SysML Modeling

My Favorite Diagram: Class Diagrams

Used to specify a class and◦ Member Variables and Methods◦ Visibility of Methods and Variables◦ The classes relations to other classes.

Relations to other classes are specified through a number of connectors.◦ Association (Relation) – Uni/Bi directional containment, possibly reflexive, possibly aggregating.◦ Aggregation: “Has-A” Class contains a structure containing multiple instances of another class.◦ Composition: “Owns-A” Slightly different from Aggregation.◦ Generalization: “Is-A” Think inheritance hierarchies

Page 33: CPSC  371/872 UML /  SysML Modeling