When it comes to design patterns, we have to deal with the idea of modeling, and when it comes to modeling ideas, UML is naturally applied, and there are many tools for open source UML, which are very convenient to use. In recent years, with the development of software application domain to rapid iterative trial and error, UML in agile development, especially in the field of web and mobile development applications less and fewer.
On the domestic software industry development status, stable and mature business software is very rare, the first embryonic Internet app big line, the competition of the company more value is the rapid occupation of the market, small team quickly iterative trial and error, rather than long-term, carefully polished the same software products, so pay attention to unified norms, adequate demand analysis, The tightly framed UML is relatively cumbersome and will naturally be replaced by flexible and agile development process documents such as modeling sketches, wikis, Kanban boards, annotations, and other light documents.
For agile and traditional development, modeling is always essential, regardless of whether or not the UML tools are widely used, to help us clarify our thinking and to better analyze and design a software framework that is easy to scale and maintain. From the current market, UML based on the chart is the best choice to be familiar with modeling ideas and design patterns.
Introduction to UML
To put it simply, the core of UML is the diagram, which is a design criterion unrelated to the specific programming language, which defines, refines, writes, constructs the elements in the software system, and defines the participants, entities, processes and call relationships among them in the software development with visual graphs, covering the abstract representations of all phases of software development.
The advantage of UML lies in analyzing, modeling and organizing design ideas.
Modeling Ideas
Before the final design and implementation of the software system, usually need to draw a certain amount of time to abstract the development model at different levels, a little bit of scale of the project, teamwork is essential, the development model can also help team members to communicate better, so whether it is a sketch or UML, We all need to build some intuitive, clear documentation of the projects in development. The starting point of modeling is as follows:
-Better understanding of user needs, avoiding misinterpretation or omission
-Better system analysis and design to avoid rework
-Help team communication and project co-development, avoid burying pits
-Help improve development speed and quality and reduce communication costs
UML Common diagram
UML commonly used diagrams have 13 kinds, can be classified as structure diagram (Structure diagrams) and Behavior diagram (Behavior diagrams).
- Structure diagram: Emphasizes the static structure of system construction, including class diagram, object graph, Package diagrams, Component diagram, deployment diagram, composite structure diagram
Class diagram (class Diagram)
Class diagrams are the most commonly used UML diagrams and are the basis for other UML diagrams. Class diagrams are used to display classes, interfaces, and the static structure and relationships between them.
Elements in a class diagram: classes, interfaces, relationships, collaborations, constraints, annotations, packages
Relationships in class diagrams: generalization, implementation, association, aggregation, composition, dependency
Object Graph (Diagram)
An object graph can be viewed as a mirror image of a class diagram at some point in the system.
Elements in an object graph: objects, links, packages
Relationships in object graphs: generalization, implementation, association, aggregation, composition, dependency
Package diagrams (Package Diagram)
Package diagrams is a description of the relationship between packages and packages, showing the dependencies between modules and modules in the system.
Elements in Package diagrams: classes, interfaces, components, nodes, collaborations, use cases, and other packages
Relationships in package diagrams: generalization, refinement, dependency
Component Diagram (Component Diagram)
Component diagrams, also known as building diagrams, are used to model the various components of a system, including source code files, binaries, script files, and the relationships between files that can be executed.
Elements in Component diagrams: Artifacts, interfaces, relationships, ports, connectors
Relationships in Components: dependencies, generalization
Deployment diagram (Deployment Diagram)
A deployment diagram is a presentation of the physical architecture of software and hardware in a running system and the distribution of components for processing nodes
Elements in a deployment diagram: nodes, node instances, node types, node containers, objects, joins
Relationships in the deployment diagram: dependencies, associations
Composite structure diagram (Composite Structure Diagram)
A composite structure diagram is used to describe the constituent structure of a part and its members, the connection between members, and the interface and collaboration with external components.
Elements of a composite chart: parts, fittings, ports
Relationship of composite structure Diagram: Association, composition, generalization, dependence
- Behavior diagram: Emphasizes the dynamic behavior of objects in the system, including use case diagram, activity diagram, State diagram, Interaction overview diagram, Communication diagram, timing diagram, time graph
Case diagram (use cases Diagram)
Use case diagrams show from a customer perspective which participants in the requirements model want to provide what use case capabilities and call relationships between functional modules
Elements in a use case diagram: Actors, use cases, relationships
Relationships in use case diagrams: associations, inclusions, extensions, generalizations
Activity Map (Active Diagram)
The activity diagram is used to describe the activities required by the use case function and the constraint relationship between the activities, which facilitates the process control between the objects.
Elements of an activity diagram: Active state, Action state, Control point, transfer, start node, terminating node, object, object flow, Swimlane
Relationship of activity diagrams: control transfer, branching and merging, bifurcation and convergence
Status diagram (state machine Diagram)
A state diagram is used to describe all possible states of a particular object, as well as transitions between states raised by each event, emphasizing control flows from state to state
Elements of a state diagram: states, Transformations, events, activities, actions
Relationship between state diagrams: There are combinations and transitions between States and states
Interactive overview diagram (Interaction overview Diagram)
The interaction overview diagram is a diagram that combines activity and time series diagrams, merging the sequence picture segments and control flow constructs
Elements of the interaction Overview diagram: Active state, Action state, Control point, transfer, start node, terminating node, object, object flow, Swimlane
Interaction Overview Diagram Relationships: Control transfer, branching and merging, bifurcation and convergence
Communication Diagram (communication)
Communication diagrams describe the cooperation and invocation relationships between the objects that send and receive messages
Elements of a communication diagram: objects, chains, messages
The relationship of a communication diagram: Passing a message between different objects through a chain
Timing Diagram (Sequence Diagram)
Time series diagrams are also called sequence diagrams or sequence diagrams, which describe the order in which messages are routed between objects.
Elements of a time series diagram: Roles, objects, lifelines, control focus, messages
Relationship between time series diagrams: A constraint relationship between sequence diagram objects
Time Chart (Timing Diagram)
Used to describe the state of a single or multiple objects changing or maintaining over time
Elements of a time graph: time constraints, duration constraints, lifelines, states, conditions, events
Relationship between time graphs: There is a time constraint between events, and there are transitions between states
UML Common Symbols
- Class diagram: Classes diagram Abstract classes are represented in italics
- Object diagram: Objects graph
- Start, end: Starting, ending
- <<include>>: Include relationship
- <<extend>>: Extending relationships
- Generalization: Generalization
- Dependency: Dependency note arrow points to: B depends on a
Multiplicity: Multiple Sex
*-1 is only 1
-* from 0 to infinity
-0..1 0 or 1
-N.. Any number between m [N, M]
UML Extension and refinement
As mentioned at the beginning of this article, UML in the fast iterative internet and mobile internet era does not seem to have been used so widely, more often developers in the implicit use of UML features, such as drawing classes, packages, use cases, components and other sketch-aided design, But it does not take much time to make formal UML legends and rework frequently because of changing requirements. And the interface programming is applied more and more in the frame design, but the interface characteristic is not expanded and refined in UML2.0, so the development process of the software development process, especially the Web & mobile app, needs the UML to upgrade to adapt to the development of software engineering. For the extension and refinement of UML, the individual has the following aspects are not very mature views, for reference only:
- Generate UML diagrams from implemented code: In fact, this feature has been provided in many Ides, but the functionality is not comprehensive and easy to use
- Refine the specification and contract for UML diagrams in terms of interfaces: this attempt has not yet been found in UML, and in other development processes and tools there is abstraction and refinement of interface import, export, constraints and other contracts
- Extend the new branch xuml in UML (automatically generate code based on XUML): This requires a rich code base support, temporarily not easy to do, once the base code base is abstracted, it should greatly improve the development efficiency
- Obsolete UML concept: UML commonly used in 13 kinds of diagrams, commonly used are several, other norms and contracts although the practicality is getting smaller, so need to properly slimming
Python design mode-UML-Overview