Software Engineering—Development and Design

15370423:

PlanUML

Open source tool, use simple text description to draw UML diagram, official website address: https://plantuml.com/zh/

UML

An association is an ownership relationship that allows one class to know about the properties and methods of another class. An aggregation relationship is an association relationship, a strong association relationship; association and aggregation are syntactically indistinguishable, and specific logical relationships must be checked. However, the parts cannot exist alone without the whole. A composition relationship is an association relationship, which is stronger than an aggregation relationship.

Content Reference: Software Engineering

1. The conceptual model of UML

UML has a complete conceptual model, which provides a complete and comprehensive expression method. Its main elements include: ① The basic building blocks of UML ; Rules governing how these building blocks are put together ; mechanism .

Two, UML conceptual model legend

insert image description here

3. The basic building blocks of UML

In UML, vocabulary can be divided into three building blocks, that is, three types of vocabulary or basic elements: things , relationships and diagrams .

1. Things in UML

(1) Four kinds of things in UML

Things are the abstraction of the most representative components in the model, and can be divided into structural things , behavioral things , grouping things and annotation things .

1) Structural things

Usually the static part of the model that describes the physical elements of the concept. There are five main structural things:

  • Class (class): Consistent with the concept of class in the object-oriented approach.
  • Interface (interface): Describes the set of operations of a service of a class or component.
  • Use case (use case): Represents a system function and is a description of a sequence of actions performed by the system that will produce a valuable and observable result for a specific participant (that is, the system user).
  • Component (component): Describes the software physical things in the system.
  • Node (node): It is a physical element that exists at runtime and represents a computational resource.

2) Behavioral things

Behavioral things mainly include: state and interaction.

3) Group things

Grouping things mainly include: package.

4) Annotate things

Annotation things mainly include: annotations.

(2) Graphical method of various things in UML

According to the description of the four kinds of things above, the diagrams of various things in UML are given below.

insert image description here

2. Four types of relationships in UML

The four relationships in UML are: Dependency, Association, Generalization, and Realization.

(1) Dependence

Among the two model elements, one is independent and the other is non-independent. Changes to the independent model elements will affect the non-independent model elements .

Dependencies are indicated by dashed lines with arrows.

as the picture shows:

insert image description here

(2) Association

An association is a structured relationship in which two model elements are related . Bidirectional associations are represented by a solid line .

Note: There are multiple degrees of association relationships, mainly including: 0, 1, 0..1, 0..*, 1..*.

as the picture shows:

insert image description here

It is worth noting that there are two special types of associations in associations: composition and aggregation .

For composite and aggregate types, add a diamond symbol .

As shown below:

insert image description here

insert image description here

(3) Generalization

It is the relationship between general and special , that is, the relationship of inheritance . It is represented by a solid line and a hollow triangle .

as the picture shows:

insert image description here

(4) Realize

The implementation relationship is that one model element guarantees the execution of another model element, and this relationship is mainly used in the interface . represented by a solid line .

as the picture shows:

insert image description here

A complete picture is given below to review these four relationships.

insert image description here

Generate UML relationship diagram in IDEA

insert image description here

3. Graphics in UML (five categories and ten diagrams)

(1) Use case diagram

1) Definition of use case diagram

The use case diagram describes the system functions from the user's point of view and points out the operators of each function.

A use case diagram shows several roles or actors (actor) and the connections between these roles and the use cases provided by the system. A use case diagram defines the functional requirements of the system .

2) Basic composition of use case diagram

  • Example;
  • Role;
  • Relationships between roles (if any, mostly generalizations);
  • Relationships between roles and use cases (one-way or two-way associations);
  • Use cases and relationships between use cases (contains, extends, generalizes).

3) The relationship between elements

include:

  • include (include relationship), when two or more use cases share the same set of actions, it can be extracted as an independent sub-use case for sharing by multiple base use cases.
  • A base use case is not a complete use case , so it must be used together with a sub-use case to be complete.
  • The include relationship is represented in the use case diagram by a dotted line with an arrow (marked on the line <<include>>), and the arrow points from the base use case to the sub use case .

extend:

  • extend (extended relationship), the extension of the base use case , the base use case is a complete use case, even without the participation of sub-use cases, a complete function can be completed.
  • There will be an extension point in the base use case of extend, and only when the extension point is activated , the sub-use case will be executed.
  • The extend relationship is represented in the use case diagram by a dotted line with an arrow (marked on the line <<extend>>), and the arrow points from the sub-use case to the base use case .

The relationship between sub-use cases and base use cases:

(Generalization relationship) The child use case will inherit all the structure, behavior and relationship of the parent use case. That is to say, any place where a base use case is used can be replaced by a sub-use case.

(Generalization relationship) It is represented by a hollow arrow in the use case diagram , and the direction of the arrow points from the sub-use case to the base use case .

4) Icon

insert image description here

(2) Static diagrams: class diagrams, object diagrams, package diagrams

1) class diagram

①Definition: Class diagram (class diagram) describes all the classes involved in the system and the relationship between classes and classes.

② The basic composition of the class diagram:

  • class (class name, properties and methods);
  • Classes and relationships between classes (dependencies, associations, generalizations, implementations).

2) Object diagram

①Definition: An object diagram is an instance of a class diagram , and uses almost the same identifier as the class diagram, but there are certain differences between the two, as shown in the legend below.

②Legend:

insert image description here

(3) Behavior diagrams: state diagrams, activity diagrams

1) State diagram

①Definition: A state diagram (state chart diagram) describes all states of an object involved in the system and events that transition between states and states.

② The basic composition of the state diagram:

  • state(rounded rectangle);
  • The start and end of the state;
  • Events for transitions between states;
  • Notes (sometimes there).

③Legend:

insert image description here

2) Activity Diagram

①Definition: Activity diagram (activity diagram) describes the activities to be performed to meet the functional requirements of the use case and the constraint relationship between the activities.

② The basic composition of the activity diagram:

  • Activity (note that the symbol is different from the state);
  • The starting point and end point of the activity (sometimes there are multiple end points);
  • Activities are connected by arrows;
  • Judgment (sometimes there is an edge box);
  • Synchronization bars (indicating bifurcations or confluences of activity, both horizontal and vertical);
  • Swim lanes (representing different responsibilities of an activity).

③Legend:

insert image description here

(4) Interaction diagram: sequence diagram, collaboration diagram

1) Sequence diagram

①Definition: The sequence diagram shows the dynamic cooperative relationship between objects. .

② The basic composition of the sequence diagram:

  • object;
  • Lifeline (the dotted line directly below the object, indicating the existence of the object over a period of time);
  • Narrow rectangular bars (indicating that the object is activated, indicating that the object is performing some action);
  • Interactive messages (there is a sequence, the message is actually the operation method of the receiving object);
  • Annotations (sometimes available);
  • Can be converted into a collaboration diagram.

③Legend:

insert image description here

2) Collaboration diagram

①Definition: The collaboration diagram (callobaration diagram) has the same function as the sequence diagram, reflecting dynamic collaboration .

②The basic composition of the collaboration diagram:

  • object;
  • Solid line (the connecting line between objects, note that there is no arrow);
  • Interactive messages (there is a sequence, the message is actually the operation method of the receiving object);
  • Annotations (sometimes available);
  • Can be converted into a sequence diagram.

③Legend:

insert image description here

(5) Implementation diagram: construction diagram, deployment diagram

1) Component diagram

①Definition: Describe the physical structure of code components and the dependencies between components.

②Basic composition of component diagram: component.

③Legend:

insert image description here

2) Deployment diagram

①Definition: The physical architecture of the hardware in the system.

②Basic composition of the deployment diagram:

  • 3D cubes represent components;
  • Node names are located on top of the cube.

③Legend:

insert image description here

Data Flow Diagram and Data Dictionary

1. The components of the data flow diagram

The basic graphical elements in a data flow diagram include data flow, processing, data storage, and external entities (data sources or sinks). Among them, data flow, processing and data storage are used to build the data processing model inside the software system; external entities represent objects that exist outside the system, and are used to help users understand the source and destination of system data. The basic graphic elements of DFD are shown in the figure below:

insert image description here

**(1) Data flow: **Consists of a set of data with fixed components, indicating the flow of data. In DFD, the flow of data flow can have the following types:

1) flow from one process to another;

2) Flow from processing to data storage (write);

3) Flow from data storage to processing (reading);

4) flow from external entity to processing (input);

5) Flow from processing to external entities (output).

Each data flow in DFD is represented by a well-defined name. Except that data flows to or from a data store do not have to be named, each data flow must have an appropriate name that reflects the meaning of the data flow. It is worth noting that what is described in DFD is data flow, not control flow. Data streams are either made up of concrete data attributes (also called data structures) or other data streams. Composite dataflows are dataflows composed of other dataflows that are used to combine similar dataflows in a high-level dataflow diagram to make the dataflow diagram easier to read.

**(2) Processing: **Describes the transformation between the input data stream and the output data stream, that is, after the input data stream is processed, it becomes the output data stream. Each process has a name and number. The number can reflect which level and which map the process is located in the hierarchical DFD, and it can also be seen that it is a sub-process decomposed from which process. There are decision trees, decision tables, and structured languages ​​to describe processing. A processing can have multiple input data streams and multiple output data streams, but at least one input data stream and one output data stream.

**(3) Data storage: **Used to store data. Typically, a data stream that flows into a process disappears after being processed, while some (or all) of its data may be processed into an output data stream that flows to other processes or external entities. In addition, in software systems, it is often necessary to save certain information for later use, and data storage can be used at this time. For example, in the examination affairs processing system, the candidate roster generated during registration must be continuously supplemented during the registration process, and the relevant information of the candidate roster should also be used when counting results and making candidate notices. Therefore, a candidate roster can exist as a data store to hold relevant candidate information. **Each datastore has a well-defined name identifier. ** There can be a data flow flowing into the data storage, indicating the write operation of data; there can also be a data flow flowing out of the data storage, indicating the reading operation of the data; the data flow of the bidirectional arrow can also be used to point to the data storage, indicating the modification of the data .

What should be explained here is that the data storage in DFD can be realized by file system or database system in actual implementation. The storage medium for data storage can be disk, tape or other storage medium.

**(4) External entity (data source or sink): **refers to a person or organization that exists outside the software system, which points out the origin (source) of the data required by the system and the destination of the data generated by the system ( accommodation). For example, for an examination affairs processing system, examinees provide the registration form (input data flow) to the system, so candidates are a source of the examination affairs processing system; stream) to the test center, so the test center is a sink for the system. In many systems, a certain source and a certain sink can be the same person or organization, and at this time, they can be represented by the same symbol in DFD. Candidates provide registration forms to the system, and the system sends test admission tickets to candidates. Therefore, in the test management system, candidates are both the source and the sink. Source and sink are represented by the same graphic symbol, when the data flow flows from the symbol, it means it is the source; when the data flow flows to the symbol, it means it is the sink; when both, it means it is both the source and the sink .

Second, the layering of the data flow diagram

In principle, as long as the paper is large enough, the analysis model of a software system can be drawn on a piece of paper. However, a complex software system may involve hundreds of processes and hundreds of data flows, or even more. If they were drawn on a single diagram, it would be very complicated, not easy to read, and not easy to understand. So at this time, hierarchical data flow diagrams are usually used to clearly model slightly more complex practical problems.

The top layer of the hierarchical data flow graph has only one graph, in which there is only one processing, which represents the entire software system. This processing describes the data flow between the software system and the outside world, which is called the top layer graph. The decomposed graph of the processing (that is, the system) in the top-level graph is called the 0-layer graph, and there is only one graph.

The graph at the bottom of the layered data flow graph is called the bottom graph. In the bottom graph, all processing is no longer decomposed. The other graphs in the hierarchical dataflow graph are called intermediate layers, where at least one process (and possibly all processes) is decomposed into a subgraph. In the entire set of hierarchical data flow diagrams, any processing that is no longer decomposed into subgraphs is called basic processing.

3. Case analysis of data flow diagram

Case 1: Store business management system

(1) The top-level data flow diagram of a store business management system is as follows:

insert image description here

The above data flow diagram is just a high-level system logic model, which reflects the functions to be realized by the target system.

(2) The data flow diagram drawing steps of the management system are:

  • First determine the input and output of the system ;
  • According to the business of the store, draw a top-level data flow diagram to reflect the processing flow of the most important business ;
  • After analysis, the main functions of store business processing should include sales , purchasing , and accounting . The input source points and output destination points of the main data flow are customers and suppliers;
  • Then start from the input end, draw each processing frame through which the data flow flows according to the workflow of the store business, and gradually draw to the output end to obtain the 0th layer data flow diagram .

(3) Draw the data flow diagrams of layer 0 and layer 1 respectively according to the steps. The specific graphics are as follows:

  • The layer 0 data flow diagram is shown in the following figure:

insert image description here

  • Each processing item in the data flow diagram of the 0th layer is refined to obtain the data flow diagram of the 1st layer , which includes three major functions of sales , procurement and accounting . The specific data flow diagram is as follows:

insert image description here

insert image description here

insert image description here
insert image description here

Case 2: Student Status Management System

(1) The top-level data flow diagram of a student status management system is as follows:

insert image description here

(2) The data flow diagram drawing steps of the management system are:

  • First determine the input and output of the system ;
  • According to the business of the student status management system, draw a top-level data flow diagram to reflect the processing flow of the most important business ;
  • After analysis, according to the main functions of the student status management system , there should be four major functions: registration , achievement management , qualification management , and reward management . The input source and output destination of the main data flow are students and teachers;
  • Then, starting from the input end, according to the workflow of the relevant business of the student status management system, draw each processing frame through which the data flow flows, and gradually draw to the output end to obtain the data flow diagram of the 0th layer .

(3) Draw the data flow diagram of layer 0 according to the steps. The specific graphics are as follows:

  • The layer 0 data flow diagram is shown in the following figure:

insert image description here

Case 3: Large enterprise data center

In order to centrally manage and control users' access to data and support a large number of connection requirements, the data center of a large enterprise wants to build data management middleware . Its main functions are as follows:

(1) Data administrators can perform user management, operation management and authority management through middleware . User management maintains user information (username, password), which is stored in the user table; operation management maintains the standard operations of data entities and their back-end database information, which is stored in the operation table; authority management maintains the authority table, which stores Operation information that the user can perform.

(2) The middleware verifies the user information provided by the front-end application. If the verification fails, return illegal user information; if the verification passes, the middleware will wait for the front-end application to submit an operation request.

(3) After the front-end application submits the operation request, the middleware first checks the format of the request . If the format is incorrect , return format error information; if the format is correct , perform permission verification (verify whether the user has the right to perform the requested operation), if the user does not have the right to perform the operation, return insufficient permission information, otherwise perform connection management .

(4) Connection management connects to the corresponding back-end database and submits the operation. Connection management first checks whether there is an idle database connection, if not, create a new connection ; if it exists, reuse the connection .

(5) The back-end database performs operations and transmits the results to the middleware, and the middleware processes the received operation results and returns them to the front-end application.

Now use the structured method to analyze and design the system, and obtain the top-level data flow diagram and 0-level data flow diagram as shown in the figure below .

insert image description here
insert image description here

Answer the following questions:

  1. What three entities do E1, E2, and E3 refer to? E1: front-end application; E2: data management layer; E3: back-end database.
  2. Which three datastores do D1, D2, and D3 refer to? D1: user table; D2: operation table; D3: permission table.
  3. What does processing P refer to? And point out the two missing data streams in the 0-layer data flow graph, including the start point, end point and data stream name of the data stream. Processing p represents data management middleware . The two pieces of data lost in the 0-layer data flow diagram are shown in 4 and 5.
  4. What are the starting point, ending point, and name of the lost data stream 1? →The starting point is P , the end point is E , and the name is the operation result after processing .
  5. What are the starting point, ending point, and name of the lost data stream 2. →The starting point is E3 , the end point is P , and the name is the operation result .

4. Data dictionary case analysis

Case 1: Student Status Management System

The layer 0 data flow diagram of a student status management system is shown below.

insert image description here

**Question: **According to the above layer 0 data flow diagram, please write out the five entries of the student status management system.

Answer:

Item 1: Data Flow

insert image description here

Item 2: Data Elements

insert image description here

Item Three: Data Storage

insert image description here

Item Four: Data Processing

insert image description here

Item Five: External Items

insert image description here

Guess you like

Origin blog.csdn.net/HXBest/article/details/129642797