面向对象的设计准则--Principles Of Object-Oriented Design
2007-08-07 11:27
381 查看
开放封闭原则 Software entities (classes, modules, etc) should be open for extension, but closed for modification. 软件实体像类,模块等应该对扩展是开放的,而对修改是封闭的。
里氏替换原则 Derived classes must be usable through the base class interface without the need for the user to know the difference.
依赖倒置原则 Details should depend upon abstractions. Abstractions should not depend upon details.
1 public interface IProgrammer
2
7 public class Programmer : IProgrammer
8
13 public abstract class ManagerBase
14
18 public class Manager : ManagerBase
19
26 public class Client
27 public interface IPrinter
2
8 public class Printer : IPrinter
9
24
25 public interface IPrinter2
26
32 public interface IMeasure
33
37 public class Printer2 : IPrinter2
38 {
39 public string Read()
40 {
41 return null;
42 }
43
44 public void Write(string content)
45 {
46 }
47
48 public void Monitor(IMeasure format)
49 {
50 }
51 }
...
http://www.tek271.com/articles/pood/PrinciplesOfOOD.java.html
http://ootips.org/ood-principles.html
http://www.oodesign.com/oo_principles/oo_principles/single_responsibility_principle.html
里氏替换原则 Derived classes must be usable through the base class interface without the need for the user to know the difference.
依赖倒置原则 Details should depend upon abstractions. Abstractions should not depend upon details.
1 public interface IProgrammer
2
7 public class Programmer : IProgrammer
8
13 public abstract class ManagerBase
14
18 public class Manager : ManagerBase
19
26 public class Client
27 public interface IPrinter
2
8 public class Printer : IPrinter
9
24
25 public interface IPrinter2
26
32 public interface IMeasure
33
37 public class Printer2 : IPrinter2
38 {
39 public string Read()
40 {
41 return null;
42 }
43
44 public void Write(string content)
45 {
46 }
47
48 public void Monitor(IMeasure format)
49 {
50 }
51 }
...
http://www.tek271.com/articles/pood/PrinciplesOfOOD.java.html
http://ootips.org/ood-principles.html
http://www.oodesign.com/oo_principles/oo_principles/single_responsibility_principle.html
相关文章推荐
- Objective-C——面向对象设计——OOD(Object Oriented Designs)
- 面向对象设计原则和设计准则
- Design Patterns - Elements of Reusable Object-Oriented Software 设计模式-可复用的面向对象软件元素。【笔记】
- 面向对象设计的几条经验准则
- 译:面向对象设计原则(Object Oriented Design Principles)
- OOD - Object Oriented Design 面向对象设计实例
- 面向对象设计的基础准则
- Object Oriented Design面向对象设计
- Java面向对象设计编程思想(Essential Object Oriented Software Construction)的本质----百家争鸣 陈光剑
- 面向对象设计的准则
- Object-Oriented Game Design(面向对象游戏设计)
- 面向对象设计Object Oriented Design
- 面向对象设计的11个原则
- C#面向对象设计模式纵横谈 学习笔记3 Abstract Factory 抽象工厂
- 面向对象6_常见的设计模式【单例模式】【模板模式】【组合设计模式】等
- 面向对象设计七大原则
- 面向对象分析和设计(OOA,OOD,OOP,OOT)
- 面向对象设计和编程
- [转载] C#面向对象设计模式纵横谈——1. 面向对象设计模式与原则
- 面试题总结之MISC(操作系统,网络,算法和数据结构,数学,面向对象设计,软件开发,测试,工具)