Object-Oriented Software Design Principles

Source: Internet
Author: User

N single responsibility principle (SRP)

For a class, there should be only one reason for its change.

N open-closed principle (OCP)

Software entities should be extensible, but cannot be modified.

N liskov replacement principle (LSP)

Child types must be able to replace their base types.

N Dependency inversion principle (DIP)

Abstraction should not depend on details. Details should depend on abstraction.

N interface isolation principle (ISP)

Customers should not be forced to rely on methods they do not need. An interface belongs to a customer and does not belong to its class hierarchy.

N reuse release Equivalence Principle (REP)

The granularity of reuse is the publishing granularity.

N principle of joint closure (CCP)

All classes in the package should be closed for changes to the same class nature. If a change affects a package, it will affect all classes in the package, without affecting other packages.

N principle of joint reuse (CRP)

All classes in a package should be reused together. If a class in the package is reused, all classes in the package must be reused.

N no-ring dependency principle (ADP)

The package dependency graph does not allow loops.

N stable dependency principle (SDP)

Dependency in a stable direction.

N stable abstraction principle (SAP)

The abstraction level of the package should be consistent with its stability.

The concept of the above package is: the package can be used as a container to accommodate a group of classes. By organizing classes into packages, we can understand the design at a higher level of abstraction, we can also manage software development and release through packages. The purpose is to divide the classes in the application based on some principles, and then allocate those classes to the package.

 

Related Article

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.