# 클린 코더스 13. SRP(Single Responsibility Principle)

### 하나의 객체는 하나의 책임만 갖는다.

![](/files/-LoGxk0hv6-2dzg2vokm)

### EmployeeImpl Class 책임

EmployeeImpl 은 3개의 **책임**을 가지고 있으며 3개의 사용자에 의해 **변경의 근원**이 있다.

* CalculatePay
* Save/findById
* DescribeEmployee

### 책임을 발견하는 방법&#x20;

### 사용자가 특정 **역할**을 수행할 때 **Actor** 라고 부른다<br>

![](/files/-LowOLFQ5C-5_1ev3oJx)

역할은 Inverted Dependency 를 통해서 runtime 의존성을 가져야 한다.

### Inverted Dependency

![](/files/-LowOxCX3UevgeMqr0cL)

누가 변경을 유발하는 사용자인가?

사용자가 특정 **역할**을 수행할 때 **Actor** 라고 부른다<br>

> 책임과 역할의 용어 해석

<div align="left"><img src="/files/-LoGzXlxcJUC-GeFFr0n" alt="Strategy pattern"></div>

**책임**은 각각의 객체 ConcreateStrategyA, ConcreateStrategyB  이다.

하나의 책임만 가질 수 있다.

**역할**은 여러 책임을 가진 Context 객체이다.&#x20;

책임들의 추상화된 속성들을 가지며 역할을 수행한다.

<div align="left"><img src="/files/-LoH-oumom9Gkp0NhTip" alt="Template Method Pattern"></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kimtaesu.gitbook.io/workspace/undefined/13.-srp-single-responsibility-principle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
