Strategy Pattern (์ ๋ต ํจํด) ํน์ ์ปจํ ์คํธ(Context)์์ ์๊ณ ๋ฆฌ์ฆ, ์ ๋ต(Strategy)์ ๋ณ๋๋ก ๋ถ๋ฆฌํ๋ ์ค๊ณ ๋ฐฉ๋ฒ ์์ ) ๊ณผ์ผ ๋งค์ฅ์ ํ ์ธ ์ ์ฑ ํ ๊ณผ์ผ ๋งค์ฅ์ ํ์ฌ 2๊ฐ์ง์ ํ ์ธ ์ ์ฑ ์ ์ด๊ณ ์๋ค. ๋งค์ฅ์ ์ฒ์์ผ๋ก ๋ค์ด์จ ์ฒซ ์๋์ ์ํ '์ฒซ ์๋ ํ ์ธ' ์ ์ฑ ์ ๋ ์๊ฐ๋ ์ ์ ๋๊ฐ ๋จ์ด์ง ๊ณผ์ผ์ ๋ํ '๋ ์ ์ ํ ๊ณผ์ผ ํ ์ธ' ์ ์ฑ ๋ฌผ๋ก ์ด 2๊ฐ์ง ์ธ์ ์ถ๊ฐ์ ์ผ๋ก ํ ์ธ ์ ์ฑ ์ด ๋ ์๊ธธ ๊ฐ๋ฅ์ฑ์ด ์๋ค. public class Calculator { public int calculate(boolean firstGuest. List items) { int sum = 0; for(Item item : items) { if(firstGuest) { sum += (int)(item.get..
Design Pattern
2019. 9. 13. 17:01
๊ณต์ง์ฌํญ
์ต๊ทผ์ ์ฌ๋ผ์จ ๊ธ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
- Total
- Today
- Yesterday
TAG
- javascript
- FRAGMENT
- ํ๊ณ
- dfs
- mysql
- ๋ฆฌ๋ฒ์ฑ
- Vo
- Algorithm
- webhacking.kr
- reversing
- ํ๋ก๊ทธ๋๋จธ์ค
- OneToMany
- Java
- JPA
- ์นํดํน
- C
- queue
- brute-force
- ์ฐ์ํ ํ ํฌ์ฝ์ค
- Stack
- ๊ฐ๋ฐ์
- Android Studio
- bfs
- git
- Android
- Data Structure
- ํด์ธ์ฌํ
- socket
- sort
- graph
| ์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
๊ธ ๋ณด๊ดํจ