You really should understand object-oriented

Source: Internet
Author: User
1.-object-oriented and Object-based

Object-based means that objects can be encapsulated, and States and operations can be encapsulated for use, but objects cannot be extended through polymorphism.

Object-oriented is "Object-based" with the added polymorphism function ".

2. object-oriented and process-oriented respectively.

The most essential difference is that the focus is different. Object-oriented attention focuses on objects in activities and processes in process-oriented attention activities. Basically, the two ideas will coexist and penetrate each other.

3. Basic object-oriented design ideas

A. Manage yourself

B. assign it to others if you manage too much.

C. do not infringe on others' territory

D. Do not rely on specific objects and do not guess the implementation mechanism of the other party

Advanced topics and common object-oriented concepts: 1. original objective-oriented Teaching

It considers that an object exists because it exists objectively.

Such as cats, dogs, airplanes, etc.

However, I think objects do not exist objectively, but in your subjective design. for example, if a classmate inherits from humans or a class is composed of students, it can exist or do not exist. It is because of your subjective design that there is no such thing as an appropriate one, the inevitability of existence.

You can design a flying cat, which is bigger than a dog, as long as you like it.

The original teaching purpose is to build an easy-to-understand concept.

2. design patterns are harmful

The design pattern is a kind of move, very gorgeous move. move should be subject to the design concept, instead of transforming your design into these moves.

3. Why is object-oriented design feasible?

The most important design capabilities of object-oriented systems are as follows:

A.Change setPolymorphism is the most powerful tool. Therefore, the object should be associated with the polymorphism mode instead of writing the code to death.

B. encapsulation to reduce unwanted exposure.Reduce dependencies, The more associations, the higher the chance of modification, the more difficult it will be for future changes.

C. object orientation does not prevent modification. On the contrary, object orientation is more welcome and easier to modify. It is this powerful evolutionary capability that allows programs to adapt to evolving needs. of course, it should be modified in an appropriate way.

D. modify the program using the replacement method: first create a new object, and then replace the original object of the system, instead of directly modifying the original object. there are two reasons: 1. Your old objects are valid for the old system. II. your new object is immature.

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.