Object-oriented gossip (1) -- What is object

Source: Internet
Author: User

If you want to sell a cat to a computer expert, never say how intelligent and cute it is, but say it is an object-oriented cat. This is a programmer's concern for programmers.

Object-oriented penetration into various fields of software, since the silver bullet cannot be found, this copper bullet has become our best weapon against the wolf.

In this world, have you ever wondered what object orientation is?

If you habitually say: inheritance, encapsulation, and polymorphism, please read this article. It will show you a real OO

 

Before I mention object-oriented, I should first understand what objects are. As mentioned in Grandy Booch, object is a simple concept. After about one year old, people will develop an object concept. From the perspective of human cognition, objects should be one of the following

  • Something that can be touched or visible
  • Something that can be understood rationally
  • Something that can be imagined or applied

In English, Object is a widely used word. before the emergence of the program language, I want to use the most appropriate word in Chinese for translation, it should be "things" rather than "objects". Of course it's too colloquial. Grandy Booch also mentioned that objects in real life are not the only objects of interest in software development. Other important objects are the product of the design process. The final summary is: the object has the status, behavior, and identity.

Objects are very important in terms of status, behavior, and identifier. This is a very precise summary of the concept of simple objects by the object-oriented master Grandy Booch.

Ian Graham describes object-oriented as follows: some authors have already emphasized the differences between object-oriented programming and object-oriented programming. MacLenna (1982) states that values (such as numbers 17) are applied and read-only, and they are always abstract. Objects (such as instances) exist within a certain range and can be created, revoked, shared, and updated. A value is transparent, and the same value will be used for everything that references it.

From this section, we can see that what is opposite to "object" is not "process", but "value ". The most significant difference between a value and an object is the three points in Booch's summary: Status, behavior, and identifier. For example, 3 is a value and apple is an object. Apple is in a state and may be rotten or not familiar with it. Apple also has behavior, which can be peeled, bitten, or rotten. the logo is guaranteed, apple is the only one, and you cannot find any other Apple in the world, making it "the same Apple" as this apple ". This is not the case for values. 3 is 3 and there is no state. 3 cannot be changed. You can only get a new value 4 from 3, but it cannot change any 3 to 4. values do not need to be identified. All 3 in the world are the same and there is no difference.

With this simple understanding, I want to analyze the design of the C ++ object model: store the state of an object in a continuous segment of memory, in this way, their addresses can be used as identifiers to classify objects and reflect their behavior in the form of member functions.

(To be continued)

 

 

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.