分离关注 – 单一责任原则和关注分离之间的差异

前端之家收集整理的这篇文章主要介绍了分离关注 – 单一责任原则和关注分离之间的差异前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
单一责任原则和关注的分离有什么区别?

Single Responsibility Principle (SRP)-
give each class just one reason to
change; and “Reason to change” ==
“responsibility”. In example: Invoice
class does not have a responsibility
to print itself.

Separation of Concerns (since 1974).
Concern == feature of system. Taking
care of each of the concerns: for each
one concern,other concerns are
irrelevant. Hiding implementation of
behavior.

here

猜你在找的设计模式相关文章