Object-oriented design idea: The basic principle of object-oriented design

Source: Internet
Author: User

The basic principle of object-oriented design http://www.cnblogs.com/malaikuangren/archive/2012/03/22/2411315.html

Interface:
Understand:
An agreement between the parties.

Benefits:
interface and implementation separation;
Easy to expand;

Object-Oriented design principles:
Single principle of responsibility:
The function of a class is to be single, only to do things related to it. In the design process of the class to be in accordance with the responsibility of the design, each other to stay orthogonal, non-interference.

The principle of the Richter substitution:
Facilitates the interchange of subclasses and parent classes.

Dependency Inversion principle:
Programming for the interface, not for the implementation of programming;
The upper modules should not be dependent on the underlying modules, they should all be dependent on abstraction. The details depend on abstraction.

Interface Isolation principle:
Do not provide a large interface, the function as single as possible. Interface Mandarin is bloated, affecting readability and efficiency. (a single duty principle is similar)

Dimitri Principle:
Reduce the association between objects.

Open Closure principle:
is open to expansion;
The modification is closed.

Object-oriented design idea: The basic principle of object-oriented design

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.