Static Structure Analysis

Source: Internet
Author: User








Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis text: static structure split describes the static relationship between objects and classes, simulate the static structure of objective objects by establishing various static links between objects and classes. Although the specific steps and results of different analysis methods are different, the basic idea is to use an object model to depict the static hierarchy of the system, as shown in step 1. Figure 1 static hierarchical structure of Object Model Ref: Random

Recognize objects and Classes

Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis, and recognition of objects and classes of text: analysis always starts from the discovery of objects. If you have a deep understanding of the characteristics of objects, it is not difficult to extract various possible classes and pairs from the Problem description.
Image. Objects usually correspond to nouns in the Problem description. Therefore, nouns are often used as candidates for classes. However, not all nouns are suitable for class or objects, and only for problem descriptions, it may not cover the problem.
There are some problems. Therefore, you need to analyze the specific issues when selecting classes. For example, for the problem statement "Xiao Li uses dinner at the restaurant", Xiao Li can be expressed as an object. It is also a noun, but the restaurant and the late police may not be expressed
Class. If this description appears in the employee's meal recipe management system description, because a dinner is made up of staple food and various dishes, the composition and other information is required by the software, therefore, dinner is of the class nature. Reverse
If the above description focuses on where a person eats, such as where the lunch is, where the dinner is, and so on, and there is no need to describe the specific content of each meal, therefore, dinner is not suitable for class descriptions. In the Problem description, the principle of selecting a class or object is very simple: on the one hand, an object is the encapsulation body of attribute data and behavior. Therefore, if a concept represented by a noun in the Problem description has an internal structure, there is a high possibility that it needs to be described using classes;
On the other hand, the behavior of the system is considered to be the result of mutual operation between objects according to the object-oriented methodology. This is an expression of this meaning, that is, if the two identities in the Problem description interact with each other
The two terms are suitable for class description. Although the principle is simple, it is not easy to extract classes accurately in the Problem description, because the problems described by natural language usually have many meanings, different words may be used to describe the same thing, or the description of the problem may be incomplete. Therefore, it is necessary to accumulate experience to master the methods of recognition. Ref:. txt

Recognition Association and aggregation

Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis, identification of association and aggregation text: Association often corresponds to the static verb or verb phrase in the Problem description, establish a connection between classes, such as "working for workers" between class "persons" and Class "companies ". Common associations include locations (such as "include" and "above"), and "communication" (such? #36890;), "own", and the constraints associated with the two classes. Aggregation is actually a special case of association. It is generally not recommended to spend a lot of time in the initial stage of analysis to differentiate aggregation and association. When encountering an association, we should follow the Analyst's understanding, it can be described in a more natural way, regardless of aggregation or association, as long as it is easy to understand. Ref:. txt

001


Recognition attributes

Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis, and recognition of attribute text: attributes are used to describe the characteristics of an object and describe the characteristics of a behavior subject, such as name, age, weight, color, and speed. Attribute access
It often corresponds to a noun with all lattice phrases in the Problem description, for example, the memory size of a computer, the price of a car, and the location of an airplane may all be attributes of the corresponding object.
Some adjectives and nouns that only have enumeration properties are usually taken as possible values. For example, the values of "computer memory size" and "car price" are integers, the value of "color" may be
It is red or blue. There may be many attributes of an object, but it is not necessary to consider all attributes of the object at a certain stage in the analysis process.
You can use the problem-related attributes. For example, if the object of the class "person" is a specific person, it generally has attributes such as name and age, however, if the created system does not use a person's name or age
There is no need to introduce up to two attributes. Ref:. txt

Model Improvement

Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis, model improvement text: After the above steps are completed, the next step is to use the inheritance of the class question to optimize the existing model structure, and share part of the code of the parent class to make the model
The structure tends to be simple, or the relationship between classes is more closely formed by establishing a general relationship between classes. There are three main methods to use the inheritance optimization model: the first is to extract common class members to form a parent class.
Is a bottom-up method. The second is to improve an existing class (add new members to the class) to form a subclass. This is a top-down method; the third is to split classes with a large description range.
To the appropriate class of the new scale. Ref: .txt, extracted from the public. txt, and separated into members. txt, then the new category. txt

Extract public members

Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis, model improvement, and extraction of Public Member text: for the two classes formed after preliminary object-oriented analysis, if their attributes and operations are the same, you can create a new class
Class: extracts the same attributes and operations of existing classes as attributes and members of general classes, and extracts classes with the same members as special classes to form a general special structure. Example 2 TV and refrigerator,
They all have attributes such as model, appearance color, and manufacturer. Therefore, the household electrical category is set up as a general category, and the common characteristics of TV and refrigerator music are extracted and put into the household electrical category. The remaining part is a special category. Figure 2 extract common members to form a general-special structure Ref: .txt,14_3_2_2.jpg

Detach some Members

Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis, model improvement, separated part of the text: Due to the depth of understanding the problem space object, sometimes some properties or operations in the defined class only apply to some objects, while
It doesn't make sense. The direct cause of this situation is that the scope of the class is too large, and the scope of the class is appropriately reduced, and the objects with the same nature and behavior are described as a class. Example 3 original school staff
This includes two attributes: salary and class teacher, but the school staff does not have the valid values of these two attributes. For example, for teachers, there is no class teacher. For students, there is no salary, therefore, two attributes are encapsulated in
The scope is too large. They should be separated to form two new classes-teachers and students, and the common residence and operations of the two classes should be placed in the general class, form a general special structure. Figure 3 separated member Ref: .txt,14_3_2_3.jpg

Add a member to derive a new class

Tag: Object-oriented programming, object-oriented problem modeling, static structure analysis, model improvement, adding members to derive new class text: for existing classes, adding a session or method can derive a new class. In section 4, there is already a class "person" who describes a person, which has a name and an address.
Two attributes. If you need to introduce a primary class and the primary class has attributes such as name, address, teaching class, and teaching age, you can consider whether the primary class can be derived from the class "person", although the primary class
The name and address of an attribute are not explicitly described. However, because this class is a subclass of a class, it inherits the two attributes of its parent class "person. Figure 4 Add a new member Ref: .txt,14_3_2_4.jpg

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.