一些面向对象的设计法则

来源:互联网 发布:微信刷赞软件免费版 编辑:程序博客网 时间:2024/05/16 10:35
一些面向对象的设计法则
  • Favor Composition Over Inheritance,优先使用(对象)组合,而非(类)继承
  • Program To An Interface, Not An Implementation ,针对接口编程,而非(接口的)实现
  • Software Entities Should Be Open For Extension, Yet Closed For Modification,开放-封闭法则(OCP)
  • Function Thar Use Referennces To Base(Super) Classes Must Be Able To Use Objects Of Derived(Sub) Classes Without Knowing It ,Liskov替换法则(LSP)
原创粉丝点击