What is use case
The writing of case description documents is a reflection of the deep understanding of user requirements by system analysts. It is an important basis for later time sequence diagrams and actual development. It can also be used as a basis for project estimation, as well as to measure the efficiency of developers Based on UC complexity and development cycle. Therefore, the writing standard of UC and its importance share with you some work experience, such as the writing format, content, and precautions.
Outline diagram:
I. Preparations
1) have a profound and complete understanding of user problems
2) ensure that all user problems can be solved
3). reflect users' needs to the business model
4). provides instructions and frameworks for future design and development processes
5). Generate the UI as needed
Ii. Use Case content
First, the useful example name is generally the module name or the name of the Function Point in the module.
Revision history:
1. Basic description)
Describes the role of a use case in the system. Who is the user of such a case and what operations the user has to perform.
2. precodition)
Describes the conditions that must be met before the use case is executed. For example, if a must be executed before use case B is executed, the prerequisite for Use Case B is execution.
3. Post-assurance (postcodition)
Conditions after this case is executed
4. Basic flows)
The basic process of user operations on this case is the main reference of the later time sequence diagram.
5. selective process (Alternative flows)
In the main process of operation, some branch processes appear as the main reference for the later time sequence diagram.
6. Special requirements (special requirement)
Describes some minor functions, such as user authentication rules, Order Number Generation rules, and whether SSL encryption is required.
7. User Interface)
UI created by the artist as required and its description of the field in the UI.
8. addition information)
Some business logic descriptions can put the logic view here
Iii. Summary
During the process of reading UC, I encountered the following problems: "the basic process and selective process description are not clear or detailed enough", mainly because the system analysts did not have a thorough understanding of the requirements, the analysis is incomplete.
Source Document
I. Overview
The Use Case attempts to summarize the relationship between roles and systems in the use case, and describes the functional requirements of the system, the interaction between roles and systems, and the system response.
Members can browse product categories, send messages based on keywords, and select products to join the shopping cart.
Ii. Glossary
1. Extended relationship of extends Use Cases
An extended relationship is generally used to describe an element extension for another behavior. The extension in use case indicates that a UC may be extended to another UC function. Expansion in use case usually implies a selective process.
2. include case inclusion relationship
The package row relationship indicates the behavior of the target element of the Source Element package row. The inclusion relationship in UC is the behavior function of another UC row in UC. Using the package-line relationship can prevent defining common function modules in multiple UC instances at the same time, for example, entrusting a delegation
3. Role)
Users in the system are divided into multiple roles based on the system. Each role interacts with the system. A user can have one or more roles.
Roles used in the system can be divided into primary roles and secondary roles.
For example, e-commerce websites have major roles such as suppliers, front-end members, and system administrators. The secondary roles include email sender, logistics system, and golden stream system.
Iii. How to draw the use case View
Note: The design tool is ea (Enterprise architect 7.0)
Assume that the current functional requirements are:
A. Suppliers must enter the form to report products.
B. The supplier reports the product by importing the CSV document.
C. The product developer must review the product reported by the supplier
1. Create a project
[File]-> [new project]-> enter the Project name: example. EAP
2. Create a Use Case view
Right-click the newly created Project and choose new view. In the displayed dialog box, select use CSE, as shown in figure
Click OK. In the model project, a new package is created.
Right-click package, and choose "commodity report mounting"> "add"> "add digoal", as shown in
The following dialog box is displayed: Select UML behavioral> Use Case and click OK]
In this way, an empty use case is created. Next, we need to add content to the empty use case.
3. Use Case view based on business needs
Note: select some use case elements from the Toolbox toolbar on the left and drag the element on the left to the workspace on the right to put the element in our use case attempt.
A. Drag Two actor elements to the workspace and name them "Suppliers" and "Product Developers" respectively"
B. Drag the three use case elements to the workspace and name them "commodity Report", "CSV File Import Commodity", and "commodity Review" respectively"
As shown in:
C. Link roles and system functions through associations, such:
So far, the use case diagram of the commodity reporting scenario has been completed. A Use Case view corresponds to one or more use case cases.
For more information about use cases, see how to write use cases in the demand stage.
Iv. Organizational Structure of Use Case in actual projects
This is a functional directory map of the system requirements described using UC. Each UC describes the interaction between actor and the system when using the system.
V. Summary
The Use Case attempts to summarize the relationship between roles and systems in the use case, and describes the functional requirements of the system, the interaction between roles and systems, and the system response. It is a good way for customers and developers to fully understand the functions required by the project. It is also the basis and direction for subsequent functional iterations.
Source Document
I. Introduction
A class is a collection of objects. It shows the structure of an object and its interaction with the system. A class consists of attributes and Methods. attributes represent the state of an object. If an attribute is saved to a database, this is called persistence. Methods represent the operation behavior of an object, the class has an inheritance relationship. It can inherit from the parent class or interact with other classes.
The class diagram shows the logical structure of the system, and the relationship between classes and interfaces.
Ii. Composition of Classes
Class consists of attributes and methods. For example, the product attributes include name, price, height, and width. The product methods include calculating tax rates and obtaining product reviews. For example
3. Relationship between classes)
Association)
Two relatively independent objects. When an object instance has a fixed relationship with a specific instance of another object, the two objects are associated.
1. Unidirectional Association
A1-> A2: indicates that A1 knows A2 and A1 knows existence of A2. A1 can call methods and attributes in A2.
Scenario: orders and commodities include commodities, but goods do not know the existence of orders.
Unidirectional association between classes:
C # code:
Public class order
{
Public list <product> order;
Public void addorder (product)
{
Order. Add (product );
}
}
Public class product
{
}
The Code is as follows: Order (A1) contains a variable or reference of product (A2 ).
2. Bidirectional Association
B1-B2: B1 knows B2, B1 knows the existence of B2, B1 can call the method and attribute in B2; B2 also knows the existence of b1, b2 can also call the method and attribute of B1.
Scenario: orders and customers. Orders belong to customers and customers have specific orders.
Bidirectional association between classes
C # code
Public class user
{
Public list <order> getorder ()
{
} Return new list <order> ();
}
Public class order
{
Public user getuserbyorderid (string orderid)
{
Return new user ();
}
}
3. Self-Association
Association between the same Class Object
Association between classes
4. Multi-dimensional association (n-ary Association)
Multiple objects are associated.
Scenario: The company employs employees, and the company needs to pay wages to employees.
Multidimensional Association between classes:
5. Generalization)
The inheritance relationship between classes and interfaces.
Scenario: Relationship between father and child, animals and people, plants and trees, system users and B2C members, and b2e members
Generalization diagram between classes:
Users of the system include B2C members, B2B members, and b2e members.
The implementation of interfaces enables animals to eat, while humans are a specific instance of animals to implement specific eat actions.
6. Dependency)
Class A must reference Class B to complete a function. Class A has a dependency with Class B, and the dependency is weak. C # Two-Phase dependency is not recommended, that is, mutual reference.
Scenario: people have nothing to do with computers, but due to occasional opportunities, people need to use computers to write programs. At this time, people rely on computers.
Dependency relationship between classes
It is generally referenced by using in a program.
7. Aggregation)
When object A is added to object B and becomes an integral part of object B, object B and object a are aggregated. Aggregation is a type of association. It is a strong association, emphasizing the relationship between the whole and the part.
Scenario: The product has an aggregation relationship with its specifications and styles.
Aggregation relationship between classes
8. Composite)
Object A contains object B, and object B leaves object. Is a stronger association. If a person contains a hand, his hand will lose its role when he leaves his body.
Scenario: The Window form is composed of slider, header, and workspace panel.
Relationship between classes and Classes
Iv. Summary
This document briefly describes common relationships between classes, including Association, generalization, dependency, aggregation, and combination.
Source Document
The activity diagram is another common tool used by UML to model the dynamic behavior of the system. It describes the activity sequence and shows the control flow from one activity to another. An activity chart is essentially a flow chart. The activity diagram focuses on the control flow from one activity to another. It is an internal processing-driven process.
1. Activity dimo-element
1. activity status chart)
The active state is used to express non-atomic operations in the state machine. Its features are as follows:
(1) The activity status can be divided into other sub-activities or action statuses.
(2) internal activities in the activity status can be represented by another activity diagram.
(3) different from the action status, the activity status can include the entry action and exit action, or internal transfer.
(4) The action status is a special case of the activity status. If an activity status only contains one action, it is an action status.
The icons in the activity status and action status in UML are the same, but the activity status can provide information such as the entrance and exit actions in the icon.
2. Action status (Actions)
The action status refers to an atomic and non-disruptive action, and is switched to another state after the action is completed. The action status has the following features:
(1) The action state is atomic, which is the smallest unit for constructing an activity chart.
(2) The action status cannot be interrupted.
(3) The action status is instantaneous.
(4) The action status can be an inbound conversion, which can be either an action stream or an object stream. The action status must have at least one output switch. The completion of the internal switch is the starting point and has nothing to do with external events.
(5) The action status is different from the State in the status chart. It cannot have an entry action or exit action, or internal transfer.
(6) In an activity diagram, the action status can appear in multiple places.
The action state diagram in UML is represented by a smooth rounded rectangle, as shown below:
3. Action Constraints)
Action status constraint: used to restrict the action status. For example, you can view the prerequisites and backend conditions of the action status.
4. Control Flow)
The conversion between actions is called an action flow. The conversion of an activity chart is represented by a straight line with an arrow. The direction of the arrow points to the direction of transfer.
5. Start Node)
Start node: solid black dot
6. Final Node)
Activity final nodes and flow final nodes ).
The End Node of the activity indicates the end of the entire activity.
The Process Termination node indicates the completion of the sub-process.
7. Object (objects)
8. Data storage objects (datastore)
Use the keyword "datastore»
9. Object stream (Object flows)
The object stream is the dependency between the action status or activity status and the object, indicating the impact of the action on the object using the object or action. When you use an activity diagram to describe an object, you can place the involved object in the activity diagram and use a dependency to connect it to the action status or activity status for creation, modification, and revocation, this method of object constitutes the object stream.
Objects in an object stream have the following features:
(1) An object can be operated by multiple actions.
(2) An object output by an action can be an object input by another action.
(3) In the activity diagram, the same object can appear multiple times. Each time it appears, the object is at a different time point of the object's lifetime.
Object streams are represented by dotted lines with arrows. If the arrow points to the object from the action state, it indicates that the action has a certain impact on the object. The effects include creation, modification, and revocation. If the arrow points from the object to the action status, it indicates that the action uses the object pointed to by the object stream.
The object in the status chart is represented by a rectangle. The rectangle contains the name of the object, and square brackets under the name indicate the state of the object at this time.
10. demo-and merge nodes)
Branch and merge are represented by Diamond
11. Fork and join nodes)
It can be divided into horizontal direction and vertical direction.
Objects may have two or more concurrent control flows. to model the concurrent control flows, the concept of forks and confluence is introduced in UML. A fork is used to divide an action stream into two or more concurrent branches, and a confluence is used to synchronize these concurrent branches to accomplish a transaction together.
12. exception handler)
When an exception occurs in a protected activity, the exception handling node is triggered.
13. interruptible activity region)
The activity interruption area is centered around several interrupted action statuses. For example, under normal circumstances, [process order] is sequentially transferred to [close order], and the order processing process is completed. However, in the [process order] nickname, a [cancel order] request is sent, at this time, it will flow to [cancel order], and the order processing process ends.
14. Swimming track (partition)
The swimming track divides the activities in the activity diagram into several groups, and assigns each group to the business organization responsible for this group of activities, that is, the object. In the activity diagram, the swimming track identifies the objects in charge of the activity, which explicitly indicates which activities are performed by which objects. In an activity diagram that contains a swimming track, each activity can only belong to one swimming track explicitly.
A swimming track is drawn by vertical solid lines, and a vertical line is used to separate the areas. At the top of a swimming track, you can give the name of the swimming track or the name of the object, which is responsible for all the activities in the swimming track. There is no sequence in the swimming Lane. The activities in different swimming lanes can be performed sequentially or concurrently, and the Action stream and object stream can pass through the separation line.
Ii. Activity diagram Case Analysis
1. Swimming channels are divided into member swimming channels and system swimming channels. The member selects the item and adds it to the shopping cart. The system generates the order and completes the payment.
2. Start node: The member adds the item to the shopping cart, and click confirm order to begin handing over the order to the system.
3. End Node: after the product is sent and payment is successful, the order processing process is complete.
4. Activity Status: generate an order, check credit cart to check credit card, check stock to check inventory, deliver goods to send goods, process credit cart to pay
5. Forking and convergence: [generate order] The fork is used to check whether the inventory and membership payment amount are sufficient. If not, cancel the order, such as inventory and payment amount, send goods and payment, and finally merge to complete the order.
Iii. Summary
An activity diagram describes the rules followed by the sequence of object activities. It focuses on system behaviors rather than system processing. The activity diagram can represent concurrent activities. The activity diagram is object-oriented.
Source Document
1. Introduction to the status chart (Brief Introduction)
Statechart divisor is mainly used to describe the dynamic behavior of an object during its survival, as a sequence of States experienced by an object, and events that cause state transfer ), and actions that are accompanied by status transfer ). Generally, you can use a state machine to model the lifecycle of an object. A state chart is used to display the state machine digoal, focusing on and describing the control flow of a state chart.
For example, the state machine describes the state sequence during the survival of the door object, the events that cause the transfer, and the actions that accompany the state transfer)
. The statuses include opened, closed, and locked.
Events include open, close, lock, and unlock.
Note:
1. Not all events will cause status transfer. For example, when the door is in the [opened] status, the [Lock] event cannot be performed.
2. Transfer has guard condition. For example, a transfer event will be returned only when the doorway-> isempty condition is met.
2. State dimo-elements)
1. Status)
A condition or condition in the lifecycle of an object. During this period, the object will meet certain conditions and execute certain activities to wait for certain events. All objects are in a State. The State is the result of a series of activities executed by the object. when an event occurs, the state of the object changes.
The status is represented by a rounded rectangle.
Initial and final states)
The initial State is represented by a solid dot, and the final State is represented by a circular embedded dot.
2. Transfer (transitions)
Transitions is a relationship between two States, indicating that the object will execute certain actions in the source State, and enters the target State when a specific event occurs and a specific alert condition is met)
Trigger: an event is a transfer trigger. It can be a signal, event, a change in some condition, or a time expression.
Guard condition: A transfer event is triggered only when the alert condition is met ).
Result (effect): The result of object state transfer.
3. Action (State actions)
An action is an executable atomic operation. That is to say, an action cannot be interrupted and its execution time is negligible.
In the above example, the object state transfer result is displayed on the transfer line. If the target State has many transfers and each transfer has the same results, the transferred result (effect) is) it is better to display the target State. You can define the entry action and exit action, as shown in figure
4. Self-transitions)
The status can be transferred by returning its own status, which is called self-transitions)
2 seconds later, the poll input event is executed and transferred to its own State [waiting]
5. Compound states)
A State nested in another state is called a sub-state, and a State containing sub-States is called a compound states ). for example, [Check pin] indicates the combination status, and [enter pin] indicates the sub-status.
You can also use the following methods to describe
For example, the details of the state machine check pin are split into another graph.
6. Entry Point)
As shown in, Initialization is not performed for some reasons, but directly enters the "ready" State through a node. This node is called the entry point)
7. Exit A node (exit point)
8. History states)
A historical state is a pseudo State. It aims to remember the substate in which the user exits from the combination state. When the user enters the combination state again, the user can directly enter this substate, instead of starting from the initial state of the combination again.
In the status chart, the normal status order is [processing]-> [rinsing]-> [Spinning ].
If you quit from the "rinsing" state, the washing machine stops working and enters the "power off" state. when the power is restored, the washing machine enters the "running" state ].
9. Concurrent regions)
The status chart can be divided into regions, and the regions include the exited or currently executed sub-states. It indicates that the combination status can reach multiple sub-states at the same time. For example, the brake system enters the applying front brakes status and the applying rear brakes status.
Iii. State divisor Example Analysis)
According to the blink518 suggestion ("in shipment" is a condition branch, demo-should be used), it is also a good practice to change it:
The order status mainly includes:
Order established
Order Cancellation (GUARD: Member order-payment period expired)
Warehouse preparation (GUARD: paid, set up order, stock enough)
Shipment in progress (effect: deduct the amount of items that can be received and remove the purchase materials in the shopping cart)
Shipment confirmation (GUARD: The actual configuration date, invoice code, and number are not null)
Shipment completed (GUARD: The actual configuration date is not blank)
Shipment failed
Order (GUARD: Delivery completed, paid, appreciation period end date less than or equal to [system date])
Analysis:
1. The order generated by the shopping cart enters the status [order is set up]
2. If the system detects that the order has been paid and the inventory is sufficient, the system enters the status [stocking]
3. After the status is changed to "in delivery" and the status is changed to "in delivery", You need to perform the following operations: "deduct the amount of goods that can be received and remove the purchase materials in the shopping cart"
4. After the shipment is completed, the status can be [shipment confirmation] and [shipment failure]. If the status is [shipment failure], [end]. If the status is [shipment confirmation ], then go to the next step.
5. The delivery personnel fill in the actual delivery date and enter the status [shipment completed ].
6. If the "paid and appreciation period end date is less than or equal to the [system date]", the [order is set up ].
4. Summary)
The state chart focuses on describing the state of the object and the transfer between States. The basic elements of the state chart mainly include: status, transfer, action, self-transfer, combination status, entry to node, exit node, history status, concurrent region, etc. Events in status are divided into call and change events) time and Singal ). Finally, an instance is used to analyze the status.
Source Document
I. Introduction to the time sequence diagram (Brief Introduction)
Sequence digraphs are graphs that show interactions between objects. These objects are arranged in chronological order. The sequence diagram shows the order of message interaction between the objects involved in the interaction and their objects. The time sequence diagram contains the following modeling elements: Object (actor), lifeline, focus of control, and message.
Ii. Sequence dimo-elements)
Role)
System roles can be people, and other systems or subsystems.
Object)
There are three naming methods for objects:
The first method includes the Object Name and class name;
In the second method, only the class name is displayed and the object name is not displayed, indicating that the class name is an anonymous object;
In the third method, only the object name is displayed, but the class name is not displayed.
Lifeline)
In the sequence diagram, the lifeline represents a dotted line extending down from the object icon, indicating the time when the object exists.
For example
Focus of control)
The control focus is the symbol indicating the time period in the sequence diagram. During this time period, the object will perform corresponding operations. It is represented by a small rectangle, such.
Message)
Messages are generally divided into synchronous Message, asynchronous message, and return message, as shown in:
Synchronous Message = call message (synchronous Message)
The message sender sends the control to the receiver of the message, stops the activity, and waits for the receiver to give up or return the control. Used to indicate the meaning of synchronization.
Asynchronous Message)
The message sender transmits the signal to the receiver of the message, and then continues the activity without waiting for the receiver to return the message or control the message. The receiver and sender of asynchronous messages work concurrently.
Return message)
The returned message indicates that the process call returns
Self-message)
Indicates the call of the method itself and one method in an object to call another method.
Combined fragments
1) Alternative fragment (denoted "ALT") and if... Then... Else
2) Option fragment (denoted "opt") corresponds to switch
3) Parallel fragment (denoted "par") indicates that
4) loop fragment (denoted "loop") corresponds to for or foreach
Iii. sequece dimo-example Analysis)
Sequence Chart scenario
The course creation function is completed in the following steps:
1. On the Add course page, enter the course form and click Create.
2. Add course information to the database
3. append topic information to the course object
4. Assign teachers to the course
5. Complete the course creation Function
Sequence Chart instance
Sequence Graph instance analysis
1. Serial No. 1.0-1.3 completes page Initialization
2. Fill in the course form by the course administrator No. 1.4-1.5
3. The course administrator clicks the "Create" button in sequence 1.6-1.7 and responds to the click event.
4. Create a course at service layer
5. Add the course to the database in sequence 1.9-1.10, and return the course number courseid.
6. Add the course subject to the database in sequence 1.11-1.12, and return the topic ID topicid.
7. Assign instructors to the course in sequence 1.13
8. Message No. 1.14: whether the course is successfully created or not
4. Summary)
Sequence digraphs are graphs that show interactions between objects. These objects are arranged in chronological order. The sequence diagram shows the order of message interaction between the objects involved in the interaction and their objects. The time sequence diagram contains the following modeling elements: Object (actor), lifeline, focus of control, and message. Finally, the course creation function is used to demonstrate a sequence chart instance.
Source Document
1. Introduction to business processing model (Brief Introduction)
A business processing model is a set of activities that describe the sequence of activities in time or space from start to end, as well as input and output. The final output of the business processing model must meet the business needs.
The business processing model generally includes:
1. Goal (GOAL)
2. Specific input (specific inputs)
3. Specific output (specific outputs)
4. Activities in some order)
5. Message)
6. Resource)
Ii. Business Processing Model Elements (elements)
1. Goal (GOAL)
Each business processing process has some goals to be achieved, which must meet business needs.
2. Message)
Use a message to complete the activity ). In the business processing process, messages are not consumed, but are only part of the conversion process. Messages can come from external resources, customers, internal organizational units, and other processing processes. For example, an order template that was used to provide a certain type of order is not consumed or used up as part of the activity.
3. Resource)
A resource is an input. Unlike a message, resources are consumed and can be used up.
4. Output (outputs)
Each business flow generates outputs that meet the business needs. The output can be a physical object (such as a report or invoice), or the end of the entire business process (such as the completion of an order ).
3. Business Process Model Example Analysis)
Event has the order cutomer order that the customer wants to generate
Input (inputs) has the customer database and Inventory (inventory)
The process is order handling process.
Output (outputs) is the generated order completed customer order
4. Summary)
A business processing model is a set of activities that describe the sequence of activities in time or space from start to end, as well as input and output. The final output of the business processing model must meet the business needs. Including input, output, resources, messages, and targets. Finally, the business logic model is further illustrated by examples.
Source Document
1. Introduction to Data Modeling
Data Modeling not only supports object attribute modeling (such as E-R diagram), but also modeling data behavior (such as trigger, stored procedure ). the following concepts are designed during Database Design:
Schema, primary key primary, foreign key, relational relationship, constraints constraint, Index, trigger, stored procedure, view.
Ii. Data Modeling Elements
1. Table)
A table is the most basic model structure of a relational database. For example
Table primary key: inventoryid
Foreign key of the Table: warehouseid, associated with the primary key of the table warehouse
You can set the table database type, as shown in figure
You can also set the tablespace, as shown in figure
2. Table Index)
Indicates the logical sequence of records created by a keyword segment or expression in a table file. It is a list composed of a series of record numbers, providing quick access to data. The index does not change the physical sequence of records in the table.
3. Table trigger)
When performing operations such as update, insert, and delete on a table, SQL Server automatically runs the SQL statement defined by the trigger, this ensures that data processing must comply with the rules defined by these SQL statements.
The trigger is mainly used to achieve complex integrity of reference and data consistency that cannot be guaranteed by the primary key and foreign key.
4. Table Constraints)
Column constraints ensure data validity.
5. View)
A view is a table exported from one or more tables or views. Its structure and data are based on table queries. For example
6. Stored Procedure)
Store common or complex tasks in advance with SQL statements and a specified name, to enable the database to provide services with the same functions as the predefined stored procedure, you only need to call execute to automatically complete the command.
Iii. Data Modeling instances
1. tables include warehouse, inventory, and book
2. The primary keys are warehouseid, inventoryid, and ISBN respectively.
3. Foreign key. The foreign key of table iinventory is warehouseid, and the foreign key of Table Book of warehouse is inventoryid and the primary key of inventory.
4. relationship: the relationship between table warehouse and table inventory is one-to-many.
The relationship between inventory and table book is one-to-many.
Iv. Summary
This article mainly introduces the modeling elements involved in database modeling, it mainly includes schema, primary key primary, foreign key, relational relationship, constraints constraint, Index, trigger, stored procedure, and view, and the instance is used to describe. This article is simple and the last article in the series of UML modeling-object-oriented technology. In this series of articles, I will write a summary later to make the UML modeling series more knowledgeable and clearer.
Technorati label: UML, software design
Source Document