C # overview of object-oriented design patterns (1): Object-oriented Design Patterns and principles

Source: Internet
Author: User
Mode Design Mode
Mode: each mode describes a problem that occurs repeatedly around us and the core of the solution.
Design Mode: The design mode describes the general solutions for a certain type of common problems in the software design process.

What is an object:
In terms of concept, an object is an abstraction with certain responsibilities,
In terms of specifications, an object is a series of public interfaces that can be used by other objects.
In terms of language implementation, objects are encapsulatedCodeAnd data.

Design principles
1. Programming for interfaces, rather than implementing programming.
2. Object combination is preferred, rather than class inheritance.
3. encapsulation changes.
4. Use the refactoring Mode
More specific principles:
Single Responsibility Principle: A class should have only one reason for its change.
Open and closed principle: class modules should be extended, but cannot be modified.
Replacement Principle: The subclass must be able to replace its base class.
Dependency inversion principle: High-level modules should not depend on underlying modules, both of which should depend on abstraction. abstraction should not depend on implementation details, and implementation details must depend on abstraction.
Interface isolation principle: Customers should not be forcedProgramDependent on methods they do not need.

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.