Difference between Single Responsibility Principle and Separation of Concerns

后端 未结 13 1369
-上瘾入骨i
-上瘾入骨i 2020-12-07 15:20

What is the difference between Single Responsibility Principle and Separation of Concerns?

13条回答
  •  無奈伤痛
    2020-12-07 16:07

    Separation of Concern vs Single Responsibility Principle ( SoC vs SRP )

    From the linked article:

    Separation of Concerns (SoC) – is the process of breaking a computer program into distinct features that overlap in functionality as little as possible. A concern is any piece of interest or focus in a program. Typically, concerns are synonymous with features or behaviors. http://en.wikipedia.org/wiki/Separation_of_concerns

    Single Responsibility Principle (SRP) – every object should have a single responsibility, and that all its services should be narrowly aligned with that responsibility. On some level Cohesion is considered as synonym for SRP. http://en.wikipedia.org/wiki/Single_responsibility_principle

提交回复
热议问题