Lecture – 7: Use Case Diagram Interaction models • Modeling user interaction is important as it helps to identify user requirements. • Modeling system-to-system interaction highlights the communication problems that may arise. • Modeling component interaction helps us understand if a proposed system structure is likely to deliver the required system performance and dependability. • Use case diagrams and sequence diagrams may be used for interaction modeling. Use Case Modeling • Use cases were developed originally to support requirements elicitation and now incorporated into the UML. • Each use case represents a discrete task that involves external interaction with a system. • Actors in a use case may be people or other systems. • Represented diagrammatically to provide an overview of the use case and in a more detailed textual form. Use Case Diagrams • Use Case diagrams show the various activities the users can perform on the system. – System is something that performs a function. • They model the dynamic aspects of the system. • Provides a user’s perspective of the system. Use Case Diagrams • A set of ACTORS : roles users can play in interacting with the system. ▫ An actor is used to represent something that uses our system. • A set of USE CASES: each describes a possible kind of interaction between an actor and the system. ▫ Uses cases are actions that a user takes on a system • A number of RELATIONSHIPS between these entities (Actors and Use Cases). ▫ Relationships are simply illustrated with a line connecting actors to use cases. Use Case Diagrams - Actors • An actor is a user of the system playing a particular role. • Actor is shown with a stick figure. employer employee client Use Case Diagrams – Use Cases • Use case is a particular activity a user can do on the system. • Is represented by an ellipse. • Following are two use cases for a library system. Borrow Reserve Use Case Diagram – Example1 (Library) Library System borrow client reserve employee Order title Fine payment A Library System. supervisor Use Case Diagram for Student Assessment Management System Grade System Record grades Student View grades Teacher Distribute Report cards Create report cards Printing administrator system name ATM System primary actor Bank Customer 1 Withdraw Money association use case secondary actor 2 Deposit Money 3 Transfer Money role system boundary 4 Check Balance Customer Accounts Database Use Case Diagrams - Relationships • Inclusion A base use case is dependent on the included use case(s); without it/them the base use case is incomplete as the included use case(s) represent sub-sequences of the interaction • Extension – Allows creating a new use case by adding steps to existing use cases • Generalization – Allows child use cases to inherit behavior from parent use cases Use Case – Example (self service machine – includes relationship) <<includes>> Open Machine Restock <<includes>> Close Machine <<includes>> Open Machine Collect <<includes>> Close Machine Use Case – Example (self service machine – extends relationship) <<includes>> Open Machine Restock <<includes>> <<extends>> Restock According to Sales Close Machine Use Case – Actor-to-Actor relationship generalized actor Cook specialized actor Mom Cook Father Cook Use cases in the Mentcare system involving the role ‘Medical Receptionist’ Include and Extend Include: • A base use case is dependent on the included use case(s); without it/them the base use case is incomplete as the included use case(s) represent sub-sequences of the interaction. Extend: • Extend is used when a use case conditionally adds steps to another first class use case. • The extending use case represents optional (should/could/want) behavior. This is where the term optional is relevant Include Difference between Include and Extend THE END