Why is object-oriented methods conducive to software reuse?

Source: Internet
Author: User

Today, I suddenly thought that I should write something!
I think it should be the following:

Objects and classes: the object class is used as the basic unit of the system and meets the main characteristics of reusable components:

Integrity: class attributes and services fully express the static and dynamic features of things.
Independence-there are clear boundaries and fewer interfaces between classes and external things.
Identifiability-class naming is consistent with the concept of things in the problem domain.
General: the object class is a ing of actual things and has a strong objectivity. When other systems encounter similar things, it is very likely to describe with the same object class.

Abstract: Abstraction means to extract common features by ignoring certain differences of things. This principle of the OO method is exactly what needs to be followed when defining reusable components. Only a certain degree of abstraction can a software component be used in multiple systems with different details.

Encapsulation: combines object attributes with services into a complete entity, shields internal details of objects, and retains limited interfaces externally. Therefore, it makes the object class have integrity, independence, and other reusable properties.

Inheritance and general-Special Structure: represents different levels of abstraction. Classes in the structure are applicable to different reuse scopes. The lower-layer classes contain more information, and the higher-level classes can be reused in a wider range. Based on this principle, some common components that can be reused by other systems can be created in system development. Inheritance is also an effective way to use components: You can use components as general classes and define special classes in the system by inheriting them.

Aggregation and overall-part structure: using the principle of aggregation, You can process a large software component that is difficult to reuse as a whole object composed of several parts of objects, make some of these objects become reusable components. Aggregation is also an effective way to achieve reuse. For example, Ole aggregates Reusable Component Objects by linking or embedding them into new objects and applications.

Granularity Control: applies more granular concepts than objects and classes (such as "themes", "subsystems", "class clusters", or other similar concepts ), several classes can be combined into a large software component. Therefore, reusable components obtained using the OO method are not limited to the object type, but can also be large components composed of several classes.

Polymorphism: Object polymorphism enables objects to have different semantics under different conditions of use. Using such an object class, structure, or topic as reusable components will meet the needs of more application systems and therefore be highly adaptive.

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.