OO设计原则

开闭原则(open/close principle, OCP): Open on extensibility , close on modification. We should use interface to encapsulation, use abstract mechanism, and use polymorphism.

Liskov替换原则(Liskov Substitution Principle, LSP),

依赖倒置原则(Dependency Inversion Principle, DIP) depend on interface, instead of concrete class.

接口分离原则(Interface Segregation Principle,ISP): one class given to more clients to use, create each interface for every client, and then this class implement all interfaces.

单一职责原则(Single Responsibility Principle, SRP).

l 

l

An excellent system should have these following characteristics:

friendly, understandibility, reliability, reusability, extensibility, portalibity, scalability, simplicity.

Some characteristics conflict, we should make our choice by priority.

But simplicity should be concerned first so that the implementation, use and maintain for the system become simple,

In the end, lower develop cost and shorten develop time.

Attachment: OODesignPrinciples.ppt.zip

原文地址:https://www.cnblogs.com/qingxia/p/1979443.html