Object oriented technology

Scientific terminology
open 2 entries with the same name
Collection
zero Useful+1
zero
object-oriented Object Oriented Technology
object-oriented Technical emphasis on software development Facing the objective world or things in the problem domain in the process, the thinking method commonly used by human beings in the process of understanding the objective world is adopted to describe the relevant things in the objective world intuitively and naturally. object-oriented The basic characteristics of technology mainly include abstraction, encapsulation, inheritance and polymorphism.
Chinese name
Object oriented technology
Foreign name
Object-Oriented Technology
Type
science
Nature
Abstraction, encapsulation, inheritance and polymorphism

Analytical method

Announce
edit
The object-oriented analysis method is to use object-oriented information modeling concepts, such as entity, relationship, attribute, etc., and use encapsulation, inheritance, polymorphism and other mechanisms to construct a simulation of real systems. [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. [1]

features

Announce
edit

Abstraction

To sum up and classify many things is a way of thinking that people often use when they understand the objective world“ Birds of a feather flock together ”It means classification. The principle of classification is abstraction. Abstract is to ignore the nonessential features irrelevant to the current goal in things and pay more attention to the essential features related to the current goal. So as to find out the commonness of things, and classify the things with commonness into a class, and get an abstract concept. For example, in the process of designing a student performance management system, when investigating the object of student Zhang Hua, we only care about his class, student number, performance, etc., but ignore his height, weight, and other information. Therefore, abstraction is an abstract and general description of things, realizing the transformation from the objective world to the computer world. It is a difficult process to abstract objective things into objects and classes object-oriented The first step of the method. For example, the process of abstracting students into objects and classes. [1]

Encapsulation

encapsulation (Encapsulation) is to combine the attributes and behaviors of objects into an independent unit, and hide the internal details of objects as much as possible. The student class in Figure 1-1 also reflects encapsulation. Encapsulation has two meanings: one is to combine all attributes and behaviors of an object to form an indivisible independent unit. The property values of an object (except public property values) can only be read and modified by the behavior of the object; The second is to conceal the internal details of the object as much as possible to form a barrier to the outside. The connection with the outside can only be realized through the external interface. [1]
Encapsulation is to restrict that only objects of a specific class can access members of this specific class, and they usually use interfaces to realize the incoming and outgoing of messages. For example, the interface can ensure that the characteristics of puppies can only be assigned to dogs. Generally speaking, members can be divided into three types according to their access permissions: public members, private members, and protected members. Some languages go further: Java can restrict access to different classes within the same package; C # and VB NET reserves the keywords prepared for class member aggregation: internal (C #) and Friend (VB.NET); Eiffel allows users to specify which class can access all members. [1]
Encapsulated Information concealment Functions reflect the relative independence of things. You can only care about the interfaces it provides externally, that is, what it can do, without paying attention to its internal details, that is, how to provide these services. For example, a piece sealed with ceramic Integrated circuit chip Its internal circuit is invisible, and users do not care about its internal structure, but only about the chip Pin The number of pins, the electrical parameters of the pins and the functions provided by the pins. With these pins, users can connect different chips and assemble modules with certain functions. [1]
The result of encapsulation makes the external part of the object unable to access the internal properties of the object at will, thus effectively avoiding the impact of external errors on it, and greatly reducing the difficulty of error checking and troubleshooting. On the other hand, when an object is modified internally, because it only provides external services through a small number of external interfaces, it also reduces the impact of internal modifications on the external. At the same time, if we blindly emphasize encapsulation, no external direct access is allowed to any attribute of the object, and many meaningless behaviors are added, which are only responsible for reading or writing. This is programming The work increases the burden, increases the running cost, and makes the program appear bloated. In order to avoid this, objects should be made visible to varying degrees in the specific implementation of language, and then conform to the specific situation of the objective world. [1]
The encapsulation mechanism separates the user of the object from the designer. The user does not need to know the details of the implementation of the object's behavior, but only needs to use the external interface provided by the designer to let the object do it. The result of encapsulation actually conceals complexity and provides code reusability, thus reducing software development The difficulty of. [1]

Inheritance

Objective things have both commonalities and characteristics. If we only consider the commonness of things without considering the characteristics of things, we cannot reflect the hierarchical relationship between things in the objective world, and cannot completely and correctly describe the objective world abstractly. The principle of abstraction is to discard the characteristics of objects and extract their commonalities, so as to obtain a class suitable for an object set. On the basis of this class, if the characteristics of objects abandoned in the abstraction process are considered, a new class can be formed. This class has all the characteristics of the previous class, is a subset of the previous class, and forms a hierarchy, namely inheritance structure. [1]
inherit (Inheritance) is a kind of hierarchical model Inheritance means that objects of special classes have the properties and behaviors of their general classes. Inheritance means "automatically owning", that is, a special class does not need to redefine the properties and behaviors that have been defined in the general class, but it automatically and implicitly owns the properties and behaviors of its general class. Inheritance allows and encourages the reuse of classes, and provides a way to clearly express commonalities. A special class has its own newly defined properties and behaviors as well as inherited properties and behaviors. Although the inherited properties and behaviors are implicit, they are the properties and behaviors of this class, both conceptually and practically. When this special class is inherited by its lower level special class, its inherited and self defined properties and behaviors are inherited by the lower level special class. Therefore, Inheritance is transitive , reflecting the relationship between special and general in nature. [1]
In the process of software development, inheritance realizes the reusability and independence of software modules, shortens the development cycle, improves the efficiency of software development, and makes software easy to maintain and modify. This is because to modify or add a property or behavior, you only need to make changes in the corresponding class, and all classes derived from it automatically and implicitly make corresponding changes. [1]
It can be seen that inheritance is a direct reflection of the objective world. Through class inheritance, we can achieve in-depth abstract description of problems and reflect the development process of human understanding of problems. [1]
When a class inherits from multiple parent classes, we call it "multiple inheritance". For example, a dog is both a Chihuahua dog and a shepherd dog (although it is not logical in fact). Multiple inheritance is not always supported because it is difficult to understand and use. [1]

Polymorphism

Object oriented design It draws on the polymorphism of the objective world, which is reflected in the fact that different objects have different behaviors when they receive the same message. For example, a behavior "drawing" is defined in the general class "geometry", but it is not sure what shape to draw when executing. Special category“ ellipse ”Both "polygon" and "polygon" inherit the drawing behavior of geometry class, but their functions are different. One is to draw an ellipse, the other is to draw a polygon. After the message of such a drawing is sent, ellipse After receiving this message, objects such as,, polygons, etc. execute different drawing functions. As shown in Figure 1-3, this is the manifestation of polymorphism. [1]
Specifically, Polymorphism (Polymerism) means that the same function name in a class corresponds to multiple different functions with similar functions, and these functions with the same name can be called in the same way. [1]
The combination of inheritance and polymorphism can generate a series of similar but unique objects. Because of inheritance, these objects share many similar characteristics; Due to polymorphism, different objects can have a unique representation for the same message, realizing the characteristic design. [1]
object-oriented Technology enables software development to go beyond procedural programming to simplification Application development The world of reusable programming. Unlike the old programming method, when the volume of the program grows, the program maintenance and debugging will not become more complex. Object technology works at two levels:
At the data level, object technology can integrate many different types of information in an organization. The past information is no longer compatible. [1]
At the program development level, object technology provides modular program construction. At this time, programmers develop on the basis of existing objects. Objects can be reused by other objects to take advantage of their process, thus eliminating the need to rewrite these codes every time they are needed again. [1]
Since there is no need to change or decompose the whole system, it is easy to redesign or expand the system. In fact, these modules are abandoned or modified, and new modules are added to provide enhanced functions. [1]
An object is a complete data grouping, which includes the function of processing data. In a object-oriented The number of objects is countless. They may include a database record, a file, a physical resource, or even a user (it is the user's login account). To enable developers to use object-oriented programming Language work, object is a self satisfied module, which contains data, data structure, and data processing functions. [1]
An object can be any of the following:
In a object-oriented The code that implements a process in the operating system, such as verifying security permissions.
programmer And developers for assembler Predefined code modules for.
From an application data block , such as a drawing program Spreadsheet Or multimedia tools.
Objects in a database, such as inventory entries or customers. [1]
In a object-oriented In the database of, objects can represent the actual entities in the tracked business, such as products, inventory, customers and manufacturers. Accordingly, in the object-oriented In the operating system of compound document Entity of data block In an object-oriented environment, first define basic objects, and then build systems around these objects. [1]
There are many potential objects, and they can Naturalization To hierarchical classes that define objects of different types. A parent class can pass properties to a child class. Let's consider a class "people", which has two subclasses "male" and "female". These subclasses can also have their own subclasses, as shown in Figure O-3. Each subclass has comprehensive characteristics inherited from its father, as well as its own unique characteristics. In addition, some inherited features will be blocked because they are not suitable for subclasses. [1]
How does this relate to computers? Remember, we're talking about storage in many different ways data type , and access to many different types of application data. By classifying data in this way, we can directly include process data for extraction, display, merge and print in an object. If necessary, classify the data to simplify the construction process and the revision process. For example, a data block An object may include a process to sort the data in a specific way, which can be activated by many different applications that use the data. [1]

Object classes and object instances

Announce
edit
Object Class A class defines a set of objects. Class has behavior, which describes what an object can do and how to do it. They are programs and procedures that can operate on this object. [1]
Object Instance An object is an instance of a class, which represents a real physical "event", such as a property System database A customer or an inventory part of. Class inheritance is an important concept, which provides a way for a subclass to inherit the built-in description of its parent class. The code used in the parent class is passed down to a class (subclass) specified by the class. [1]
For example, a object-oriented The database of can have a class called "client". This class has two subclasses, called "company" and "individual". First, create an object called "client". It contains a structure and processes that process data and obtain information from outside objects. Then, company and individual objects are defined as subclasses of client. As a subclass, they inherit the structure and features of the client object, but some of these features may be masked, or some additional features can be added. For example, the company subclass can have a specific conversion, while the individua1 subclass does not. If you need a list of customers, you can request the client object to list them. However, if you want to know the customer's account balance, you need to get information from each subclass object that contains the customer balance. [1]
Objects contain data and procedures and provide information when requested. Imagine a box containing data. It has some buttons. You can press these buttons to run the data process. The method is that some processes or programs operate on objects, which can make objects act in a specific form according to the internal code and structure of objects. Similarly, you can operate on different classes of objects. There is a concept called polymorphism or heavy load (overloading)。 With polymorphism, a common set of methods can operate on a wide range of classes. However, having the same name and address may induce different things. For example, when "next" of text data causes the cursor to jump to the next work, and when Spreadsheet "Next" causes the cursor to jump to the next cell. [1]
Object talks to another object by sending a message. These messages are essentially requests from an object by pressing a "button" on the object. In a network environment, you can view the objects connected to the message bus, as shown in Figure O-4. Message passing as an object in a object-oriented It provides an effective way to communicate in distributed computing environment. Message passing is a kind of storage Forwarding mode , as used in electronic mail systems. Messages are transferred from one computer to another until they reach their destination. [1]
All these are added to the software. They are easy to maintain and improve on a continuous basis, that is, there is no need to redesign the entire system.
The object is reusable, which makes it easy to join the system when the system grows. This is because the code in the existing object is reusable for creating new objects. [1]
The object system is extensible. Developers add modules, and modules reuse built-in data structures without recompiling the operating system.
Easy to build systems because object-oriented It provides a natural way to design and implement the system.
Objects can provide a common interface so that many different applications can access data. [1]
There are also many disadvantages, including a large increase in front-end design time, reducing performance and technical immaturity. However, with the growth of the system and the continuous strength of the hardware, these disadvantages can be mitigated. These defects will also decrease in the face of the fact that object systems can provide users with data on many different types of systems across the distributed network. [1]
Objects in Distributed Environments
Object technology is considered to be the key technology to realize the future distributed system It is very vital. In this way, the complexity of the system can be simplified by implementing the model of messaging services, such as the object request broker. Objects simply request services, and other objects provide these services. Developers do not need to know more about the system on which objects will communicate. In fact, object technology provides a way for local use, future expansion to heterogeneous distributed environments, and design applications. [1]
Developments in this area include:
Common Object Request Broker for the Object Management Group (OMG) Architecture CORBA (CORBA) is a specification designed to provide a way for objects to generate and receive requests.
Microsoft's Object Linking and Embedding (OLE) provides a way for applications on a single desktop system or a network to share data.
IBM's System Object Model (SOM) and Distributed system object model (DSOM) provides a low-level object language
OpenDoc is developed by Apple, Borland, IBM, Novel1 and WordPerfect to share text, graphics and multimedia objects development environment [1]
Related items: Cario; Common Object Model; Common Object Request Broker Architecture; Compound Documents compound document Object Broker, the object broker of DEC DEC; Object Linking and Embedding; Object Management Architecture Object Management Architecture Object-Oriented Interfaces and Operating Systems object-oriented Interface and operating system; Object Request Broker; Workplace OS。 [1]

The difference between object-oriented and process oriented

Announce
edit
object-oriented Technology is a kind of programming technology based on objects and driven by events or messages. It describes the system based on data rather than function, and data is more stable than function. It encapsulates the data and the operation of the data, and treats them as a whole. It uses data abstraction and information hiding technology to abstract the whole into a new kind of data type ——Class, and consider the relationship between different classes and the reusability of classes. The higher the level of class integration, the more suitable for large-scale application development. on the other hand, Object-oriented program The control flow of is triggered by the actual occurrence of various events at runtime, rather than being determined by the predetermined sequence, which is more practical. The execution of event drivers revolves around the generation and processing of messages Message loop Mechanism. In practice programming It can be done by building blocks Organizational procedures , standing on the shoulder of the "giant" to achieve their goals. Object-oriented program This design method makes the program structure clear and simple, improves the reusability of code, effectively reduces the amount of program maintenance, and improves the efficiency of software development. [1]
Structurally, Object-oriented program And Process oriented The procedure is very different. Object-oriented program It consists of two parts: the definition of class and the use of class: define each object in the main program and specify the rule of passing messages between them. All operations in the program are realized by sending messages to objects; After receiving the message, the object starts the message processing function to complete the corresponding operation. [1]
Object-oriented programming Before the (Object Oriented Programming, OOP) method appeared, the programmer used Process oriented Method development program. Process oriented The substantial dependence and formal separation of closely related and interdependent data and data operations make it difficult not only to write large programs, but also to debug and modify them. [1]