Differences between object-oriented and Object-based

Source: Internet
Author: User

The difference between object-oriented and Object-based architectures is polymorphism, which is irrelevant to inheritance.
Objects only support the functions of abstract data types. Inheritance only reflects the is-a relationship. It is also an abstract data type, but only establishes a hierarchical system. But what is object-oriented? It means that different behaviors can be automatically completed based on the actual type of the object, but only through consistent call form. In other words, that is, the polymorphism implemented by virtual functions. The above point of view has been recognized in the OO design, and another Implementation Method of polymorphism is generic.


There are two different concepts: "Object-Oriented" and "Object-based. The three characteristics of object-oriented (encapsulation, inheritance, and polymorphism) are indispensable. objects are usually used based on objects, but existing Object Templates cannot be used to generate new object types, then, a new object is generated. That is to say, "Object-based" does not have the inheritance feature, and "polymorphism" is a subclass object instance of the parent class, without the concept of inheritance, we cannot talk about "polymorphism ". Nowadays, many popular technologies are based on objects. They use encapsulated objects, call object methods, and set object attributes. However, they cannot allow programmers to derive new object types. They can only use methods and attributes of existing objects. So when you determine whether a new technology is object-oriented, you can usually use the last two features to determine. Both "Object-Oriented" and "Object-based" implement the concept of "encapsulation", but object-oriented implements "inheritance and polymorphism", while "Object-based" does not, indeed, it is very good.

People engaged in object-oriented programming can be divided into class library creators and class library users by division of labor ". Not all people who use the class library have the idea of object-oriented. They usually know how to inherit and derive new objects to use the class library. However, our thinking has not really been transferred, class Libraries are only object-oriented in form, but essentially an extension of library functions. Object-oriented is an idea. It is a method for us to consider things. It usually shows that we solve the problem according to the process, or abstract the problem into an object to solve it. In many cases, we will solve the problem through the process without knowing it, instead of abstracting the problem to be solved as an object to solve it.

Object-oriented features include encapsulation, inheritance, and polymorphism. Without encapsulation, it cannot be inherited. Without inheritance, there is no Runtime polymorphism. Object-based theory is not a separate theory, but the initial stage of object-oriented, that is, only encapsulation. You can only put attributes and methods into the class and instantiate object calls. To learn object-oriented, you must start with basic knowledge and learn to define and inherit classes and interfaces. Then we need to thoroughly study the real things and abstract the nouns in the real things or demand documents to generate classes or attributes. If it is a subject, most of them need to generate methods based on the description of the entire sentence to define the class structure. Abstract is called because other things that are not required by the system must be ignored when defining class members. Slowly, you will find that the original program is constantly adding, deleting, and restructuring code.

From: http://blog.sina.com.cn/s/blog_4ca200e20100hstp.html

Differences between object-oriented and Object-based

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.