object-oriented

Software development method
Collection
zero Useful+1
zero
face object (Object Oriented) Yes Software development method , a programming paradigm. face object The concept and application of Programming and software development , extended to database system interactive Type interface, application structure, application platform distributed system Network management Structure CAD Technology artificial intelligence And other fields. Object oriented is a way of understanding the real world and abstract It is the product of the development of computer programming technology to a certain stage.
Object orientation is relative to Process oriented Speaking of, Object oriented method , organize relevant data and methods as a whole, and carry out the system from a higher level modeling , closer to the natural operation mode of things. [1]
Chinese name
object-oriented
Foreign name
Object Oriented
Role
software development
Field of use
CAD technology, artificial intelligence, etc

definition

Announce
edit
The meaning of object refers to a specific thing, that is, something that can be seen and touched in real life. In object-oriented programming, an object refers to a component of a computer system. In object-oriented programming, objects have two meanings, one is data, the other is action. An object is a combination of data and action. The object can not only operate, but also record the operation results in a timely manner. [3]
Method refers to the operation that an object can perform. The method also has another name, called function A method is a defining function in a class. Its specific function is to describe and operate an object. [3]
inherit In short, it is a hierarchical model, which can be reused. The upper layer of the hierarchy has generality, but the lower layer has particularity. In the process of inheritance, the class can inherit some methods and variables from the topmost part. In addition to inheriting, classes can also be modified or added. In this way, work efficiency can be effectively improved. Here is an example. When class X inherits class Y, class X is a derived class, while class Y belongs to a base class. [3] Inheritance is a process from general deduction to special deduction, which can reduce the redundant content of knowledge representation. The maintenance and modification of knowledge base are very convenient. It is more conducive to deriving complex systems. [4]
class It is an abstraction of objects with the same characteristics (data elements) and behavior (functions). Therefore, the abstraction of an object is a class, and the concretization of a class is an object. In other words, the instance of a class is an object. In fact, a class is a data type. A class has attributes, which is an abstraction of the state of an object. Data structures are used to describe the attributes of a class. Class has an operation, which is an abstraction of the object's behavior, and is described by the operation name and the method to implement the operation. [2] Each object of class mapping has these data and operation methods. Class inheritance has hierarchy and structure. High level objects encapsulate complex behaviors, and specific details are transparent to the knowledge of this level, which can reduce the complexity of problem solving.
encapsulation It is to bind data and code together. Some data and code of objects can be private and cannot be accessed by the outside world, so as to achieve different levels of access to data and code. It prevents the impact of changes caused by program interdependence, and the object-oriented encapsulation is clearer and more powerful than the traditional language encapsulation. It has effectively achieved two goals: data and behavior packaging and information hiding. [1]
Polymorphism refers to the ability of different things to have different forms of expression. polymorphic The mechanism enables objects with different internal structures to share the same external interface, which reduces code complexity in this way. One interface, multiple ways. [1]
Dynamic binding refers to the behavior of linking a procedure call with the corresponding code. Dynamic binding It refers to a binding that the code associated with a given procedure call can only be known at runtime. It is a specific form of polymorphic implementation. [1]
Message transmission: objects need to communicate with each other. The way of communication is to send and receive information between objects. The message content includes the identification of the object receiving the message, the identification of the function to be called, and the necessary information. The concept of messaging makes it easier to describe the real world. [1]
The object-oriented method is a software development method that uses abstraction, encapsulation and other mechanisms to construct software systems with the aid of the concepts of object, class, inheritance, message passing and so on. [1]

Early development

Announce
edit
Early computer programming was based on process oriented methods, such as the realization of arithmetic operations 1+1+2=4. By designing an algorithm, we can solve the problem at that time. With the continuous improvement of computer technology, computers are used to solve more and more complex problems. All things are objects. Objects in the real world are abstracted into objects, and relationships in the real world are abstracted into classes inherit To help people realize abstract And digital modeling. The object-oriented method is more conducive to the analysis, design and programming of complex systems in a way that people understand. At the same time, object-oriented can effectively improve programming Through encapsulation technology, the message mechanism can quickly develop a new system like building blocks. Object oriented refers to a Programming paradigms It is also a method of program development. Object is class Concrete implementation of. It will object As program The basic unit of data encapsulation Among them, to improve the reusability, flexibility and extensibility of software. [2]
face object The idea of software development All aspects of. For example, object-oriented analysis( OOA Object Oriented Analysis), Object oriented design OOD Object Oriented Design)、 And what we often say Object-oriented programming implementation OOP Object Oriented Programming)。 [2]

background

Announce
edit
face object Is on Structured design method It arises at the historic moment when there are many problems. Structured design method The basic strategy for solving problems is to examine the problem domain from the perspective of function. It regards applications as functional module The subprocess is the underlying functional module that implements a specific operation. In each function module, use data structure Describe the organization of the data to be processed, using algorithm Describe the specific operation process. In the face of increasingly complex application systems, this development idea gradually exposed some weaknesses in the following aspects. [2]
1. View of problem domain
Existing in the real world object It is the protagonist in the problem domain. The so-called object refers to the objective existence object Entity and Subjective abstract It is the main goal of human beings to observe and solve problems. For example, for a school Student management system For example, whether it is simple or complex, it always focuses on students and teachers object implementation. In nature, every object They all have some attributes and behaviors, such as student number, name, gender and other attributes, as well as class, examination, experiment and other behaviors. Therefore, each individual can be described by attributes and behaviors. [2]
Usually, the perspective of human observation is these object The attribute of the object reflects the state of the object at a certain time, and the behavior of the object reflects the operation that the object can engage in. These operations are attached to object It can also be used to set, change and obtain the state of the object. Any problem domain has a series of object Therefore, the basic way to solve the problem is to let these objects drive and interact with each other, and finally make each object change its attribute state according to the wishes of the designer. [2]
Structured design method The design idea adopted is not to object As a whole, it extracts the behaviors attached to the object, and designs and constructs the application system with the function as the goal. This practice led to Programming When the object The real world formed by functional module In the solution space, this transformation process not only increases the complexity of program design, but also deviates from the basic idea of observing and solving problems. In addition, after careful consideration, it will be found that in any problem domain, object Is stable, but behavior is unstable. For example, no matter the national library, the school library, or the international library, there will be books object However, the method of managing books may be quite different. Structured design method Position the perspective of examining problems on unstable operations, and describe object The separation of the properties and behaviors of the application makes it very difficult to maintain and expand the application in the future. Even a small change will affect the entire system. In the face of the increasing scale of problems, the increasing complexity of the environment, and the accelerating changes in demand, the basic method of solving problems by using computers will be unified to the traditional method of solving problems by human beings, completely changing software design The phenomenon of the distortion of methods and human's conventional way of solving problems is imminent object The primary reason for. [2]
2. Abstract level
abstract It is the basic magic weapon for human beings to solve problems. Good abstract The strategy can control the complexity of the problem and enhance the universality and Scalability abstract It mainly includes process abstraction and data abstraction. Structured design method Process is applied abstract The so-called process abstract It is to extract operations with clear functional definitions from the problem domain and treat them as an entity. such abstract Level is somewhat arbitrary for the design of software system structure, and its stability is poor, which makes it difficult to accurately design every operation link of the system. Once a object The change of attribute representation may involve many parts of the existing system. And data abstract It is a higher level of abstraction than process abstraction, and will describe object The attributes and behaviors of the simulation [2]
3. Package
encapsulation It refers to the integration of a object The properties of are bound to the behavior and placed in a logical unit. This logical unit is responsible for hiding the described attributes object All access to internal properties can only be made through the provided User interface realization. In this way, we can not only object The protection effect of attributes can also be improved software system Maintainability of. As long as the user interface does not change, any encapsulation Changes inside the body will not affect software system Other parts of. Structured design method Didn't do it object The whole of encapsulation , just encapsulating each functional module Each function module can operate on the object attribute without protection at will, and because the data describing the attribute is separated from the behavior, once the expression mode of an object attribute changes, or the effect of an action changes, it may have an impact on the whole system. [2]
4. Reusability
can reusing It marks the reusability of a software product and is an important symbol to measure the success of a software product. In today's software development industry, people are increasingly seeking to develop more and more reusable, more universal component Thus, the software development process is completely improved, that is, from the past statement level writing to component assembly, so as to improve the efficiency of software development and promote the rapid expansion of application fields. However, Structured programming method The basic unit of is module, and each module is only a description of the process of realizing specific functions. Therefore, its reusable unit can only be module. For example, in C language Use a lot of Standard function However, for modern software development, such reuse is insignificant, and when some data type When changes occur, those functions can no longer be used. Therefore, the desire for greater reusability component It is the application field software development New requirements proposed. [2]
The above weaknesses drive people to seek a new programming method to adapt to the modern society software development Higher requirements for object This results. [2]

features

Announce
edit
(1) Object uniqueness.
Each object has its own unique identifier, through which the corresponding object can be found. Throughout the life of an object, its identity does not change, and different objects cannot have the same identity. [2]
(2) Abstraction.
abstract Sex means that there will be consistent data structure Objects (attributes) and behaviors (operations) abstract Categorization. A class is such a kind abstract , which reflects important properties related to application, while ignoring other irrelevant contents. The division of any class is subjective, but it must be related to the specific application. [2]
(3) Inheritance.
Inheritance Is the child class automatically sharing the parent class data structure This is a relationship between classes. When defining and implementing a class, you can base on an existing class, take the content defined by the existing class as your own content, and add some new content. [2]
Inheritance is Object-oriented programming Language is different from other languages in the most important characteristics that other languages do not have.
In the class hierarchy, a subclass only inherits the data structure and methods of a parent class, which is called single inheritance.
In the class hierarchy, a subclass inherits the data structures and methods of multiple parent classes, which is called multiple inheritance
multiple inheritance JAVA, VB, NET, and Objective-C only support single inheritance. Be careful of ambiguity when C++inherits multiple inheritance.
stay software development , of class Inheritance This is an effective method of information organization and classification, which simplifies the object The workload of creating classes increases the reusability of code.
use Inheritance , which provides the hierarchical structure of the class specification. By class inherit Relationship, which enables common features to be shared and improves the reusability of software. [2]
(4) Polymorphism
Polymorphism It means that the same operation or function or procedure can act on multiple types of objects and obtain different results. Different objects can produce different results after receiving the same message. This phenomenon is called polymorphism.
Polymorphism allows each object to respond to a common message in a way that suits it.
Polymorphism enhances the flexibility and reusability of software. [2]

development method

Announce
edit
The research of object-oriented development methods has become increasingly mature, and many object-oriented products have appeared in the world. Object oriented development methods include Coad method, Booch method and OMT method. [2]
1. Booch method
Booch first described the object-oriented Software development method Object oriented development is a design method that is fundamentally different from the traditional functional decomposition. Object oriented software decomposition is closer to people's understanding of objective things, while functional decomposition is only obtained through transformation of problem space. [2]
2. Coad method
Coad method is an object-oriented development method proposed by Coad and Yourdon in 1989. The main advantage of this method is that it puts forward a set of systematic principles in the identification of objects, structures, attributes and operations through the organic combination of many years of experience in large-scale system development and object-oriented concepts. This method completes the further implementation of class and Class Hierarchy Identification of. Although the Coad method does not introduce classes and Class Hierarchy In fact, the characteristics of class and class hierarchy have been reflected in the concepts of classification structure, attribute, operation, message association, etc. [2]
3. OMT method
The OMT method was proposed by James Rumbaugh and other five people in 1991. Its classic work is "object-oriented modeling and design".
This method is a new object-oriented development method. The basis of development work is to model real world objects, and then use analysis models around these objects to carry out language independent design. Object oriented modeling and design promote the understanding of requirements, which is conducive to clearer development and easier maintenance software system This method is used in most application fields software development It provides a practical and efficient guarantee, and strives to find a practical method to solve the problem. [2]
4、 UML (Unified Modeling Language)
The field of software engineering has made unprecedented progress from 1995 to 1997. Its achievements exceed the total achievements of the field of software engineering in the past 15 years. One of the most important achievements is unified modeling language (UML). UML will be Object oriented technology Dominant in the field Standard Modeling Language [2]
UML not only unifies the representation methods of Booch method, OMT method and OOSE method, but also further develops them and finally unifies them to be accepted by the public Standard Modeling Language UML is well defined, easy to express, powerful and universally applicable Modeling language It integrates software engineering New ideas, new methods and new technologies in the field. Its scope is not limited to supporting object-oriented analysis and design, but also supporting requirement analysis The whole process of software development started. [2]

Object-oriented programming

Announce
edit

basic thought

The main idea of Object Oriented Programming (OOP) is to decompose the various transactions that constitute the problem into various objects. The purpose of establishing objects is not to complete a step, but to describe the behavior of a thing in the whole step of solving the problem. The concepts in object-oriented programming mainly include: object, class, data abstraction, inheritance, dynamic binding, data encapsulation, polymorphism, and message passing. Through these concepts, object-oriented thinking has been embodied concretely. [1]
The basic point of traditional structural design method is process oriented, and the system is decomposed into several processes. The object-oriented method adopts the view of constructing models. In the process of system development, the common goal of each step is to build a model of the problem domain. In object-oriented design, the initial element is the object, and then the objects with common characteristics are summarized into classes, the hierarchical relationship between classes is organized, and the class library is constructed. When applying, select the corresponding class in the class library. [2]
Object oriented programming simulates human thinking as much as possible. In this way, the developed software can be more consistent with human cognition, and people can use it more easily. And the problems in real life can be effectively solved through application software. Object oriented programming makes the problem space describing the problem and the solution space of the problem combined together, and as consistent as possible. It can transform abstract problems in the objective world into concrete problem objects. [3]
The object-oriented thinking is more consistent with the way people understand and think about problems. The concept and application of object-oriented has gone beyond software development and programming, and has expanded to many fields. One branch of application is object-oriented knowledge representation. This representation abstracts the entities that constitute the objective world into data and operations on data, and uses classes to encapsulate data and operations on data into an indivisible and interdependent whole. Object oriented knowledge is closer to the objective world, and the representation scheme is more natural and easy to understand. The good modularity of object-oriented technology and the good maintainability, extensibility and reusability of object-oriented system meet the needs of people to organize and manage knowledge base. [4]

realization

(1) Programming language
use Object oriented method The basic purpose and main advantage of software development is to improve software productivity Therefore, the object-oriented language that can best and accurately express the semantics of the problem domain should be preferred. [2]
In Select programing language Other factors that should be considered include: training operations for users to learn object-oriented analysis, design and coding technology; The technical support that can be provided during the use of this object-oriented language; The development tools and platforms that can be provided for developers to use, the requirements for machine performance and memory, and the ease of integrating existing software. [2]
2. Programming style
⑴ Improve reusability.
⑵ Improve expandability.
⑶ Improvement Robustness [2]
(2) Class implementation
In the development process, class implementation is the core issue. In a system written in an object-oriented style, all data is encapsulated in class instances. The whole program is encapsulated in a higher-level class. In an object-oriented system using existing components, software can be implemented with only a small amount of time and effort. As long as you add instances of classes, develop a small number of new classes, and implement the operation of communication between various objects, you can build the required software. [2]
One solution is to first develop a relatively small and simple class as the basis for developing a relatively large and complex class.
(1) Reuse "as is".
⑵ Evolutionary reuse.
A class that can fully meet the required characteristics may not exist. [2]
⑶ "Waste" development.
Develop a new class without any reuse.
⑷ Error handling.
A class should be autonomous and responsible for locating and reporting errors. [2]
(3) Implementation of application system
The implementation of an application system is after all classes have been implemented. Implementing a system is a simpler and shorter process than using a procedural approach. Some instances will be used during initialization of other classes. The rest must be explicitly described with some kind of main procedure, or as part of the representation of the top-level class of the system. [2]
There is a main() function in C++and C, which can be used to describe the instances of those classes that constitute the main objects of the system.
(4) Object oriented testing
⑴ Algorithm layer.
(2) Class layer.
Test the interaction between all methods and properties encapsulated in the same class.
⑶ Formwork layer.
Test the interaction between a set of classes that work together.
⑷ System layer.
Assemble each subsystem into a complete oriented object software system , test simultaneously during assembly. [2]

Object-oriented classification

Announce
edit
The extraction of object-oriented methods is similar Decision tree From simple to complex, first remove other irrelevant information, and then through multiple screening to find useful ground feature categories, to achieve layered extraction of ground features. After multi-scale segmentation, it is necessary to divide a single object after segmentation, and select appropriate parameters or rules to distinguish the object from other objects to achieve the classification of various figures. [5]
The object-oriented classification method for extracting information has more advantages than the traditional classification method. The former fully considers various types of features of high-resolution images, including spatial features such as spectrum, shape and texture. The latter is to select training samples, and the software automatically establishes a discriminant function to judge other unrecognized samples. In contrast, the object-oriented method is more targeted in this respect, with more clear objectives. It is aimed at the segmented patches, so the classification results are more accurate. However, how to apply the object-oriented method well requires researchers to master its relevant software operation and mechanism, such as the setting of segmentation scale and the selection of feature space. [5]
In the process of using object-oriented classification, it is vulnerable to human subjective factors. For example, the construction of feature space and feature system also involves human-computer interaction correction in the post-processing of classification. Therefore, although the object-oriented method is intelligent, if the manual participation can be minimized, the intelligent level of the method may be improved. [5]

Confusable concept

Announce
edit

Object Oriented and Object Based

The three characteristics of object-oriented (encapsulation, inheritance, polymorphism) are indispensable. Generally, "object-based" uses objects, but cannot use existing object templates to generate new object types and then generate new objects, that is, "object-based" has no inheritance characteristics. However, "polymorphism" represents a subclass object instance of the parent type. Without the concept of inheritance, there is no way to talk about "polymorphism". Many popular technologies are based on objects. They use some encapsulated objects, call object methods, and set object properties. But they do not allow programmers to derive new object types. They can only use methods and properties of existing objects. So when you judge whether a new technology is object-oriented, you can usually use the latter two features to judge. Both "object-oriented" and "object-based" have implemented the concept of "encapsulation", but object-oriented has implemented "inheritance and polymorphism", while "object-based" has not implemented these, which is really awkward. [2]

"Process oriented" and "Object oriented"

Process oriented is to analyze the steps needed to solve problems, and then use functions to implement these steps step by step. When using, it is OK to call them one by one; Object oriented is to decompose a problem transaction into various objects. The purpose of creating objects is not to complete a step, but to describe the behavior of a thing in the whole problem solving step. [2]
You can use examples in life to understand process oriented and object-oriented, such as gobang. The process oriented design idea is the first step to analyze the problem: 1. Start the game, 2. Blackspot goes first, 3. Draw the picture, 4. Judge the win or lose, 5. It's the turn of white, 6. Draw the surface, 7. Judge the win or lose, 8. Return to step 2, 9. Output the final result. Use different methods to implement each step above. [2]
If it is the object-oriented design idea to solve the problem. Object oriented design is to solve problems from another way of thinking. The whole Gobang can be divided into 1. Black and white sides, whose behaviors are identical. 2. The chessboard system is responsible for drawing the picture. 3. The rule system is responsible for judging violations, wins and losses. The first type of object (player object) is responsible for receiving user input and informing the second type of object (chessboard object) of changes in the layout of chess pieces. The chessboard object is responsible for displaying such changes on the screen after receiving the changes of chess pieces, and at the same time, the third type of object (rule system) is used to judge the chess game. [2]
It is obvious that object-oriented is to divide problems by function, not by steps. It is also the drawing of chess games. Such behavior is scattered in multiple steps in process oriented design, and different drawing versions are likely to appear, because usually designers will consider the actual situation and make various simplifications. In object-oriented design, drawings can only appear in chessboard objects, thus ensuring the unity of drawings. [2]