1、”开-闭”原则——模块应对扩展开放,而对修改关闭。
2、里氏代换原则——如果调用的是父类的话,那么换成子类也完全可以运行。里氏代换原则是继承复用的一个基础。
3、合成复用原则——要少用继承,多用合成关系来实现。
4、依赖倒转原则——抽象不应该依赖与细节,细节应当依赖与抽象。
要针对接口编程,而不是针对实现编程。
5、迪米特法则——最少知识原则。不要和陌生人说话。
objective-c,php,javascript,actionscript,mysql,linux,mac os,snow leopard
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
You must be logged in to post a comment.