The colon and his students (serial 7)--Object paradigm

Source: Internet
Author: User
Tags inheritance

Object Paradigm

The people for your, the second, June for light--"Mencius Heart"

After the short resting, the quotation mark eagerly asks: "The object-oriented paradigm should be a special kind of command, right?" ”

"Object oriented?" "The colon muttered," Let's call oo or object-style, neither unconventional nor erroneous. Before answering your question, please answer me first: What is OOP? ”

Quote Ching: "OOP is a computer programming model that uses objects as the basic element of the problem space, using interaction between objects and objects to design programs." The object is an abstraction of the entity in the real problem, which has certain properties and functions. The three basic features of OOP are encapsulation, inheritance, and polymorphism. The so-called encapsulation is--"

The colon makes a pause gesture: "The basic characteristics of OOP believe that we have long been familiar with, so according to your definition, whether OOP must be an imperative conclusion?" ”

Quote Crooked Head thought for a while, replied: "From the definition seems not to come, is not C + +, Java, C # is not imperative?" ”

The colon answers, "of course, but this does not prevent Clos from becoming an OO version of Lisp, and the Prolog has a number of extensions that incorporate OO features such as visual Prolog, Logtalk, and so on." Although OOP is developed on the basis of command, its basic idea can be generalized as: to organize logic with data as the center, to treat the system as a collection of objects interacting, and to enhance reusability by inheritance and polymorphism. This idea can also be applied to functions and logic, except that the method of an object is changed from a procedure in a command to a function in a function and an assertion in a logical form. Generally speaking, imperative, functional, and logical are parallel to each other, and OOP is orthogonal to them. ”

Question mark question: "OOP has become a trend, and only C is not oo in the 12 popular languages listed in the class, does this mean that OOP is going to eminence?" ”

"Strictly speaking, VB (except and JavaScript are not oo, just object-based (object Based)." "The colon corrects," as to whether OOP will eminence, the answer is no. First of all, pure OOP does not exist, it must be combined with other paradigms, only three of the most basic paradigm can independently, secondly, there is no panacea for all the panacea, OOP is no exception. It should be noted that the prevalence of language and paradigms is closely related to large corporate support and business promotion. Some people say that OO is actually mo (money-oriented), although there are extreme suspicion, but experienced shareholders know that the main operation of the stock is always rising faster. Of course oop can be popular, its own unique, who can say where it is good? ”

Comma answer: "OOP can improve software reusability, scalability and flexibility." ”

The colon asks: "Why is procedural programming so reusable, scalable, and flexible?" ”

Feel friendly, comma a bit hollow: "Because OOP has the characteristics of information hiding, inheritance and polymorphism." ”

The colon does not buy: "First, it is trees, trees--the common goal of all paradigms and languages to equate reusability, scalability, and flexibility with OOP." Secondly, in C language as an example, the information hiding can be implemented by the keyword static, and the inheritance can be synthesized (composition) instead; polymorphism is difficult and flexible. What's more, these are just means, not goals, as long as the design is reasonable, the C program is also reusable, scalable and flexible, performance efficiency is more superior. Even in the increasingly popular OOP today, C's share has always been at the forefront of many large and complex software such as operating systems, databases, etc. are still mainly C, which is enough to prove that it is still worthy of great use. ”

See the comma some liquciqiong, the colon tone slowed down: "Please do not misunderstand, I am not oop opponents, but also in the future to focus on the discussion of it." But I hope that we can be less scripted and parrot, a little more independent thinking and critical spirit. ”

Pause, the colon continues to ask: "What is the difference between procedural programming and OOP in the design concept?" ”

"Process-type programming philosophy is the emphasis on the process, from the top down, gradually refinement." "The quotation marks an exit to be perceived some" reads the book ", sees the colon is using the encouraging eye to look at him, this only then continues to say," The OOP is opposite, is heavy in the data, from the bottom upward, realizes gradually. ”

The colon says, "If you look at the whole process as a tree that's a long way down, the program is programmed to descend from the roots, gradually branching, until each leaf, similar to the Analytic method in mathematical proofs, that is, the Soin of the fruit-driving method; oop starts with each leaf and gradually merges it until the roots, similar to the synthetic method in mathematical proofs, That is, the positive push method of the Sogo. ”

Full STOP: "If you think of the root as the main function, the closer you are to the root, the closer you are to the user's needs." If programmed, because of the reverse method, the tree trunk changes can easily lead to changes in the branch, so once the user needs change, may be spread from the roots to branches and even leaves, maintenance is not easy. On the contrary, OOP is designed from the leaves, which is more remote, more abstract and less affected, so it is easier to maintain and reuse. ”

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: 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.