Design principles of Design Patterns C #

Source: Internet
Author: User

Become a senior architect first to understand the design pattern, before understanding, to understand the design principles, the original I ate this loss, a long time to someone asked me design principles, I am a dazed, not only design mode? And do not know the principle of design is like writing calligraphy, in italics is the founder, Vertical Road has vertical dew, etc., the official script has a silkworm head swallow tail and so on.

These "orders" follow the solid architecture principles. This set of object-oriented design principles, through practice summarized as

1), SRP (single Responsibility Principle): Principle of sole responsibility;

A class should take care for only one responsibility. A single class has and has only a function.

2), OCP (open Closed Principle): Open closure principle;

Extension should is preferred over modification. The extension is open, and the modification is encapsulated.

3), LSP (Liskov Substitution Principle): the Richter replacement principle;

Objects seamlessly (seamless) during runtime polymorphism (polymorphic, polymorphic). Subclasses and parent classes have the same behavior and state.

4), ISP (Interface segregation Principle): interface separation principle;

Client should not being forced to using a interface if it does not need it. Interface separation rules are designed to work with multiple specific functions

Interface to avoid the redundancy caused by the common interface.

5), DIP (Dependency inversion Principle): dependency inversion principle;

The high level modules should is depend on the low level modules but the should depend on abstraction. The container is a rule, and the object only cares about the part that it completes.

Design principles of Design Patterns C #

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.