再谈设计原则—7种设计原则学习总结笔记
发布日期:2021-05-09 09:26:14 浏览次数:15 分类:博客文章

本文共 9412 字,大约阅读时间需要 31 分钟。

���������������������������������������������������������������������������C���������������������������

������������������������������������������,������������������������������������������������������������

���������/���������/������������/������������/������������/������������/������������/���������

���������������������������

������������(OPEN CLOSE PRINCIPLE)������������������������������������������������������������������������������������(Software entities should be open for extension���but closed for modification)���

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������(���������������������������������������������������������������������������������������������)���

������������������(Single-Responsibilitiy Principle)������������������������������������������������������������There should never be more than one reason for a class to change���

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������

������������������(Liskov Substitution Principle)������������������������������������������������������������������������Inheritance should ensure that any property proved about supertype objects also holds for subtype objects���

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Java���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

LSP������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������-������������������������������������-���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������(Dependence Inversion Principle)���������������������������������������������������������������������������������������������������������������������������������������High level modules shouldnot depend upon low level modules.Both should depend upon abstractions.Abstractions should not depend upon details. Details should depend upon abstractions������

������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������

  • ���������������������������������������������������������

  • ������������������������������������������

  • ������������������������������������������������

������������������(Interface Segregation Principle)��� ���������������������������������������������������������������������The dependency of one class to another one should depend on the smallest possible interface���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Clients should not be forced to depend on methods they do not use������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������

  • ������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������������������������������

���������������||������������������(Low of Demeter Principle||Least Knowledge Principle)������������������������������������������������������������������Talk only to your immediate friends and not to strangers���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������(���������������������)���

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������public������������������������������������������������������������������������������������������

���������������������������(���������������������������������������������������)������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������ 6 ������

  • ������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������

  • ������������������������������������������������������������������

  • ���������������������������������������������������������������������������

  • ������������������������������������������������������������������set ��� get ������������

  • ������������������������Serializable���������

������||������||������������������(Composition/Aggregation Reuse Principle(CARP) )���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������

���������������������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������������������������������������������������������

 

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������������������������������������������������������������������������������

��������������� 

上一篇:三色视者与四色视者身后的理论基础:色彩原理
下一篇:sass安装:webpack sass编译失败,node-sass安装失败的终极解决方

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2025年04月12日 22时03分11秒