开发者

Does the DAO pattern spoils cohesion /SRP?

开发者 https://www.devze.com 2023-03-15 23:00 出处:网络
Let\'s use as example: class AccountDAO { create(){..} read(){..} 开发者_运维问答update(){..} delete() {..}

Let's use as example:

class AccountDAO {
    create(){..}
    read(){..}
    开发者_运维问答update(){..}
    delete() {..}
}

How many responsibilities are there? 1 or 4?


SRP shouldn't be understood in a strict manner. One object should have very few responsibilities, not "one".

Here AccountDAO is only responsible for Account persistence, so it has only one responsibility.

0

精彩评论

暂无评论...
验证码 换一张
取 消