Composition of graphs and object graphs such as UML9

Source: Internet
Author: User

in UML, a class diagram identifies different entities, including people, transactions, and data, and the associations between those entities. Class diagrams describe the static structure of a system through the relationships between classes and classes in the system, including not only the various classes defined by the system, but also the relationships between them, such as associations, dependencies, and aggregations, which are valid throughout the life of the system. the object graph is used to display the location of real object instances of each class in the system, describes the static structure of the system at a specific point in time, and is an instance and snapshot of the class diagram.

the connection between a class diagram and an object graph is very tight: the object graph contains objects and chains, where objects are specific instances of a class, and chains are instances of relationships between classes, representing specific relationships between objects. There is also an essential difference between the class diagram and the object graph : The object graph describes a particular situation of the system, such as the system features at a certain point in time, and the class diagram describes the system characteristics of the system in general.

The composition of a class diagram consists of elements such as classes, interfaces, and their relationships, in order to describe how the system is constructed.

The composition of a class: The name of the class, the properties of the class, the operation of the class, the class's responsibilities, the class's constraints, and the class's comments.

Relationships between classes: dependency, generalization, association, implementation.


A class is the core of an object-oriented system's organizational structure. is an abstraction of a set of things that have the same properties, actions, relationships, and semantics.

The name of the class has the following characteristics: Basic, clear, concise, normative, uniqueness.

Basic: Each class must have its own name and can quickly find the desired class when queried.

Clarity: Identify the problem domain of the system in which the class is located, and express as much as possible the things that are to be expressed , and do not cause the names to be inconsistent with the functions of the class.

Simplicity: The class name is a noun, without a prefix or suffix.

Normative:

1. The first letter of the class name is capitalized, and if the name of the class consists of two words, it is merged, and the first letter of The second word is written in large.

2. The class names that can be instantiated are represented by traditional words, and abstract classes are represented by italics.

Uniqueness: The class has a unique name in the package, and the inclusion also has an effect on the name of the class, which can be used to make the expression: Printer (Fromoffice), or Office::printer.

The name of the class is good to facilitate communication between developers and facilitates the development of the system.


Properties of a class: a common feature abstraction that describes the static parts common to an object, and a class can have 0 or more properties. The properties of a class also have several attributes:

Visibility: Describes whether a property is visible to other classes, determines whether it is referenced by another class, is classified as public, protected class protected, and private. There is also a implementation type when the class is in a package, only visible in the package.

Property name: also has its own unique required name to distinguish it from other properties. Consisting of attribute nouns or noun phrases of a property. The first letter of the name is lowercase, and when more than one word is merged, the first letter of the remaining words is capitalized, except for the English word.

Property Type: The property of a class can be any type, including other types defined in the system.

The initial value of the property: it is used to protect the integrity of the system and to make it easier for users.

Property String: Specifies some additional information about the property.


The operation of the class refers to the actions that the class can perform, and describes the public feature abstraction of the dynamic part of the object represented in the software system. Used to manipulate the value of the property to change or perform other actions. A class can have 0 or more operations, and can only be used for objects of that class, described by a return type, a name, and a parameter table, which constitute the operation signature, which describes the information necessary for the action. The operation of the class also has its own characteristics:

Visibility: same attribute.

Action Name: Same property.

Parameter table: A sequence consisting of a type, an identifier pair, which is actually an action or method that is called to accept arguments that are passed over. A "name : Type" is used to indicate that multiple parameters are separated by commas. Method has no parameters, the parameter table is empty. Parameters can have default values, specified by the system.

Return type: Specifies the type of data returned by the operation, which can make any valid data type, including the type created. If there is no return value , then add the Void keyword, familiar with programming language C should not be unfamiliar, is the keyword return, followed by the main function in the required data type.

Property string: Same property.

The duties of a class: the same attributes and operations that are common to all objects of the class, the abstraction of the service, the non-similarity description of the function and the function of the class. This is not a required paragraph or multiple text description.

Class constraint: Specifies one or more of the principles that the class needs to satisfy, text information enclosed in curly braces.

class Comments: Adding more descriptive information is also a way to provide more descriptive ways for the class.  

An interface is a special class that describes the behavior of an object without giving the implementation and state of the object. Typically an interface consists of a series of operations, but does not include attributes, and there is no visible association to the outside world, so a class with good interfaces has a clear boundary.

Understand these, and then the use of UML to analyze the system can be done to the class drawing method, more can realize the rational rose and the combination of the powerful UML.

The next article summarizes the relationships between classes, and classifies the relationships between classes on a macro level.

Composition of graphs and object graphs such as UML9

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.