Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
让我们作为例子:
class AccountDAO { create(){..} read(){..} update(){..} delete() {..} }
有多少责任?1个还是4个?
不应以严格的方式理解 SRP。一个对象应该有很少的职责,而不是“一个”。
这里AccountDAO只负责Account持久化,所以它只有一个职责。