An object-oriented approach is defined and characterized by

What is the object-oriented approach and what are its characteristics?

The object-oriented approach puts data and methods of manipulating data together as an interdependent, inseparable whole – an object. Commonalities are abstracted for objects of the same type to form classes. Most of the data in a class can only be processed using the methods of the class. Classes relate to the outside world through a simple external interface, and objects communicate with each other through messages.

What is object-oriented and what are its characteristics?

The use of object orientation is very important in programming languages and it took many years to acquire this technology in the PHP language. The advent of object orientation was a great reform in system development and programming languages began to move away from applications back to data. Object orientation shifted the focus of the programming process to the real entities being modeled, bringing the application closer to the real world. The following computer training for the main object-oriented.

A. What is object-oriented

It’s like you’re the president of a company and you’re doing the work of assembling a set of computers. That is to say, object-oriented is the implementation of the abstraction, or by employees. In detail, the president does not need to think about this. IT training believes that the benefits are obvious, high-level management of the company can be coordinated without managing high-level company, only a few concrete implementation of the staff will be in trouble.

Two, object-oriented features

1, encapsulation

Hide the object’s attributes and implementation details, only to the external public interface to control the program to read and modify the attributes of the level of access; will be the combination of abstract data and behavior (or function) into an organic whole, i.e., the data and the operation of the data of the source code organically combined to form a “class”, where data and functions are members of the class.

2. Inheritance

Inheritance is the mechanism of deriving one or more classes from a base class. A class that inherits from another class is called a subclass of that class. This relationship is often compared to a father and a child. The child class inherits the attributes of the parent class. These properties consist of attributes and methods. Subclasses can add new functions other than those of the parent class, so they are also called an “extension” of the parent class.

3. Polymorphism

Polymorphism means that OOP can redefine the nature or behavior of a class according to the context in which it is used, or that many different implementations of an interface are polymorphic. Beijing North Youth Bird suggests that if different subobjects are regarded as parent classes, you can shield the differences between different subobjects, write generic code, perform generic programming, and adapt to changes in demand.

What are the characteristics of object-oriented concepts

1. Programming model

All computers consist of two elements: code and data. To be precise, some programs are written around “what is happening” and others are written around “who is being affected”.

The first type of programming is called the “process-oriented model”, in which programs are written as a series of linear steps (code), understood as code that acts on data. This is the case with procedural languages such as C.

The second type of programming is called the “object-oriented model”, according to which programs are written around the program’s data (object) and the object and strictly defined interfaces to organize the program, which is characterized by the data to control access to the code. By transferring control to the data, the object-oriented model has the organizational benefits of abstraction, encapsulation, inheritance, and polymorphism.

2. Abstraction

The fundamental element of object-oriented programming is abstraction, through which programmers manage complexity.

An effective way to manage abstraction is to use hierarchical categorization features, which allow the user to decompose a complex system into more manageable chunks based on their physical meaning. For example, a computer system is a single object. Within a computer system are several subsystems: monitor, keyboard, hard drive, DVD-ROM, floppy disk, audio, etc. Each of these subsystems consists of specialized components. The key is the need to use hierarchical abstraction to manage the complexity of a computer system (or any other complex system).

The essence of object-oriented programming: these abstract objects can be thought of as concrete entities that respond to messages that tell us what to do.

/*(My understanding)

*The computer is an entity, I have to type in the characters and the monitor displays them, then

*The computer (object). Input (keyboard properties). Display (display methods)

*Use hierarchical references and operations. Never mind what the computer does internally.

*As long as there is a computer object, it responds to my actions, and when I hit the keyboard,

* the computer object sends the message to the screen, which displays it.


The computer object contains all of its properties, and operations, which is one of the three principles of object-oriented programming: encapsulation.

3. Encapsulation

Encapsulation is a mechanism for binding code and the data it manipulates together so that the two are protected from external interference and misuse. Encapsulation can be understood as a wrapper used to protect the code and data from arbitrary access by other code defined outside the wrapper. Access to code and data inside the wrapper is controlled through a well-defined interface. The advantage of wrapping code is that everyone knows how to access the code and can use it without having to think about implementation details and without worrying about unforeseen side effects.

In JAVA, the most basic unit of encapsulation is the class, a class defines the behavior (data and code) that will be shared by a group of objects. A class of each object contains the structure and behavior of its definition , these objects are like a mold cast out . That’s why an object is also called an instance of a class.

When defining a class, you need to specify the code and data that make up the class. In particular, the objects defined by the class are called member or instance variables. The code that manipulates the data is called a member method. The methods define how to use the member variables, which means that the behavior and interface of the class is defined by the methods that manipulate the instance data.

Because the purpose of a class is to encapsulate complexity, there are mechanisms within the class to hide the complexity of the implementation. So JAVA provides both private and public access modes, where the public interface of a class represents everything that an external user should know or can know. Private method data can only be accessed through the member code of the class. This ensures that nothing unwanted happens.

4. Inheritance

Inheritance is the process by which an object acquires properties from another object. It is one of the three principles of object-oriented programming and supports the concept of hierarchical classification. For example, a Persian cat is a type of cat, a cat is a type of mammal, and a mammal is a type of animal. If the concept of hierarchy is not used, each object needs to be clearly defined with all its characteristics. With hierarchical categorization, an object only needs to define the attributes that make it unique within its class, and then inherit its generic attributes from its parent class. Thus, it is the inheritance mechanism that allows an object to be a specific instance of a generic class. A deeply inherited subclass inherits all the properties of each of its ancestors in the class hierarchy.

Inheritance and encapsulation can interact. If a given class encapsulates certain attributes, any of its subclasses will contain the same attributes, plus all the attributes of each subclass. This is an important concept for object-oriented programs that grow in complexity linearly rather than geometrically. A new subclass inherits all the attributes of all its ancestors. Subclasses do not interact with other code in the system in unexpected ways.

5. Polymorphism

Polymorphism refers to the fact that a method can have only one name, but many forms, i.e., more than one method with the same name can be defined in a program, which is described by the phrase “one interface, many methods”. You can refer to a method by its parameters and type.

6. Combined use of encapsulation, inheritance, and polymorphism

In an environment consisting of encapsulation, inheritance, and polymorphism, programmers can write programs that are more robust and extensible than the procedural model. A carefully designed class hierarchy is the basis for reusing code. Encapsulation allows programmers to port programs without modifying the code of public interfaces. Polymorphism allows programmers to develop code that is simple, easy to understand, and easy to modify. For example: car

From the inheritance point of view, drivers rely on inheritance to drive different types (subclasses) of cars, whether the car is a car or truck, is a Mercedes-Benz or Fiat, the driver can find the steering wheel, handbrake, gear shifter. After some time behind the wheel, they can tell the difference between a manual and an automatic because they actually know the common superclass of the two: the transmission.

From an encapsulation standpoint, drivers always see encapsulated features. Brakes hide a lot of complexity, and their appearance is so simple that they can be operated with a foot. The implementation of the engine, handbrake, and tire size has no effect on the definition of the brake class.

From a polymorphic point of view, there is a positive and negative locking of the brakes, so that the driver can stop the car with just his foot on the brakes, and the same interface can be used to control several different implementations (positive or negative locking).

This way the individual components are converted into the object of the car. Similarly, by using object-oriented design principles, programmers can combine the components of a complex program to form a consistent, robust, and maintainable program.

What are the characteristics of object-oriented

This tutorial operating environment: windows7 system, DellG3 computer.

Object-oriented is a method of understanding and abstraction of the real world, is the product of the development of computer programming technology to a certain stage, is a is a software development methodology

Object-oriented mainly has four major characteristics

1, abstract

Ignore the things in a subject that have nothing to do with the current goal, and pay focused attention to the current goal with the aspects that are relevant. (That is, a certain type of thing in the real world, extracted, represented by program code, abstracted generally called classes or interfaces). Abstraction does not intend to understand the whole problem, but to select a part of it and not use some of the details for the time being. Abstraction consists of two aspects, a data abstraction, but rather process abstraction.

Data abstraction – > represents the characteristics of a class of things in the world, that is, the properties of an object. For example, a bird has wings, feathers, etc. (attributes of a class)

Process abstraction – > represents the behavior of a class of things in the world, which is the behavior of an object. For example, a bird can fly and call (methods of a class)

2. Encapsulation

Encapsulation is one of the characteristics of object-oriented, is the main feature of the concept of objects and classes. Encapsulation is to surround the process and data, access to the data can only be through the defined interface. Such as private variables, with set, get methods to get.

Encapsulation ensures that the module has a better independence, making it easier to maintain and modify the program. Modifications to the application are limited to the interior of the class, thus minimizing the impact of application modifications.

3. Inheritance

A hierarchical model that links classes and allows and encourages class reuse, providing a way to explicitly express commonality. A new class of an object can be derived from an existing class in a process called class inheritance. The new class inherits the characteristics of the original class; the new class is called a derived class (subclass) of the original class, and the original class is called the base class (parent class) of the new class. A derived class can inherit methods and instance variables from its parent, and the class can modify or add new methods to make it more suitable for particular needs. Thus it can be said that inheritance is done to reuse the parent class code and also to prepare for polymorphism.

4. Polymorphism

Polymorphism is the practice of allowing objects of different classes to respond to the same message. Polymorphism includes parameterized polymorphism and inclusion polymorphism. Polymorphic languages have the advantage of flexibility/abstraction/behavior sharing/code sharing, which is a good solution to the problem of application functions with the same name. In a nutshell, method overriding, overloading and dynamic linking constitute polymorphism. one of the reasons why java introduced the concept of polymorphism is to compensate for the lack of functionality brought about by single inheritance of a class.

Dynamic linking – > For a method defined in the parent class, if the method is overridden in the child class, then a reference to the type of the parent class will call the method in the child class, this is dynamic linking.

Object oriented programming has many advantages:

1. Development time is short, efficient, reliable, and the programs developed are stronger. Because of the reusability of object-oriented programming, you can use a large number of mature class libraries in the application, thus shortening the development time.

2. Applications are easier to maintain, update and upgrade. Inheritance and encapsulation make the impact of application modifications more localized.

(If you need basic knowledge related to computer programming, you can refer to the Programming Learning Channel)