What is an object? What is Object Oriented programming? What are the advantages of object-oriented languages?

Source: Internet
Author: User

When it comes to learning object-oriented languages, many books have such sentences-"Everything is an object." So what exactly is the object? is not all things are called objects. But the object here is not the object of our daily life, in C # We call an instance of a class an object, and the object here is not just a specific thing, it can also be a rule, a plan, or an event. In my opinion, the object is the abstract and summary of the common characteristics and behavior of things.
The following is a reference to the definition of objects on Wikipedia:

In Computer science, objects (English: Object), a Taiwanese translation object, is a memory address that has a value that may have an identifier pointing here. An object can be a variable, a data structure, or a function. is a term in object-oriented (object oriented) that represents not only a specific thing in the objective World problem Space (Namespace), but also a basic element in the solution space of the software system.
In software systems, objects have unique identifiers, objects include attributes (properties) and Methods (Methods), attributes are information that requires memory, and methods are the services that objects can provide. In object-oriented (object oriented) software, objects (object) are instances (Instance) of one Class (class).

So the so-called object-oriented programming, is a class-and-instance programming method. Such an understanding seems somewhat one-sided. Object-oriented is not simply a class-and-instance programming, not a program for everything (Everything is object). In the programming world, referring to object-oriented more refers to a design and programming ideas and development methods, the fool thought how to abstract the problem into objects and coding implementation of the process is object-oriented programming, rather than write a class implementation of an instance is object-oriented programming.
To prevent people from walking farther and further along the wrong path, the following is also the definition of Wikipedia:

Object Oriented Programming (English: object-oriented
Programming, abbreviation: OOP is a kind of program programming paradigm with object concept, and also a method of program development. It may contain data, attributes, code, and methods. Object refers to an instance of a class. It encapsulates the object as the basic unit of the program, encapsulating the program and data to improve the reusability, flexibility, and extensibility of the software, and the programs within the object can access and frequently modify the data associated with the object. In object-oriented programming, computer programs are designed to be objects related to each other [1][2].

Object-oriented programming can be regarded as a kind of thought that contains various objects which are independent and call each other in the program, which is contrary to the traditional idea: the traditional program design advocates to regard the procedure as a set of functions, or a series of instructions to the computer directly. Each object in object-oriented programming should be able to accept data, process data, and communicate data to other objects, so they can all be considered as a small "machine", or object. It has been proved that object-oriented programming has extended the flexibility and maintainability of programs and is widely used in large project design. In addition, supporters claim that object-oriented programming is easier to learn than previous practices because it allows people to design and maintain programs more easily, making them easier to analyze, design, and understand. Opponents have denied this in some areas.

When we refer to object-oriented, it means not just a programming method. It is more in the sense of a program development approach. In this regard, we must learn more about object-oriented system analysis and object-oriented design (object
Oriented design, referred to as ood) knowledge. Many popular programming languages are object-oriented, and their style is to create instances through objects.

Important object-oriented programming languages include common
Lisp, Python, C + +, objective-c, Smalltalk, Delphi, Java, Swift, C #, Perl, Ruby and
PHP and so on.

Languages that support some or most object-oriented attributes (class and instance, encapsulation, inheritance, polymorphism) can be called object-based or object-oriented languages. Java and C # are the two most popular object-oriented languages at the moment.
From the beginning to the process (Procedure oriented, is a process-centric programming idea), after the object-oriented gradually become mainstream, object-oriented language began to occupy the stage of history. The first object-oriented program is not written in object-oriented language, the use of process-oriented language can also write object-oriented programs, but to achieve more twists and turns, so later there will be an endless stream of object-oriented language. Compared to process-oriented and functional programming. Object-oriented language can be categorized as: Object-based programming language, object-oriented programming language.

Object-oriented programming has the following advantages:

Easy to maintain
The use of object-oriented design of the structure, high readability, because of the existence of inheritance, even if the need to change, then maintenance is only in the local module, so maintenance is very convenient and low-cost.

Easy to expand
By inheriting, we can drastically reduce the extra code and extend the use of existing code;
We can build our programs on standard modules (where the so-called "standards" refer to the agreements between programmers) without having to start all over again. This can reduce software development time and increase productivity;

of modular
Encapsulates an access level that defines the properties and methods of an object, exposes a secure interface with different access modifiers, and prevents internal data from being modified in an unsafe manner. This allows the program to have a higher degree of modularity, facilitate later maintenance and modification.
At the same time, object-oriented language allows multiple instances of an object to exist simultaneously, and does not interfere with each other;

Easy modeling
Although object in object-oriented language is not the same concept as object in real life, many times, it can be modeled with the concept abstraction of real-life objects, which greatly facilitates the modeling process. (But modeling directly using objects in reality can sometimes backfire).

The above is the author of some of the object-oriented understanding, welcome to Exchange.

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.