Suddenly, I was blinded by a question. I thought for a moment. For so long, my generation has already integrated the idea of object orientation.
Suddenly let me explain what I understand for the object. I will only say, block the object, extract the parent class, and extract the business interface .... Commonly used Channels
What is the idea of object orientation that I understand? I remember reading an articleArticle, Say what real cool people will use the idea of targeting the image to solve everythingProgram..
Maybe the experience is not over yet. comrades still need to work hard !!
Find an article that you can see for yourself.
Object-Oriented Analysis is a problem definition stage in software development. Its goal is to clearly and accurately define the problem field. Traditional system analysis generates a set of process-oriented documents that define the functions of the target system. object-oriented analysis generates a comprehensive document describing the basic features of the system functions and problem fields.
Principles
The main principles of object-oriented analysis are as follows.
1. Abstraction
Dropping individual and non-essential features from many things and extracting common and essential features is called abstraction. Abstraction is an essential means to form concepts.
Abstract principles have two meanings: first, although things in the problem domain are complex, analysts do not need to understand and describe everything about them, you only need to analyze and study the things related to the system goals and their essential features. Second, abstract concepts of a batch of things are obtained by extracting the common features of individual things from their differences in details.
Abstract is the most widely used principle in object-oriented methods. Abstract principles include process abstraction and data abstraction. Process abstraction refers to a sequence of operations that complete a specific function. Users can regard it as a single entity, although it may actually be completed by a series of lower-level operations. Data abstraction refers to defining data types based on operations applied to data, and limiting data values can only be modified and observed by these operations. Data abstraction is the core principle of object-oriented analysis. It combines data (attributes) and Operations (services) into an inseparable System Unit (that is, an object). You only need to know what the object is doing, you don't have to know how to do it.
2. Encapsulation
Encapsulation is to combine object attributes and services into an inseparable System Unit and conceal the internal details of objects as much as possible.
3. Inheritance
The object of a special class has all the attributes and services of its general class. It is called the inheritance of a special class to the general class.
In object-oriented analysis, the inheritance principle is applied to every general-special structure formed by general classes and special classes, the attributes and services shared by the object instances of the general class and the object instances of all special classes are explicitly defined in the general class at one time. In special classes, the defined items in general classes are no longer repeatedly defined, but in semantics, A special class automatically and implicitly owns all the attributes and services defined in its general class (and all upper-level general classes. The advantage of the inheritance principle is that the system model is concise and clear.
4. Category
Objects with the same attributes and services are divided into one class, and classes are used as abstract descriptions of these objects. The classification principle is actually a manifestation of the abstract principle applied to object description.
5. Aggregation
The principle of aggregation is to regard a complex thing as the Assembly body of some simple things, so as to simplify the description of complicated things.
6. Join
Association is a way of thinking that humans often use when thinking about problems: think of another thing through one thing. The reason for association is that there are some relationships between things.
7. Message Communication
This principle requires that objects can only communicate through messages, rather than directly accessing internal properties of objects outside the objects. Message-based communication is caused by encapsulation principles. In OOA, a message connection is required to indicate the dynamic relationship between objects.
8. Granularity Control
Generally speaking, when faced with a complex problem domain, it is impossible for people to view the whole situation at the same time, and to understand the problem. Therefore, you need to control your own field of view: Pay attention to its major components when considering the global situation, and do not take details of each part for the time being; when considering the details of a part, the rest of the part is temporarily removed. This is the granularity control principle.
9. Behavior Analysis
The behavior of things in the real world is complex. Various behaviors in the problem domain composed of a large number of things are often mutually dependent and intertwined.
Phase
The object-oriented analysis process can be divided into two stages: problem domain analysis and application analysis.
Problem domain analysis is a basic component of software development. It aims to enable developers to understand the structure of the problem domain and establish a general system implementation environment. The problem domain analysis provides a set of abstract concepts (representing the problem domain knowledge from the top, often beyond the scope of the current application) as a reference for the development of specific system requirements. Problem domain analysis is actually a learning process. At this stage, software developers should try to understand the application-related knowledge of the current system as much as possible. They should open up their thinking, broaden the scope of consideration, and identify application-related concepts as much as possible. The boundaries of problem domain analysis may be vague. With extensive knowledge in problem fields, you can quickly enter the status and master the core knowledge of the application when it comes to specific applications. In addition, when users change their requirements for the target system, extensive analysis can help us predict what changes will happen to the target system. Usually conduct group analysis. The group members can include field experts and analysts. During the analysis process, the basic concepts (objects, classes, methods, relationships, etc.) of the system should be identified and the characteristics of the problem field should be identified, and integrate these concepts into models in the problem field. The model of the problem domain must contain the relationship between concepts and all information about each concept. The identified concepts should be organically integrated into the comprehensive view of the problem field based on the information content.
Application analysis is based on the problem domain model established during problem domain analysis. During application analysis, the problem domain model is used in the current specific application. First, we use the collected user information to select the problem field and use the user requirements as restrictions to reduce the amount of information in the problem field. Therefore, the field of view of problem analysis directly affects the amount of information retained by application analysis. In general, models generated in the problem domain analysis stage do not need to be expressed in programming languages, while the impact conditions generated in the application analysis stage need to be expressed in a programming language. Model Recognition requirements can be applied to one or more applications. We usually focus on two aspects: application view and Class View. In the class view, you must refine the attributes and operations of each class and express the interaction between classes.
Target
Coad and Yourdon believe that object-oriented analysis should mainly consider objects related to specific applications and the relationship between structures and interactions between objects. In object-oriented analysis, an analysis model is required to describe the functions of the system.
Object-Oriented Analysis requires the following two tasks:
-Formally describe the application problems faced, and ultimately become the basic object of the software system, as well as the rules and constraints that the system must follow and are determined by the application environment.
-Explicitly specify how the objects that constitute the system work together and complete the specified functions.
The system model created through object-oriented analysis is conceptual and therefore called a conceptual model. A conceptual model consists of a group of related classes. Object-Oriented Analysis can build a system model through top-down decomposition, or start from the defined classes to build new classes. The construction and review of a conceptual model consists of the following five layers:
-Class and object Layer
-Attribute Layer
-Service Layer
-Structural layer
-Topic Layer
These five layers are not the layers of the software system, but the layers of the analysis process. It can also be said that the problem is different. Each layer of work adds an integral part to the System Specification Description. When all the five layers are completed, the task of object-oriented analysis is completed.
In practice, the objective of object-oriented analysis is to obtain functional models, object models, and dynamic models of the problem domain, and express them with the corresponding UML diagram.
Procedure
Object-Oriented Analysis is usually performed according to the following steps:
(1) identify objects and classes. The basic classes and objects of the entire application can be gradually determined from the application field. This step needs to analyze the responsibility of the target system in the field, investigate the system environment, and then determine the classes and objects that are useful to the system.
(2) identify structure. There are two typical structures: general-special structure and general-part structure. General-special structure indicates that a general class is a base class, and a special class is a derived class. For example, cars are the basis of cars and trucks. This is a general-special structure. Partial structure indicates aggregation, and members of different classes are aggregated into new classes. For example, the wheels, car bodies, and chassis are all part of the car, and the components with different functions aggregate into the whole of the car.
(3) Identify attributes. The information saved by the object is called its attributes. Class attribute description status information. In an instance of the class, the attribute value indicates the status value of the object. You need to find the attributes required by each object in the target system, arrange the attributes in the appropriate location, locate the instance connection, and then check. The name and description of each attribute should be given, and special restrictions on the attribute should be specified (such as read-only and attribute value limited within a certain range ).
(4) Identify the service. The operation performed after an object receives a message is called the service provided by the object. It describes the processing and functions to be executed by the system. The purpose of defining a service is to define the behavior of an object and communication between objects. The specific steps include:
-Identifies the object status
-Mark necessary services
-Identify the message connection
-Description Service
Services can be represented in a chart similar to a flow chart.
(5) Identify the topic. To better understand conceptual models that contain a large number of classes and objects, You need to identify the topic, that is, to divide the model, give the overall framework of the model, and divide the hierarchy. Follow these steps to identify a topic.
-Recognize a topic
-Improve and refine themes
-Add a topic to the analysis model.
A topic is an application-related concept, rather than manually cited. The work at the topic layer helps you understand the analysis results.
Advantages
Object-Oriented analysis mainly involves the following:
(1) enhanced understanding of problem domains and system responsibilities;
(2) improve communication between various personnel involved in analysis;
(3) strong adaptability to changes in demand;
(4) Support software reuse;
(5) consistency throughout the entire software lifecycle;
(6) practicality;
(7) conducive to user participation.