Skip to content

Single-responsibility principle

一、单一职责原则。

二、它看似简单,但是是很多pattern背后的思想,包括:

a、AOP: aspect-oriented programming

b、decorator pattern

三、assemble

Single-responsibility principle促进了assemble(composition)

wikipedia Single-responsibility principle

a class should manage one resource only

上面这段话是我在阅读stackoverflow What is the copy-and-swap idiom?时,读到的, 它可以作为single responsibility principle的例子。

https://www.oodesign.com/single-responsibility-principle.html

https://www.toptal.com/software/single-responsibility-principle