Introduction
(I) Define UML?
Unified Modeling Language, a standard language for designing and documenting a system in an object-oriented manner. It has nine diagrams which can be used in design document to express design of software architecture.
(I) Can you explain use case diagrams?
Use case diagram answers what system does from the user point of view. Use case answer ‘What will the system do?’. Use cases are mainly used in requirement document to depict clarity regarding a system. There are three important parts in a use case scenario, actor and use case.
Scenario: A scenario is a sequence of events which happen when a user interacts with the system.
Actor: Actor is the who of the system, in other words the end user.
Use Case: Use case is task or the goal performed by the end user. Below figure ‘Use Case’ shows a simple scenario with ‘Actor’ and a ‘Use Case’. Scenario represents an accountant entering accounts data in the system. As use case’s represent action performed they are normally represented by strong verbs.
Actor’s are represented by simple stick man and use case by oval shape as shown in figure ‘Use Case’ below.
Figure: Use Case
(I) Can you explain primary and secondary actors?
Actors are further classified in to two types primary and secondary actors. Primary actors are the users who are the active participants and they initiate the user case, while secondary actors are those who only passively participate in the use case.
(I) How does a simple use case look like?
Use case’s have two views of representation in any requirement document. One is the use case diagrams and the other is a detail step table about how the use case works. So it’s like a pair first an over view is shown using a use case diagram and then a table explaining the same in detail. Below is a simple ‘login’ use case shown diagrammatically and then a detail table with steps about how the use case is executed.
Figure: Login Use Case
Use Case Rel001
Use Case Name Login
Description This uses depicts the flow of how user will log-in into the chat application.
Primary Actor Simple chat user.
Trigger User types chat application on URL of the browser.
Pre-condition NA
Assumption No password is currently present for the system
Rooms will remain constant as explained in the assumption section of this document
Failed End conditions Duplicate user name is not allowed in the chat application.
Action User clicks on the log-in button.
Main Scenario
- User types chat application on URL of the browser which in turn opens the main page.
- In the main page of application user is popped up with ‘Enter user name’ option and various ‘rooms’ option drop down menu.
- User then types the name and selects one of the room from drop down menu and then clicks on the ‘Log-in’ button.
- Application then checks whether the user name is unique in the system if not then user is popped up with error message that “user already exist”.
- After entering the unique name the user is finally logged in the application.
Action NA
Alternate Scenario NA
Success Scenarios 1. Opens page of a selected room in that other user names and their messages can be seen.
Note and Open Issues NA
Table: Login use case table
Note: You must be wondering why we have this pair why not just a use case table only. Use case diagrams are good to show relationship between use case and they also provide high over view. The table explanation of a use case talks details about the use case. So when a developer or a user is reading a requirement document, he can get an overview by looking at the diagram if he is interested he can read the use case tables for more details.
Rooms will remain constant as explained in the assumption section of this document
- User types chat application on URL of the browser which in turn opens the main page.
- In the main page of application user is popped up with ‘Enter user name’ option and various ‘rooms’ option drop down menu.
- User then types the name and selects one of the room from drop down menu and then clicks on the ‘Log-in’ button.
- Application then checks whether the user name is unique in the system if not then user is popped up with error message that “user already exist”.
- After entering the unique name the user is finally logged in the application.
(I) Can you explain ‘Extend’ and ‘Include’ in use cases?
‘Extend’ and ‘Include’ define relationships between use cases. Below figure ‘Extend and Include’ shows how these two fundamentals are implemented in a project. The below use case represents a system which is used to maintain customer. When a customer is added successfully it should send an email to the admin saying that a new customer is added. Only admin have rights to modify the customer. First lets define extend and include and then see how the same fits in this use case scenario.
Include: Include relationship represents an invocation of one use case by the other. If you think from the coding perspective its like one function been called by the other function.
Extend: This relationship signifies that the extending use case will work exactly like the base use case only that some new steps will inserted in the extended use case.
Below figure ‘Extend and Include’ shows that ‘add customer’ is same as the ‘add discounted customer’. The ‘Add discounted customer’ has an extra process, to define discount for the discounted customer which is not available for the simple customer. One of the requirements of the project was that when we add a customer, the system should send an email. So after the customer is added either through ‘Add simple customer’ use case or ‘Add discounted customer’ use case it should invoke ‘send a email’ use case. So we have defined the same with a simple dotted line with <<include>> as the relationship.
Figure: Extend and Include
Note: One of the points to be noted in the diagram ‘Extend and Include’ is we have defined inheritance relationship between simple and admin user. This also helps us defining a technical road map regarding relationships between simple and admin user.
(I) Can you explain class diagrams?
Class diagram
Class is basically a prototype which helps us create objects. Class defines the static structure of the project. A class represents family of an object. By using Class we can create uniform objects.
In the below figure you can see how the class diagram looks. Basically there are three important sections which are numbered as shown in the below. Let’s try to understand according to the numbering:
- Class name: This is the first section or top most section of the Class which represents the name of the Class (clsCustomer).
- Attributes: This is the second section or the middle section of the class which represents the properties of the system.
- Methods: This section carries operation or method to act on the attributes.
Figure: Three sections of the class
Now in the next section we will have a look on Association relationship between these classes.
(B) How do we represent private, public and protected in class diagrams?
In order to represent visibility for properties and methods in class diagram we need to place symbols next to each property and method as shown in figure ‘Private, Public and Protected’. ‘+’ indicates that it’s public properties/methods. ‘-‘indicates private properties which means it can not be accessed outside the class. ‘#’ indicate protected/friend properties. Protected properties can only be seen within the component and not outside the component.
Figure: Private, public and protected
(I) what does associations in a class diagram mean?
Associations in Class diagrams
A single Class cannot represent the whole module in a project so we need one or more classes to represent a module. For instance, a module named ‘customer detail’ cannot be completed by the customer class alone , to complete the whole module we need customer class, address class, phone class in short there is relationship between the classes. So by grouping and relating between the classes we create module and these are termed as Association. In order to associate them we need to draw the arrowed lines between the classes as shown in the below figure.
In the figure ‘Order is paid by payments class’, we can see Order class and the Payment class and arrowed line showing relationship that the order class is paid using payment class in other words order class is going to be used by payment class to pay the order. The left to right marked arrow basically shows the flow that order class uses the payment class.
In case payment class using the order class then the marked arrow should be right to left showing the direction of the flow.
Figure:- Order is paid by Payments class
There are four signs showing the flow:-
Figure: Direction signs in UML
In case payment class using the order class then the marked arrow should be right to left showing the direction of the flow.
Multiplicity
Multiplicity can be termed as classes having multiple associations or one class can be linked to instances of many other classes. If you look at the below figure the customer class is basically associated with the address class and also observes the notations (*, 0 and 1).If you look at the right hand side the (1….*) notation indicates that at least one or many instance of the address class can be present in the customer class. Now towards left hand side we have (0….*) notation indicating that address class can exist without or many customer class can link him.
In order to represent multiplicity of classes we have to show notations like (1….*), (0….*) as shown in below figure.
Note: ‘*’ means “many” where as ‘(0, 1)’ means “(zero or at least one)” respectively.
Figure: Multiplicity in Classes
In order to represent multiplicity of classes we have to show notations like (1….*), (0….*) as shown in below figure.
No comments:
Post a Comment