PolarSys - Clemson University

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?
◦ It’s an abstraction of a ‘thing’. Lets look at some models.
Architectural Models
Scientific Models
Mathematical Models
High Level Models
Low Level Models
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)
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…
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
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
UML: Types of Models
BEHAVIORAL
STRUCTURAL
Profile
Activity
Class
Use Case
Composite Structure
State Machine
Component
Interaction
Deployment
Object
Package
◦
◦
◦
◦
Sequence
Timing
Communication
Interaction Overview
UML Diagram of UML Diagrams
It’s so meta
UML Diagrams
We’re only concerned with two diagrams right now:
◦ Use Case Diagram
◦ Requirements Diagram
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.
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?
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.
Lets do a UML diagram
Pretend we’re going out to dinner.
Who are the actors?
Lets do a UML diagram
Pretend we’re going out to dinner.
Who are the actors?
◦
◦
◦
◦
Waiter
Cashier
Chef
Client
Use Case Discussion
When would we create a Use Case Diagram?
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?
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?
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.
Use Case Discussion
What are the limitations of Use Cases?
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.
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.
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.
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.
Important Links
http://polarsys.org/downloads/
http://en.wikipedia.org/wiki/Unified_Modeling_Language
http://www.uml.org/
http://www.methodsandtools.com/archive/archive.php?id=76
Extra
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