Skip to content

Commit

Permalink
Update Chapter 03 - 함수.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Wooseong Kim authored Jun 21, 2017
1 parent ff28def commit 9afaf26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Chapter 03 - 함수.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public class UserValidator {
함수에서 상태를 변경해야 한다면 함수가 속한 객체 상태를 변경하는 방식을 택하라.

## 명령과 조회를 분리하라
함수는 뭔가 객체 상태를 변경하거나, 객체 정보를 반환하거나 둘중 하나다. 둘다 수행해서는 안된다.
함수는 뭔가 객체 상태를 변경하거나, 객체 정보를 반환하거나 둘 중 하나다. 둘 다 수행해서는 안 된다.
`public boolean set(String attribute, String value);`같은 경우에는 속성 값 설정 성공 시 true를 반환하므로 괴상한 코드가 작성된다.
`if(set(“username”, “unclebob”))...` 그러므로 명령과 조회를 분리해 혼란을 주지 않도록 한다.

Expand Down

0 comments on commit 9afaf26

Please sign in to comment.