Why is object-oriented programming generated [20160307]

Source: Internet
Author: User

Object-oriented three main ideas: encapsulation, inheritance, polymorphism.

A long time ago, the world of software development was still a muddle, regardless of the development of any software is faced with the complexity of the problem. Then structured programming came into being.

The basic idea of structured programming is: to control the process in an orderly manner, that is, to limit the order of execution of the program to three kinds of sequence, branch and loop; The common processing is attributed to the routine (function).

Although the structure solves the complicated problem of program control flow, the program includes not only the controlling structure but also the data to be processed. As processing data increases, the complexity of the program increases. At this point, object-oriented programming comes!

"The complexity of managing content and processing data Objects separately" is the problem that, in order to get the right results, the consistency of processing and data must be maintained , which is very difficult in structured programming, and the solution to this problem is data abstraction.

Data abstraction is the combination of data and processing methods . This is the beginning of the term "object". Object-oriented programming is therefore named.

Then, from the abstract principle, when multiple identical things appear, they should be grouped together, that is, the dry principle (Don ' t Repeat yourself), which leads to the concept of class.

Proper processing based on the data type (invoking the appropriate method ) should have been a tool that the programming language should have done. This is the derivation of polymorphism.

For inheritance, most of the view is that "inheritance is a way of natural evolution along with the structure and abstraction of programs." Structure and abstraction means that the common part is extracted to generate a bottom-up approach to the parent class . (If inheritance is born like this, then the multiple inheritance of several parent classes will become mainstream initially, and the Simula language that originally introduced the inheritance only provides a single inheritance.) As that the original purpose of inheritance is actually gradual refinement )

Why is object-oriented programming generated [20160307]

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.