Object-to-class relationships Concepts and characteristics of objects
An object represents a single, confirmed object, unit, or entity, which can be concrete or abstract, and has a definite definition in the problem domain.
of the role. In other words, an object is anything that is very clear about the boundary.
State (attribute): The state of an object includes all the properties of an object (usually static) and the current (usually dynamic) of those properties.
Behavior (method, Event): No object is orphaned, objects can be manipulated, and other objects can be manipulated. And behavior is an object
Root The action taken and the response made by its state change and message delivery.
Identification (first name): In order to distinguish an object from all other objects, we usually give it an "identity".
objects and classes
An object is a concrete entity that exists in time and space, and a class represents only an abstraction that abstracts the "essence" of an object.
A class is a collection that shares a common structure and a common behavior object.
Classes are static, objects are dynamic, classes are generalized, objects are personalization, classes are definitions, objects are instances, classes are abstractions, objects are concrete.
Introduction to object graphs
The object graph shows a set of objects and their relationships. Use object graphs to illustrate data structures, static and fast instances of classes or components in class diagrams
Photos Object graphs and class diagrams reflect the static process of a system, but it is expressed in terms of actual or archetypal scenarios.
The object graph shows the relationship between objects and objects at some point. An object graph can be seen as a special use case for a class diagram in which instances and classes can be displayed. Right
As also linked to the collaboration diagram, the collaboration diagram shows the object prototypes in context.
A UML object graph is an instance of a class diagram that uses almost exactly the same identity as the class diagram. Their difference is that the UML object graph shows that multiple objects of the class are real
example, not the actual class. An object graph is an instance of a class diagram. Because the object has a life cycle, the object graph can only be stored at a certain time of the system
In.
There is no need to provide a separate form for the object graph. The class diagram contains the object, so only the object and no class diagram is an object graph. Then
The object graph is useful for characterizing specific uses of each aspect.
Object graphs display the set of objects and their relationships, which represent the state of a system at some point. It contains objects with values, not descriptors, and of course, in many cases
The following object can be a prototype. A collaboration diagram shows an overall model of objects that can be instantiated more than once and their relationships, and the collaboration diagram contains descriptors for objects and chains.
If the collaboration diagram is instantiated, an object graph is generated.
The UML object graph does not show the evolutionary process of the system. For this purpose, you can use a collaboration diagram with a message, or a sequence diagram to represent an interaction.
purpose of UML object graph:
1) capturing instances and connections
2) Create in the analysis and design phase
3) Capturing the static part of the interaction
4) Illustration of data/object structure
5) Detailed description of the transient diagram
6) developed by analyst, designer and code implementation personnel
representation of object graphs
Object name: Because the object is an instance of a class, the format of its name is "Object name: Class name", and these two parts are optional, but if the package
Contains the class name, you must add ":", in addition, in order to distinguish with the class name, you must also underline.
Property: Because the object is a specific thing, all property values are determined, so the values are usually listed later in the property.
Reading UML object diagrams
First find out all the classes, that is, the name after ":"
After finishing, you can see the meaning of the object by its name
Summarize attributes by class, and then correlate to determine meaning
The process of drawing an object graph
Find classes and objects first, usually after the keyword "class", "new", "implements", and the object name is usually after the class name
Then, the detailed analysis of the correlation is made to draw the corresponding object graph.
The process of drawing an object graph
The design of the demonstration class model: When a class model is designed, you can simulate the state of a runtime by the object graph, so that you can study the running
The rationality of the design. At the same time, it can also serve as a basis for developers to discuss.
Analyzing and explaining source code: Because class diagrams only show the static class structure of a program, it is difficult to understand the intent of the code through a class diagram. So in
When you analyze source code, you can refine the analysis by using an object graph. For developers, when interacting with more complex classes of logic, you might consider drawing some UML
Object graph for additional instructions.
UML Object graph instances
The following figure is an example of an object graph. It represents the order management system that we have discussed in the class diagram. is one of the system's real
For example, to purchase at a specific time. It has the following objects: Customer, order, special order, General order.
Now the Customer object (C) is the third-order object (O1,o2 and O3). These order objects are associated with special orders and General Order objects (S1,S2 and
N1). The customer has the following three orders with different numbers (12,32 and 40) for the specific time considered.
Now, the number of orders that customers can increase in the future, in which case the object graph will be reflected. If orders, special orders, and normal rank order objects that
Observation will find that they have some value.
The value of the order is 12,32 and 40, which means that when these objects all own these instances, the value of a particular moment is captured (this is the moment when the purchase is
As a specific time).
The number of orders for the same special order and normal order object is 20, 30 and 60, respectively. If it is considered a different time to buy, then
These values will change accordingly.
Therefore, the following object graph has been painted to take into account all the points mentioned above:
the difference between a class diagram and an object graph
Object Diagram describes the state of the individual objects participating in the interaction at some point in the process of interaction. Object graphs can be thought of as classes
An instance of a picture at a moment.
In UML, an object graph uses the same symbols and relationships as a class diagram, because an object is an instance of a class. Shows the model of the object graph. Its
The nodes in a node can be objects or classes, and lines represent relationships between objects.
UML Modeling Learning 8:object Diagram