After collecting the overall requirements, an analysis phase takes place. During that part, not only the identified requirements will be elaborated but this is the stage when some preliminary modeling also takes place. The goal of the analysis activities is to establish a deep(er) understanding of the problem domain. It includes finding the details of the outline requirements and developing some system models that descibe the system's context, structure, behavior and interactions. These models develop in parallel as newer and newer parts of the system are understood.
Now, let us return to the role of the BA and translate the former outline into a real system requirements specification that will be an important phase in system development before system modeling and designing the architecture. Documents describing the requirements and design are not text-only documents but the natural language description of the system is supplemented by some figures. In the context of our case study, UML diagrams will predominantly be used for system descriptions.
As it has been discussed above, use case diagram of the UML can portray different types of system users and the ways that they interact with the system. This type of diagram is typically used in conjunction with the textual use case and will often be accompanied by other types of diagrams as well. It covers functional requirements against the system almost entirely. Previously, we have identified three main user types: customer, administrator, and manager. They will emerge as actors in the use case diagram. We can also define relationships between actors. In most of the cases, these are generalization/specialization relationships. In our example, the most general actor is the user whose descendants are the customer and the administrator. Since the manager owns all attributes like an administrator but also additional ones, the manager actor specializes the administrator (i.e., the manager is descendant of the administrator).
After creating the specification, stakeholders should be consulted again in order to validate its contents. In our case, we make a revision of the diagram(s) ourselves. If it is finished, we obtain an overview of the structure of the system. Now, we know what the system should do for its users.
The following table shows a generic structure of documenting a single use case. This is what is called a structured natural language description of scenarios. We will use it as a template for documenting use cases in Sections the section called “Customer use cases”—the section called “Manager use cases”.
| Use case ID | Enter a unique numeric identifier for the Use Case. e.g. UC-1.2.1 |
|---|---|
| Use case name | Enter a short name for the Use Case using an active verb phrase. e.g. Withdraw Cash |
| Actors | [An actor is a person or other entity external to the software system being specified who interacts with the system and performs use cases to accomplish tasks. Different actors often correspond to different user classes, or roles, identified from the customer community that will use the product. Name the actor that will be initiating this use case (primary) and any other actors who will participate in completing the use case (secondary).] |
| Description | [Provide a brief description of the reason for and outcome of this use case.] |
| Trigger | [Identify the event that initiates the use case. This could be an external business event or system event that causes the use case to begin, or it could be the first step in the normal flow.] |
| Precondition |
[List any activities that must take place, or any conditions that must be true, before the use case can be started. Number each pre-condition. e.g.
|
| Postcondition |
[Describe the state of the system at the conclusion of the use case execution. Should include both minimal guarantees (what must happen even if the actor’s goal is not achieved) and the success guarantees (what happens when the actor’s goal is achieved. Number each post-condition. e.g.
|
| Normal flow | [Provide a detailed description of the user actions and system
responses that will take place during execution of the use case
under normal, expected conditions.
This dialog sequence will ultimately lead to accomplishing the goal
stated in the use case name and description
|
| Alternative flows | [Document legitimate branches from the main flow to handle special conditions (also known as extensions). For each alternative flow reference the branching step number of the normal flow and the condition which must be true in order for this extension to be executed. e.g. Alternative flows in the Withdraw Cash transaction: 4a. In step 4 of the normal flow, if the customer is not in the bank network
4b. In step 4 of the normal flow, if the customer is not in the bank network
|
| Exceptions | [Describe any anticipated error conditions that could occur during execution of the use case, and define how the system is to respond to those conditions. e.g. Exceptions to the Withdraw Case transaction 2a. In step 2 of the normal flow, if the customer enters and invalid PIN
|
| Includes | [List any other use cases that are included (“called") by this use case. Common functionality that appears in multiple use cases can be split out into a separate use case that is included by the ones that need that common functionality. e.g. steps 1-4 in the normal flow would be required for all types of ATM transactions- a Use Case could be written for these steps and “included" in all ATM Use Cases.] |
| Frequency of use | [How often will this Use Case be executed. This information is primarily useful for designers. e.g. enter values such as 50 per hour, 200 per day, once a week, once a year, on demand etc.] |
| Special requirements | [Identify any additional requirements, such as nonfunctional requirements, for the use case that may need to be addressed during design or implementation. These may include performance requirements or other quality attributes.] |
| Assumptions | [List any assumptions that were made in the analysis that led to accepting this use case into the product description and writing the use case description. e.g. For the Withdraw Cash Use Case, an assumption could be: The Bank Customer understands either English or Spanish language.] |
| Notes and issues |
[List any additional comments about this use case or any remaining open issues or TBDs (To Be Determined) that must be resolved. e.g.
|
Use cases are separated into three packages based on the primary actors. Packagas are used to group related elements together. The contents of each package will be detailed later.
A "big picture" of all use cases are shown in Figure 2.14, “All identified use cases on a single diagram.”. However, due to the relatively high number of scenarios this is a bit hard to capture therefore it is very common to have them separated on several smaller diagrams that show only a few use cases at a time.
The detailed description of the use cases with their tabular
representation are given in the following 3 subsections that are followed by a short
description of the non-functional requirements of the system.
| Use case ID | UC001 |
|---|---|
| Use case name | Browse/Search |
| Actors | Customer |
| Description | Browse and/or search among products (books, DVDs). |
| Trigger |
The customer wants to browse among products or the customer would like to search for certain products. |
| Precondition | The customer opens a browser on his/her machine. |
| Postcondition | The system presents a result list of products (which meets with the given search conditions in case of searching) to the customer. |
| Normal flow |
|
| Alternative flows |
Perform Advanced Search Steps 2 is replaced with:
Refine Search Result The following steps are added:
View Product Details Steps 2-4 are replaced with the following:
|
| Exceptions | The format or number of the search keywords is incorrect. The system cannot load products (the database is not available). |
| Includes | None |
| Notes and issues | If none of the products meets the given search conditions, the system returns an empty list. |
| Use case ID | UC002 |
|---|---|
| Use case name | Manage bookshelf |
| Actors | Customer |
| Description | Handling content of a customer’s bookshelf. |
| Trigger | The customer wants to save some products for a future order. |
| Precondition |
|
| Postcondition | The system saves products chosen by the customer to his/her bookshelf. |
| Normal flow |
|
| Alternative flows |
|
| Exceptions | The system is not able to save the items due to a database failure. |
| Includes |
|
| Notes and issues | In case of deleting a category, all included items will also be deleted. |
| Use case ID | UC003 |
|---|---|
| Use case name | Move items to cart |
| Actors | Customer |
| Description | Move certain items from the bookshelf to the customer’s shopping cart. |
| Trigger | The customer decides to move selected items to the shopping cart. |
| Precondition |
|
| Postcondition |
|
| Normal flow |
|
| Alternative flows | None |
| Exceptions | The system cannot delete the selected items from the bookshelf due to a database failure. |
| Includes |
|
| Notes and issues | In case of moving a complete category to the shopping cart, the bookshelf will not contain this category from now on. The items moved into the shopping cart will lose their category-marker attribute. |
| Use case ID | UC004 |
|---|---|
| Use case name | Manage Shopping Cart |
| Actors | Customer |
| Description | Preparation to an ordering process with adding items to or removing items from the shopping cart. |
| Trigger | The customer wants to perform an order and therefore chooses items for it. |
| Precondition |
|
| Postcondition | None |
| Normal flow |
|
| Alternative flows |
|
| Exceptions | None |
| Includes | Browse/Search |
| Notes and issues | The contents of the shopping cart are not saved. There is no possibility to permanently store the customer's shopping cart (but he/she can use the bookshelf in order to permanently store items). |
| Use case ID | UC005 |
|---|---|
| Use case name | Move items to shelf |
| Actors | Customer |
| Description | Move certain items from the shopping cart to the customer’s bookshelf. |
| Trigger | The customer decides to move selected items to the bookshelf. |
| Precondition |
|
| Postcondition |
|
| Normal flow |
|
| Alternative flows | None |
| Exceptions | The system cannot insert the selected items to the bookshelf due to a database failure. |
| Includes | Browse/Search |
| Notes and issues | The items that are moved onto the bookshelf will own a default category-marker attribute from now on. |
| Use case ID | UC006 |
|---|---|
| Use case name | Place Order |
| Actors | Customer |
| Description | The customer creates an order to purchase certain products from the shop. |
| Trigger | The customer wants to order certain products from the shop. |
| Precondition |
|
| Postcondition | The system saves the new order and performs further processing on it. (Obtaining items from the inventory; packing them together; handing the package over to an external delivery system.) |
| Normal flow |
|
| Alternative flows | None |
| Exceptions |
|
| Includes | Manage Shopping Cart |
| Notes and issues |
|
| Use case ID | UC007 |
|---|---|
| Use case name | Feed Back |
| Actors | Customer |
| Description | The customer sends a feedback about products or the ordering process. |
| Trigger | The customer wants to provide feedback about products or processes. |
| Precondition |
|
| Postcondition | The system saves and forwards feedback for further processing. |
| Normal flow |
|
| Alternative flows | Instead of sending, it can be cancelled. |
| Exceptions | The system cannot save the feedback due to a database failure. |
| Includes | Place Order |
| Notes and issues | The feedback will not be available by the customer, only by the administrator. |
| Use case ID | UC008 |
|---|---|
| Use case name | Visit forums |
| Actors | Customer |
| Description | The customer visits forums to share his/her opinion about the products or the system. |
| Trigger | The customer wants to get a line on the products and share his/her opinion or experiences. |
| Precondition | None |
| Postcondition | The system saves the newly created comments. |
| Normal flow |
|
| Alternative flows | 1a. The customer can create a new topic. |
| Exceptions | The system cannot save comments due to a database failure. |
| Includes | None |
| Notes and issues | A new comment will not automatically be visible to other users, only after moderation. |
| Use case ID | UC009 |
|---|---|
| Use case name | Manage Products |
| Actors | Administrator |
| Description | Adding new products to the system, modifying attributes of products, and removing products from the system. |
| Trigger | The use case is activated when there is a need for adding, modifying, or removing some products in the system. |
| Precondition |
|
| Postcondition | Product changes will be saved in the system. |
| Normal flow |
|
| Alternative flows | Steps 1—4 might be replaced with:
|
| Exceptions | The changes cannot be saved permanently due to a database failure. |
| Includes | None |
| Notes and issues | Adding, deleting and updating operations cannot be undone. |
| Use case ID | UC011 |
|---|---|
| Use case name | Update Order Status |
| Actors | Administrator |
| Description | The administrator updates the status of pending orders. |
| Trigger | The status of an order needs manual intervention. |
| Precondition |
|
| Postcondition | New order status will be saved in the system. |
| Normal flow |
|
| Alternative flows | None |
| Exceptions | The system cannot save the new states due to a database failure. |
| Includes | None |
| Notes and issues | Changes after saving cannot be made undone. |
| Use case ID | UC012 |
|---|---|
| Use case name | Process Feedback |
| Actors | Administrator |
| Description | The administrator processes incoming feedbacks from customers. |
| Trigger | Administrator wants to evaluate the feedbacks given by the customers. |
| Precondition | Administrator must be logged in. |
| Postcondition | None |
| Normal flow |
|
| Alternative flows | None |
| Exceptions | None |
| Includes | None |
| Notes and issues | None |
| Use case ID | UC013 |
|---|---|
| Use case name | Compose/Send Newsletter |
| Actors | Administrator |
| Description | The administrator composes and sends newsletters to customers signed up for newsletters. |
| Trigger | There is a new action offer created by the management. |
| Precondition |
|
| Postcondition | The newsletter is sent to the customers. |
| Normal flow |
|
| Alternative flows | None |
| Exceptions | The mailing system is not available. |
| Includes | Set Action Offers |
| Notes and issues | None |
| Use case ID | UC014 |
|---|---|
| Use case name | Moderate Forums |
| Actors | Administrator |
| Description | Administrator moderates comments before they become available to other customers. |
| Trigger | Administrator wants to moderate comments arrived since the last review. |
| Precondition |
|
| Postcondition | The moderated comment will be saved and presented to the other customers. |
| Normal flow |
|
| Alternative flows | None |
| Exceptions | None |
| Includes | None |
| Notes and issues | None |
| Use case ID | UC015 |
|---|---|
| Use case name | Set Action Offers |
| Actors | Manager |
| Description | The manager sets action offers in the system. |
| Trigger | A management decision about a new action is made. |
| Precondition | Manager must be logged in |
| Postcondition | The newly created action offers and rules are saved. |
| Normal flow |
|
| Alternative flows | None |
| Exceptions | The rules cannot be saved in the system due to a database failure. |
| Includes | None |
| Notes and issues | The manager must be familiar with the syntax and functionality of special rules. |
| Use case ID | UC016 |
|---|---|
| Use case name | Set Customer Discounts |
| Actors | Manager |
| Description | The manager sets rules for special customer discounts. |
| Trigger | Management decision is made about customer discounts. |
| Precondition | Manager must be logged in |
| Postcondition | The newly created rules are saved. |
| Normal flow |
|
| Alternative flows | None |
| Exceptions | The rules cannot be saved in the system due to a database failure. |
| Includes | None |
| Frequency of use | |
| Special requirements | |
| Assumptions | |
| Notes and issues | The manager must be familiar with the syntax and functionality of special rules. Customers belong to different categories based on the amount of purchased products so far. During the ordering process, these rules will be applied together with action offers for products at calculating total price for a given order. |
| Use case ID | UC017 |
|---|---|
| Use case name | View/Check Reports/Statistics |
| Actors | Manager |
| Description | The manager can check different reports and/or statistics about the sales. |
| Trigger | Manager wants to some reports or statistics. |
| Precondition | The manager must be logged in. |
| Postcondition | Generated reports are presented to the manager. |
| Normal flow |
|
| Alternative flows | None |
| Exceptions | None |
| Includes | None |
| Notes and issues | None |
In many processes, the detailed description of the use cases are developed in line with some preliminary models of the system. This side by side development means that we often perform some iterations and as we develop deeper and deeper understanding of the problem, more and more accurate system models that capture the problem space are established. Examples of such models that can be developed at this stage are context models, detailed interaction and behavioral models (described by sequence and activity diagrams and statecharts) and domain models that make use of class diagrams in order to capture the main concepts of the particular domain. (More examples will be shown in Chapter 3, System modeling soon.)
Based on the detailed description of use cases, activity and/or sequence diagrams might be created in order to show how the control flows when a use case is executed. However, it is uncommon to provide such interaction diagrams for each use case: some of the use cases can be so simple that it does not need further elaboration. For complex scenarios it might be reasonable to provide an activity or sequence diagram as it helps the reader to understand easier.
This activity diagram shows how a customer will perform the most important
scenario of the system, namely, purchasing an order. This process has
multiple entries: normally, it starts with either browsing or searching for
a product, however, it is also possible to check the actual contents of the
shopping cart, or, one can directly proceed to checkout phase in case he or
she has a non-empty cart. Note the guards on the outgoing edges of
decisions. The [new search] guard should include a
refined search, as well, since the normal execution flow of searching
requested the possibility of refining search criteria.
The described process still stands on a relatively high level of abstraction: it shows how some of the use cases work together to provide system functionalities but the underlying objects that will interact each other are not revealed. To illustrate how various objects will communicate with each other in run-time, we can create sequence diagrams for some activities. Again, there is no need to assign a separate sequence diagram to each activities as some of the activities work in a very simple way: for example, Browse items only visits Products, there is no further processing. On the other hand, some activities capture more difficult logic that worth depicting on a separate diagram as seen on the following figure.
Of course, this is the Customer actor, who initiates the checkout process. When the actual contents of the shopping cart needs to checked out, the customer will click on the button which then will result in the invocation of the shopping cart domain object which has the responsibility of the price calculation. It will first ask the customer domain object whether the given customer has some customer-based discounts to calculate with. After retrieving this information, a loop will iterate over each products put into the shopping cart and their individual prices along with their quantities accessed from the associated ProductSelection object will be retrieved. Based on that information, the shopping cart will send itself a self-message (invoke its own method) to calculate the price.
This diagram still omits a couple of details. Of course, it is not the Customer actor itself who will send the checkout message to the shopping cart domain object but there should be a GUI object (a class with the boundary stereotype). According to the Model—View—Controller pattern, an intermediary controller object is also needed since the views are required to notify the controllers about GUI events but these objects and the delagations performed by them are not shown in the figure in order to keep the example small.
Technically, there are two customer lifelines on this diagram, an actor and an object. The former is not an object of the system but a human being using the application and cause variuos scenarios to be executed while the latter is an object of the system which can therefore receive messages. So this is not an error but a preferred way of how you should model situations when an actor initiates some activities that involve sending messages to the "digital representation" of the actor.
Communication digrams provide almost an alternative notation for sequence diagrams. A communication diagram also shows the messages that are passed between objects but the lifelines are depicted as objects (rectangles) and the order of messages are described by numbering the arrows that represent messsages.
Besides functional requirements, it is important to gather and document non-functional requirements. Such requirements might be product, organizational or external requirements that need to be worded in a verifiable manner. Examples of non-functional requirements (with their categories denoted in parenthesis) for the bookstore are shown in Example 2.1, “Non-functional requirements for the case study.”.
Non-functional requirements are in many cases more important that functional ones, especially from the architectural design point of view since non-functional requirements can heavily affect architectural design decisions.