Presentation on theme: "Unified Modeling Language"— Presentation transcript:
1 Unified Modeling Language Software Engineering Process - IIUnit 4:Unified Modeling Language
2 Before You Begin…What are your expectations from this chapter?
3 Unit Objectives Explain the components of UML. Explain objects, classes, and relationships.Describe and create use-case models.Describe and create UML diagrams during analysis.Define and create UML diagrams during design.Define and create UML diagrams during implementation.
4 What is UMLUML includes a set of concepts, notations, and diagrams necessary for developing object-oriented systems.You can begin by defining what UML is and how it helps to analyze, design, and construct an object-oriented system.UML helps solve real world problems of any specific domain by modeling. It provides a common language of notations and diagrams that everyone from business analyst to programmer can talk.
5 ObjectsAn object is an entity that has a state and a defined set of operations that operate on that state.Objects have attributes and behavior.Objects interact by sending each other messages.Values of an object's attributes determine its state.An abstraction of a real world problem containing objects is called a model.You can explain that in object-oriented requirement analysis, you should model real life entities using object classes.For example, in a payroll system, an employee is an object. The employee class will define attributes and behavior of the employee object.The attributes can be name, salary, and age. Behavior or operations can be Join and Leave.
6 Object ClassAn object class depicts a set of objects with common attributes and operations.It is represented as a rectangle with three sections.Explain that the employee object can have name, date of birth, and date of joining as attributes and AddEmployee and GetAge as its operations.
7 Class Activity - 1List at least three objects from SITS project and draw their object class diagrams complete with three attributes and two operations.You can divide the class in groups of five students for this activity. After they are ready, you can show them the solution given on the next slide.
8 Object Class Diagrams Student - StudentId : int EmailId char Phone name+AddStudent()voidDeleteStudentIntegerRegistrationRegistrationIdRegistrationStatusConfirm StatusSentDatetimeDoRegistrationGetRegistrationStatusSendPaymentPaymentIdPaymentTypePaymentAmountfloatDoPaymentCancelpaymentThe solution depicts three classes – Student, Registration, and Payment. It also represents their corresponding attributes and behaviors.
9 RelationshipsAssociation: An instance of one class must know about the other to perform its operation.Depicted by a link connecting two classes.Generalization (Inheritance): UML refers to inheritance as generalization.Depicted by a triangle pointing from the subclass to the superclass.Aggregation: An association in which one class belongs to a collection.Depicted by a diamond pointing to the collection object.You can use the examples given on pages 184 and 186 of Software Engineering to explain the concepts given in the slide.You can also add the following explanation:Association can also be one-way. A one-way association is depicted by an arrow pointing towards the owned item. For example, a student can own an address, but the other way around is not true. A line with no arrows depicts a bi-directional association.Generalization - For example, Payment is a superclass of Cash, Check, and Credit.Aggregation - For example, in an order processing system, an order has a collection of ordered items.
10 MultiplicityNumber of instances of the class associated with a single instance of the class on the other end.MultiplicityDescription0..1Zero or one instance. The notation n . . m indicates n to m instances.0..* or *No limit on the number of instances – includes none.1Exactly one instance.1..*At least one instance.For example, there is one customer for each order, but one customer can have many orders.Customer…………….Order1………………*
11 Use-Case Diagram A use-case diagram: Depicts a scenario(s) for a single task.Includes actor, communications, and use-cases.Includes actors that are represented as stick figures, use-cases as ovals, and communications are lines that link actors to use-cases.Has an associated description defining the use-case that helps identify objects and operations in the system.You can use the example given on page 324 of Software Engineering to explain use-case modeling. Also discuss the use case description given in Figure 14.9.
12 Use-Case Relationships A includes B: Indicates that the source element includes the functionality of the target element. Include connections are used in use-case models to reflect that one use-case includes the behavior of another.A extends B: Indicates an element extends the behavior of another. Extensions are used in use- case models when one use-case (optionally) extends the behavior of another. A is a base use-case; B is an extending use-case.
13 Class Activity - 2Draw a use-case diagram for SITS representing all the actors, use-cases, and the include and extend relationships.You can divide the class in groups of five students.
14 Use-Case Model - SITSExplain that the use-case ‘DB Update’ is contained in ‘Payment’ and ‘Refund’. So it is a <<include>> relationship.The use-case ‘Request Course details’ extends the functionality of ‘Registration’.
15 Class Activity - 3Draw a class diagram of SITS showing all the classes and corresponding multiplicities.The next slide contains the solution.
16 Class DiagramStudentRegistrationPaymentAddressCancellationCredit cardCheckRefund1..*Batch selectionCourse material0..1*You can explain more about multiplicities from this diagram.
17 Sequence Diagrams – Behavior Modeling In addition to use-cases, these diagrams can be used to show the sequence of actions.Objects and actors are aligned along the top of the diagram.Arrow labels show operations.The vertical line indicates the timeline.Sequence of operations is from top to bottom.The return action can be shown using a dotted arrow.You can use the example given on page of Software Engineering to explain a sequence diagram.A second example and description of a sequence diagram is also given on pages of Software Engineering.
18 Class Activity - 4Draw a sequence diagram for the Registration activity.The solution for this is given on the next slide.
19 Sequence Diagram - Registration The arrows represent the messages. The vertical rectangle is known as activation bar, which represents the duration of message execution. The dotted line represents the time line.
20 Activity Diagrams An activity diagram: Looks like a flowchart Provides a good way to understand/model business processesFocuses on the flow of activities involved in a single process of the systemShows how the system activities depend on each otherBegins with a black circle at the top and ends with a concentric white/black circle at the bottomContains activities shown by rounded rectangles
21 Class Activity - 5Design an activity diagram for the Registration process of SITS.
23 State Diagrams A state diagram: In a state diagram: Captures the lifecycle of an objectRepresents different states an object can assume and the events that cause the changes in stateIn a state diagram:States are shown by rounded rectanglesTransitions are shown by arrowsEvents that trigger state changes are written beside the arrowsYou can use the example given on pages of Software Engineering to explain the state diagram.
24 Collaboration Diagrams Are also interaction diagramsLike sequence diagrams, represent object interactions, but the focus is on object rolesShow how critical objects collaborate within a use-caseFocus on key transactions
25 Collaboration Diagram - Example The slide shows an example of an administrator using a Web Application to manage a user account.You can add that:The rectangles which depict the objects are labeled with either class or object names or both.Class names are preceded by colons ( : ).A sequence number is given to each message in a collaboration diagram. The top-level message is numbered 1. The subsequent messages can be numbered as 1.1, 1.2, and so on.
26 Package Diagrams A package diagram: Shows logical grouping of objects into subsystemsIs represented using a form of class diagrams where each subsystem is shown as packageIs a useful static model because it shows how the design may be organized into logical groups of objectsCan also show association between objectsYou can explain the concept by using the example given on page of Software Engineering.
27 Component and Deployment Diagrams A component is a module of the system which contains classes.A component diagram shows how the modules are placed in a system and is denoted by a rectangle having two tabs.Deployment diagrams show the physical configurations of software and hardware as they will be deployed in the system.In a deployment diagram, the hardware is represented by cubes which are called nodes. Each component sits within a node.
28 Deployment Diagram - Example The deployment diagram shows that the SiteConfig component is deployed onto the Web Server and the BaseDB component is deployed on an App Server. In addition, it shows that the Web Server communicates with the App Server, and the App Server communicates with the Database Server and a Printer.
29 SummaryWhat was your key learning from the unit?