Introduction To UML
Introduction To UML
Introduction To UML
Overview
What is Modeling? What is UML? A brief history of UML Understanding the basics of UML UML diagrams UML Modeling tools
Modeling
What is UML?
UML stands for Unified Modeling Language It is a industry-standard graphical language for specifying, visualizing, constructing, and documenting the artifacts of software systems The UML uses mostly graphical notations to express the OO analysis and design of software projects. Simplifies the complex process of software design
Use graphical notation to communicate more clearly than natural language (imprecise) and code(too detailed). Help acquire an overall view of a system.
UML is not dependent on any one language or technology. UML moves us from fragmentation to standardization.
History of UML
Use Case Diagram Class Diagram Sequence Diagram Collaboration Diagram State Diagram
Used for describing a set of user scenarios Mainly used for capturing user requirements Work like a contract between end user and software developers
Association: communication between an actor and a use case; Represented by a solid line.
Generalization: relationship between one general use case and a special use case (used for defining special alternatives) Represented by a line with a triangular arrow head toward the parent use case.
Use Case
Borrow
Employee
Client
Order Title
Fine Remittance
Supervisor
A generalized description of how a system will be used. Provides an overview of the intended functionality of the system
(TogetherSoft, Inc)
Class diagram
Used for describing structure and behavior in the use cases Provide a conceptual model of the system in terms of entities and their relationships Used for requirement capture, end-user interaction Detailed class diagrams are used for developers
Class representation
Name Attributes Operations + is used to denote Public visibility (everyone) # is used to denote Protected visibility (friends and derived) - is used to denote Private visibility (no one)
An example of Class
Name Attributes
Operations
OO Relationships: Generalization
Supertype
Example:
Customer
Regular Customer
Loyalty Customer
Subtype1
Subtype2
or:
Customer
- Generalization expresses a parent/child relationship among related classes. - Used for abstracting details in several layers
Regular Customer Loyalty Customer
Class Diagram
Name Attributes
Order
-dateReceived -isPrepaid -number :String -price : Money +dispatch() +close()
Multiplicity: mandatory
class
1
Customer
-name -address
+creditRating() : String()
*
Association
Operations
Generalization
Corporate Customer
Personal Customer
-creditCard#
Multiplicity: optional
0..1
*
Employee
*
OrderLine
-quantity: Integer -price: Money -isSatisfied: Boolean
Product
Third Edition]
OO Relationships: Composition
Whole Class Class W Composition: expresses a relationship among instances of related classes. It is a specific kind of Whole-Part relationship. It expresses a relationship where an instance of the Whole-class has the responsibility to create and initialize instances of each Part-class. Class P1 Class P2 It may also be used to express a relationship where instances of the Part-classes have privileged access or visibility to certain attributes and/or behaviors defined by the Whole-class. Composition should also be used to express relationship where instances of the Whole-class have exclusive access to and control of instances of the Part-classes. Automobile Composition should be used to express a relationship where the behavior of Part instances is undefined without being related to an instance of the Whole. And, conversely, the behavior of the Whole is ill-defined or incomplete if one or more of the Part instances are undefined.
Part Classes
Example
Engine
Transmission
Class Reservations
Phone
Recipient
Dial
Ring notification Ring
Picks up
Hello
Self-Call: A message that an Object sends to itself. Condition: indicates when a message is sent. The message is sent only if the condition is true. Condition
Iteration
Self-Call
Creation A Create message Object life starts at that point Activation Symbolized by rectangular stripes Place on the lifeline where object is activated. Rectangle also denotes when object is deactivated. Activation bar Deletion Placing an X on lifeline Objects life ends at that point Lifeline
Create
Return
X
Deletion
Sequence Diagram
User
Message
1: look up () 2: title data ()
Catalog
Reservations
6 : remove reservation ()
Sequence diagrams demonstrate the behavior of objects in a use case by describing the objects and the messages they pass. The horizontal dimension shows the objects participating in the interaction. The vertical arrangement of messages indicates their order. The labels may contain the seq. # to indicate concurrency.
User
6 : borrow title 2: title data 1: look up 5: title available
Reservations
Shows the relationship between objects and the order of messages passed between them. between them. The objects are listed as rectangles and arrows indicate the messages being passed The numbers next to the messages are called sequence numbers. They show the sequence of the messages as they are passed between the objects. convey the same information as sequence diagrams, but focus on object roles instead of the time sequence.
State Diagrams
(Billing Example)
State Diagrams show the sequences of states an object goes through during its life cycle in response to stimuli, together with its responses and actions; an abstraction of all possible behaviors.
Start
Unpaid
Invoice created paying
End
Paid
Invoice destroying
Others (http://www.objectsbydesign.com/tools/umltools_byCompany.html )
Reference
1. UML Distilled: A Brief Guide to the Standard Object Modeling Language
Martin Fowler, Kendall Scott
2. IBM Rational
http://www-306.ibm.com/software/rational/uml/
5. http://www-inst.eecs.berkeley.edu/~cs169/