EEL5881 Software Engineering I UML Lecture: Yi Luo
EEL5881 Software Engineering I UML Lecture: Yi Luo
EEL5881 Software Engineering I UML Lecture: Yi Luo
Yi Luo
About myself
Yi Luo TA for EEL5881 3rd Year Phd student in CpE Email: samprasluo@hotmail.com Office hour: Wednesday 3:00PM-5:00PM in HEC-365
Acknowledgements
Outline
What is UML and why we use UML? How to use UML diagrams to design software system? What UML Modeling tools we use today?
OMT - 2
OMT - 1
Use-Case Diagrams
A use-case diagram is a set of use cases A use case is a model of the interaction between
External users of a software product (actors) and The software product itself More precisely, an actor is a user playing a specific role
describing a set of user scenarios capturing user requirements contract between end user and software developers
Use-Case Diagrams
Boundary Actor
Library System
Use Case
Borrow
Employee
Client
Order Title
Fine Remittance
Supervisor
Use-Case Diagrams
Actors: A role that a user plays with respect to the system, including human
users and other systems. e.g., inanimate physical objects (e.g. robot); an external system that needs some information from the current system.
Use-Case Diagrams
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 Diagrams
Include: a dotted line labeled <<include>> beginning at base use case and ending with an arrows pointing to the include use case. The include relationship occurs when a chunk of behavior is similar across more than one use case. Use include in stead of copying the description of that behavior.
<<include>>
Extend: a dotted line labeled <<extend>> with an arrow toward the base case. The extending use case may add behavior to the base use case. The base class declares extension points.
<<extend>>
Use-Case Diagrams
Figure 16.12
The McGraw-Hill Companies, 2005
Use-Case Diagrams
Both Make Appointment and Request Medication include Check Patient Record as a subtask (include)
The extension point is written inside the base case Pay bill; the extending class Defer payment adds the behavior of this extension point. (extend)
Pay Bill is a parent use case and Bill Insurance is the child use case. (generalization)
(TogetherSoft, Inc)
Class diagram
A class diagram depicts classes and their interrelationships 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
Class diagram
+ is used to denote Public visibility (everyone) # is used to denote Protected visibility (friends and derived) - is used to denote Private visibility (no one)
Class diagram
Account_Name - Customer_Name - Balance
Name Attributes Operations
OO Relationships
Aggregation Composition
OO Relationships: Generalization
Supertype
Example:
Customer
Regular Customer
Loyalty Customer
Subtype1
Subtype2
OO Relationships: Association
Student enrolls in a course Courses have students Courses have exams Etc.
Role names (e.g. enrolls) Multiplicity (e.g. One course can have many students) Navigability (unidirectional, bidirectional)
Class diagram
Third Edition]
Student
* has
4 enrolls
Course
OO Relationships: Composition
Class W
Whole Class
Association
Models the partwhole relationship
Composition
Class P1 Class P2
Also models the partwhole relationship but, in addition, Every part may belong to only one whole, and If the whole is deleted, so are the parts
Example:
A number of different chess boards: Each square belongs to only one board. If a chess board is thrown away, all 64 squares on that board go as well.
OO Relationships: Aggregation
Aggregation:
expresses a relationship among instances of related classes. It is a specific kind of ContainerContainee relationship.
Class E1
Class E2
express a more informal relationship than composition expresses. Aggregation is appropriate when Container and Containees have no special access privileges to each other.
Containee Classes
Example
Bag
Apples
Milk
components have only one owner components cannot exist independent of their owner components live or die with their owner e.g. Each car has an engine that can not be shared with other cars. Aggregations may form "part of" the association, but may not be essential to it. They may also exist independent of the aggregate. e.g. Apples may exist independent of the bag.
Interaction Diagrams
show how objects interact with one another UML supports two types of interaction diagrams
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
*[for each] remove()
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
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.
6 : borrow title ()
6 : remove reservation ()
Collaboration diagrams are equivalent to sequence diagrams. All the features of sequence diagrams are equally applicable to collaboration diagrams Use a sequence diagram when the transfer of information is the focus of attention
Start
Unpaid
Invoice created paying
End
Paid
Invoice destroying
Start
List of UML tools http://en.wikipedia.org/wiki/List_of_UML_tools ArgoUML: http://argouml.tigris.org/ Rational Rose (www.rational.com) by IBM UML Studio 7.1 ( http://www.pragsoft.com/) by Pragsoft Corporation: Capable of handling very large models (tens of thousands of classes). Educational License US$ 125.00; Freeware version. TogetherSoft Control Center; TogetherSoft Solo (http://www.borland.com/together/index.html) by Borland
Conclusion
UML is a standardized specification language for object modeling Several UML diagrams:
use-case diagram: a number of use cases (use case models the interaction between actors and software) Class diagram: a model of classes showing the static relationships among them including association and generalization. Sequence diagram: shows the way objects interact with one another as messages are passed between them. Dynamic model State diagram: shows states, events that cause transitions between states. Another dynamic model reflecting the behavior of objects and how they react to specific event
Thank you
Questions?