Suche senden
Hochladen
Refactoring 메소드 호출의 단순화
•
2 gefällt mir
•
847 views
HyeonSeok Choi
Folgen
Technologie
Melden
Teilen
Melden
Teilen
1 von 20
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Python 표준 라이브러리
Python 표준 라이브러리
용 최
Codeware
Codeware
Uri Nativ
Doctrineのメモリーリークについて
Doctrineのメモリーリークについて
t satoppejp
Mocking Dependencies in PHPUnit
Mocking Dependencies in PHPUnit
mfrost503
Introduction to ad-3.4, an automatic differentiation library in Haskell
Introduction to ad-3.4, an automatic differentiation library in Haskell
nebuta
Array
Array
Kongu Engineering College, Perundurai, Erode
Next Level Testing
Next Level Testing
James Saryerwinnie
PhpUnit - The most unknown Parts
PhpUnit - The most unknown Parts
Bastian Feder
Empfohlen
Python 표준 라이브러리
Python 표준 라이브러리
용 최
Codeware
Codeware
Uri Nativ
Doctrineのメモリーリークについて
Doctrineのメモリーリークについて
t satoppejp
Mocking Dependencies in PHPUnit
Mocking Dependencies in PHPUnit
mfrost503
Introduction to ad-3.4, an automatic differentiation library in Haskell
Introduction to ad-3.4, an automatic differentiation library in Haskell
nebuta
Array
Array
Kongu Engineering College, Perundurai, Erode
Next Level Testing
Next Level Testing
James Saryerwinnie
PhpUnit - The most unknown Parts
PhpUnit - The most unknown Parts
Bastian Feder
Functions in python
Functions in python
Ilian Iliev
WP_Query, pre_get_posts, and eliminating query_posts()
WP_Query, pre_get_posts, and eliminating query_posts()
Erick Hitter
Extbase and Beyond
Extbase and Beyond
Jochen Rau
Wait queue
Wait queue
Roy Lee
PythonOOP
PythonOOP
Veera Pendyala
What are arrays in java script
What are arrays in java script
Miguel Silva Loureiro
Functional programming techniques in real-world microservices
Functional programming techniques in real-world microservices
András Papp
Refactoring
Refactoring
Bruno Quintella
Personal Perl 6 compiler
Personal Perl 6 compiler
Andrew Shitov
Swift에서 꼬리재귀 사용기 (Tail Recursion)
Swift에서 꼬리재귀 사용기 (Tail Recursion)
진성 오
Chap1 array
Chap1 array
raksharao
Advanced php testing in action
Advanced php testing in action
Jace Ju
Erlang assembly
Erlang assembly
rstudnicki
iRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat Sheet
Samuel Lampa
Understanding Lemon Generated Parser
Understanding Lemon Generated Parser
vivekanandan r
ZIO actors by Mateusz Sokół Scalac
ZIO actors by Mateusz Sokół Scalac
Scalac
Presentation1
Presentation1
Rahadyan Gusti
Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)
Rick Copeland
Understanding Lemon Generated Parser Final
Understanding Lemon Generated Parser Final
vivekanandan r
Introduction to Clean Code
Introduction to Clean Code
Julio Martinez
C++ api design 품질
C++ api design 품질
HyeonSeok Choi
MiningTheSocialWeb.Ch2.Microformat
MiningTheSocialWeb.Ch2.Microformat
HyeonSeok Choi
Weitere ähnliche Inhalte
Was ist angesagt?
Functions in python
Functions in python
Ilian Iliev
WP_Query, pre_get_posts, and eliminating query_posts()
WP_Query, pre_get_posts, and eliminating query_posts()
Erick Hitter
Extbase and Beyond
Extbase and Beyond
Jochen Rau
Wait queue
Wait queue
Roy Lee
PythonOOP
PythonOOP
Veera Pendyala
What are arrays in java script
What are arrays in java script
Miguel Silva Loureiro
Functional programming techniques in real-world microservices
Functional programming techniques in real-world microservices
András Papp
Refactoring
Refactoring
Bruno Quintella
Personal Perl 6 compiler
Personal Perl 6 compiler
Andrew Shitov
Swift에서 꼬리재귀 사용기 (Tail Recursion)
Swift에서 꼬리재귀 사용기 (Tail Recursion)
진성 오
Chap1 array
Chap1 array
raksharao
Advanced php testing in action
Advanced php testing in action
Jace Ju
Erlang assembly
Erlang assembly
rstudnicki
iRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat Sheet
Samuel Lampa
Understanding Lemon Generated Parser
Understanding Lemon Generated Parser
vivekanandan r
ZIO actors by Mateusz Sokół Scalac
ZIO actors by Mateusz Sokół Scalac
Scalac
Presentation1
Presentation1
Rahadyan Gusti
Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)
Rick Copeland
Understanding Lemon Generated Parser Final
Understanding Lemon Generated Parser Final
vivekanandan r
Introduction to Clean Code
Introduction to Clean Code
Julio Martinez
Was ist angesagt?
(20)
Functions in python
Functions in python
WP_Query, pre_get_posts, and eliminating query_posts()
WP_Query, pre_get_posts, and eliminating query_posts()
Extbase and Beyond
Extbase and Beyond
Wait queue
Wait queue
PythonOOP
PythonOOP
What are arrays in java script
What are arrays in java script
Functional programming techniques in real-world microservices
Functional programming techniques in real-world microservices
Refactoring
Refactoring
Personal Perl 6 compiler
Personal Perl 6 compiler
Swift에서 꼬리재귀 사용기 (Tail Recursion)
Swift에서 꼬리재귀 사용기 (Tail Recursion)
Chap1 array
Chap1 array
Advanced php testing in action
Advanced php testing in action
Erlang assembly
Erlang assembly
iRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat Sheet
Understanding Lemon Generated Parser
Understanding Lemon Generated Parser
ZIO actors by Mateusz Sokół Scalac
ZIO actors by Mateusz Sokół Scalac
Presentation1
Presentation1
Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)
Understanding Lemon Generated Parser Final
Understanding Lemon Generated Parser Final
Introduction to Clean Code
Introduction to Clean Code
Andere mochten auch
C++ api design 품질
C++ api design 품질
HyeonSeok Choi
MiningTheSocialWeb.Ch2.Microformat
MiningTheSocialWeb.Ch2.Microformat
HyeonSeok Choi
Mining the social web 6
Mining the social web 6
HyeonSeok Choi
Code1_2
Code1_2
HyeonSeok Choi
자바 병렬 프로그래밍 ch9
자바 병렬 프로그래밍 ch9
HyeonSeok Choi
Domain driven design ch1
Domain driven design ch1
HyeonSeok Choi
Domain driven design ch9
Domain driven design ch9
HyeonSeok Choi
CODE Ch.21 버스에 올라 탑시다
CODE Ch.21 버스에 올라 탑시다
HyeonSeok Choi
서버인프라를지탱하는기술3_2_3
서버인프라를지탱하는기술3_2_3
HyeonSeok Choi
프로그래머로 사는 법 Ch14
프로그래머로 사는 법 Ch14
HyeonSeok Choi
SICP_2.5 일반화된 연산시스템
SICP_2.5 일반화된 연산시스템
HyeonSeok Choi
Code 11 논리 게이트
Code 11 논리 게이트
HyeonSeok Choi
자바 병렬 프로그래밍 1&2
자바 병렬 프로그래밍 1&2
HyeonSeok Choi
컴퓨터 프로그램 구조와 해석 3.5
컴퓨터 프로그램 구조와 해석 3.5
HyeonSeok Choi
HTTPS
HTTPS
HyeonSeok Choi
실무로 배우는 시스템 성능 최적화 Ch7
실무로 배우는 시스템 성능 최적화 Ch7
HyeonSeok Choi
실무로 배우는 시스템 성능 최적화 Ch6
실무로 배우는 시스템 성능 최적화 Ch6
HyeonSeok Choi
서버인프라를지탱하는기술2_1-2
서버인프라를지탱하는기술2_1-2
HyeonSeok Choi
HTTP 완벽가이드 16장
HTTP 완벽가이드 16장
HyeonSeok Choi
MutiCore 19-20
MutiCore 19-20
HyeonSeok Choi
Andere mochten auch
(20)
C++ api design 품질
C++ api design 품질
MiningTheSocialWeb.Ch2.Microformat
MiningTheSocialWeb.Ch2.Microformat
Mining the social web 6
Mining the social web 6
Code1_2
Code1_2
자바 병렬 프로그래밍 ch9
자바 병렬 프로그래밍 ch9
Domain driven design ch1
Domain driven design ch1
Domain driven design ch9
Domain driven design ch9
CODE Ch.21 버스에 올라 탑시다
CODE Ch.21 버스에 올라 탑시다
서버인프라를지탱하는기술3_2_3
서버인프라를지탱하는기술3_2_3
프로그래머로 사는 법 Ch14
프로그래머로 사는 법 Ch14
SICP_2.5 일반화된 연산시스템
SICP_2.5 일반화된 연산시스템
Code 11 논리 게이트
Code 11 논리 게이트
자바 병렬 프로그래밍 1&2
자바 병렬 프로그래밍 1&2
컴퓨터 프로그램 구조와 해석 3.5
컴퓨터 프로그램 구조와 해석 3.5
HTTPS
HTTPS
실무로 배우는 시스템 성능 최적화 Ch7
실무로 배우는 시스템 성능 최적화 Ch7
실무로 배우는 시스템 성능 최적화 Ch6
실무로 배우는 시스템 성능 최적화 Ch6
서버인프라를지탱하는기술2_1-2
서버인프라를지탱하는기술2_1-2
HTTP 완벽가이드 16장
HTTP 완벽가이드 16장
MutiCore 19-20
MutiCore 19-20
Ähnlich wie Refactoring 메소드 호출의 단순화
Composing method
Composing method
С. Ариука
Chapter 2
Chapter 2
application developer
Clean code
Clean code
Arturo Herrero
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
AustinaGRPaigey
Test driven development_for_php
Test driven development_for_php
Lean Teams Consultancy
For Beginners - C#
For Beginners - C#
Snehal Harawande
Unit testing zend framework apps
Unit testing zend framework apps
Michelangelo van Dam
03-inheritance.ppt
03-inheritance.ppt
SaiM947604
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
Michelangelo van Dam
Wicket KT part 2
Wicket KT part 2
stuq
JavaScript Refactoring
JavaScript Refactoring
Krzysztof Szafranek
Unit testing with zend framework tek11
Unit testing with zend framework tek11
Michelangelo van Dam
Ensure code quality with vs2012
Ensure code quality with vs2012
Sandeep Joshi
package employeeType.employee;public class Employee { private.pdf
package employeeType.employee;public class Employee { private.pdf
sharnapiyush773
Clean Javascript
Clean Javascript
Ryunosuke SATO
Top 5 Magento Secure Coding Best Practices
Top 5 Magento Secure Coding Best Practices
Oleksandr Zarichnyi
Introduction to nsubstitute
Introduction to nsubstitute
Suresh Loganatha
C# basics
C# basics
sagaroceanic11
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
Thuan Nguyen
Stored procedures
Stored procedures
Prof.Nilesh Magar
Ähnlich wie Refactoring 메소드 호출의 단순화
(20)
Composing method
Composing method
Chapter 2
Chapter 2
Clean code
Clean code
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
Test driven development_for_php
Test driven development_for_php
For Beginners - C#
For Beginners - C#
Unit testing zend framework apps
Unit testing zend framework apps
03-inheritance.ppt
03-inheritance.ppt
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
Wicket KT part 2
Wicket KT part 2
JavaScript Refactoring
JavaScript Refactoring
Unit testing with zend framework tek11
Unit testing with zend framework tek11
Ensure code quality with vs2012
Ensure code quality with vs2012
package employeeType.employee;public class Employee { private.pdf
package employeeType.employee;public class Employee { private.pdf
Clean Javascript
Clean Javascript
Top 5 Magento Secure Coding Best Practices
Top 5 Magento Secure Coding Best Practices
Introduction to nsubstitute
Introduction to nsubstitute
C# basics
C# basics
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
Stored procedures
Stored procedures
Mehr von HyeonSeok Choi
밑바닥부터시작하는딥러닝 Ch05
밑바닥부터시작하는딥러닝 Ch05
HyeonSeok Choi
밑바닥부터시작하는딥러닝 Ch2
밑바닥부터시작하는딥러닝 Ch2
HyeonSeok Choi
프로그래머를위한선형대수학1.2
프로그래머를위한선형대수학1.2
HyeonSeok Choi
알고리즘 중심의 머신러닝 가이드 Ch04
알고리즘 중심의 머신러닝 가이드 Ch04
HyeonSeok Choi
딥러닝 제대로시작하기 Ch04
딥러닝 제대로시작하기 Ch04
HyeonSeok Choi
밑바닥부터시작하는딥러닝 Ch05
밑바닥부터시작하는딥러닝 Ch05
HyeonSeok Choi
함수적 사고 2장
함수적 사고 2장
HyeonSeok Choi
7가지 동시성 모델 - 데이터 병렬성
7가지 동시성 모델 - 데이터 병렬성
HyeonSeok Choi
7가지 동시성 모델 4장
7가지 동시성 모델 4장
HyeonSeok Choi
Bounded Context
Bounded Context
HyeonSeok Choi
DDD Repository
DDD Repository
HyeonSeok Choi
DDD Start Ch#3
DDD Start Ch#3
HyeonSeok Choi
실무로 배우는 시스템 성능 최적화 Ch8
실무로 배우는 시스템 성능 최적화 Ch8
HyeonSeok Choi
Logstash, ElasticSearch, Kibana
Logstash, ElasticSearch, Kibana
HyeonSeok Choi
실무로배우는시스템성능최적화 Ch1
실무로배우는시스템성능최적화 Ch1
HyeonSeok Choi
HTTP 완벽가이드 21장
HTTP 완벽가이드 21장
HyeonSeok Choi
HTTP 완벽가이드 6장.
HTTP 완벽가이드 6장.
HyeonSeok Choi
HTTP 완벽가이드 1장.
HTTP 완벽가이드 1장.
HyeonSeok Choi
Cluster - spark
Cluster - spark
HyeonSeok Choi
Pair RDD - Spark
Pair RDD - Spark
HyeonSeok Choi
Mehr von HyeonSeok Choi
(20)
밑바닥부터시작하는딥러닝 Ch05
밑바닥부터시작하는딥러닝 Ch05
밑바닥부터시작하는딥러닝 Ch2
밑바닥부터시작하는딥러닝 Ch2
프로그래머를위한선형대수학1.2
프로그래머를위한선형대수학1.2
알고리즘 중심의 머신러닝 가이드 Ch04
알고리즘 중심의 머신러닝 가이드 Ch04
딥러닝 제대로시작하기 Ch04
딥러닝 제대로시작하기 Ch04
밑바닥부터시작하는딥러닝 Ch05
밑바닥부터시작하는딥러닝 Ch05
함수적 사고 2장
함수적 사고 2장
7가지 동시성 모델 - 데이터 병렬성
7가지 동시성 모델 - 데이터 병렬성
7가지 동시성 모델 4장
7가지 동시성 모델 4장
Bounded Context
Bounded Context
DDD Repository
DDD Repository
DDD Start Ch#3
DDD Start Ch#3
실무로 배우는 시스템 성능 최적화 Ch8
실무로 배우는 시스템 성능 최적화 Ch8
Logstash, ElasticSearch, Kibana
Logstash, ElasticSearch, Kibana
실무로배우는시스템성능최적화 Ch1
실무로배우는시스템성능최적화 Ch1
HTTP 완벽가이드 21장
HTTP 완벽가이드 21장
HTTP 완벽가이드 6장.
HTTP 완벽가이드 6장.
HTTP 완벽가이드 1장.
HTTP 완벽가이드 1장.
Cluster - spark
Cluster - spark
Pair RDD - Spark
Pair RDD - Spark
Kürzlich hochgeladen
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Katpro Technologies
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
soniya singh
Key Features Of Token Development (1).pptx
Key Features Of Token Development (1).pptx
LBM Solutions
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
ThousandEyes
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Memoori
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
2toLead Limited
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Pixlogix Infotech
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
HostedbyConfluent
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
BookNet Canada
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
AndikSusilo4
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Patryk Bandurski
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
Softradix Technologies
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Paola De la Torre
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Safe Software
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
XfilesPro
Kürzlich hochgeladen
(20)
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
Key Features Of Token Development (1).pptx
Key Features Of Token Development (1).pptx
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
Refactoring 메소드 호출의 단순화
1.
Refactoring
2.
메소드
3.
호출의
4.
단순화 cecil
5.
Contents •메소드를
6.
직관적으로
7.
•파라미터
8.
갯수의
9.
조정
10.
•불필요한
11.
정보를
12.
숨김
13.
•생성자를
14.
팩토리
15.
메소드로
16.
•메소드의
17.
예외
18.
선언
19.
메소드를
20.
직관적으로
21.
(기본적인
22.
리팩토링) •Rename
23.
Method
24.
• 메소드의
25.
이름이
26.
그
27.
목적을
28.
드러내지
29.
못하면
30.
이름을
31.
바꿔라
32.
•Add
33.
Parameter
34.
• 메소드를
35.
호출하는
36.
부분에서
37.
더
38.
많은
39.
정보를
40.
필요로
41.
한다면
42.
파라미터를
43.
추가하라
44.
• 이
45.
리팩토링을
46.
하지
47.
않도록
48.
하는
49.
것이
50.
중요(대안:
51.
파라미터
52.
오브젝트
53.
도입)
54.
•Remove
55.
Parameter
56.
•파라미터가
57.
메소드에서
58.
더
59.
이상
60.
사용되지
61.
않으면
62.
제거하라
63.
파라미터
64.
갯수
65.
조정을
66.
위한
67.
리팩토링 많은
68.
수의
69.
파라미터는
70.
메소드를
71.
복잡하게
72.
만든다
73.
Separate
74.
Query
75.
from
76.
Modifier Customer getTotalOutstanding
77.
setReadyForSummaries Customer getTotalOutstandingAndSetReadyForSummaries 값을
78.
리턴할
79.
뿐만
80.
아니라
81.
상태도
82.
변경하는
83.
메소드는
84.
분리하라 값을
85.
리턴하고,
86.
눈에
87.
띄눈
88.
부작용이
89.
없는
90.
것은
91.
매우
92.
가치
93.
있는
94.
일
95.
예외)
96.
동시성
97.
문제:
98.
동시성이
99.
문제가
100.
될
101.
경우
102.
getAndSet
103.
메소드를
104.
가질
105.
필요가
106.
있음.
107.
Parameterize
108.
Method 몇몇
109.
메소드가
110.
다른
111.
값을
112.
포함하고
113.
있는
114.
것을
115.
제외하고는
116.
비슷한
117.
일을
118.
하고
119.
있다면,
120.
121.
파라미터를
122.
가진
123.
하나의
124.
메소드로
125.
만들어라 Employee fivePercentRaise
126.
tenPercentRaise Employee raise(percentage)
127.
Parameterize
128.
Method
129.
(cont’d) 공통된
130.
부분이
131.
덜
132.
명확하게
133.
나타나는
134.
경우
135.
파라미터로
136.
넘겨
137.
받을
138.
수
139.
잇는
140.
몇개의
141.
값을
142.
기초로
143.
반복되는
144.
코드를
145.
찾아라! protected
146.
Dollars
147.
baseCharge()
148.
{
149.
150.
151.
double
152.
result
153.
=
154.
Math.min(lastUsage(),100)
155.
*
156.
0.03;
157.
158.
159.
160.
161.
162.
163.
164.
165.
if
166.
(lastUsage()
167.
168.
100)
169.
{
170.
171.
172.
173.
174.
175.
176.
result
177.
+=
178.
(Math.min
179.
(lastUsage(),200)
180.
-
181.
100)
182.
*
183.
0.05;
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
}
194.
195.
196.
197.
198.
if
199.
(lastUsage()
200.
201.
200)
202.
{
203.
result
204.
+=
205.
(lastUsage()
206.
-
207.
200)
208.
*
209.
0.07;
210.
211.
212.
213.
214.
215.
216.
} return
217.
new
218.
Dollars
219.
(result);
220.
221.
}
222.
protected
223.
Dollars
224.
baseCharge()
225.
{ double
226.
result
227.
=
228.
usageInRange(0,
229.
100)
230.
*
231.
0.03; result
232.
+=
233.
usageInRange
234.
(100,200)
235.
*
236.
0.05; result
237.
+=
238.
usageInRange
239.
(200,
240.
Integer.MAX_VALUE)
241.
*
242.
0.07;
243.
244.
245.
return
246.
new
247.
Dollars
248.
(result);
249.
250.
}
251.
protected
252.
int
253.
usageInRange(int
254.
start,
255.
int
256.
end)
257.
{
258.
if
259.
(lastUsage()
260.
261.
start)
262.
263.
264.
265.
return
266.
Math.min(lastUsage(),end)
267.
-
268.
start;
269.
else
270.
return
271.
0;
272.
}
273.
274.
Replace
275.
Parameter
276.
with
277.
Explicit
278.
Method 파라미터의
279.
값에
280.
따라
281.
다른
282.
코드를
283.
실행하는
284.
메소드가
285.
있다면,
286.
파라미터
287.
값에
288.
대한
289.
별도의
290.
메소드를
291.
만들어라 void
292.
setValue
293.
(String
294.
name,
295.
int
296.
value)
297.
{
298.
299.
300.
if
301.
(name.equals(height))
302.
303.
304.
_height
305.
=
306.
value;
307.
if
308.
(name.equals(width))
309.
310.
311.
_width
312.
=
313.
value;
314.
315.
316.
Assert.shouldNeverReachHere();
317.
} void
318.
setHeight(int
319.
arg)
320.
{
321.
322.
323.
_height
324.
=
325.
arg;
326.
} void
327.
setWidth
328.
(int
329.
arg)
330.
{
331.
332.
_width
333.
=
334.
arg;
335.
336.
} 장점:
337.
조건에
338.
따른
339.
행동을
340.
피할
341.
뿐만
342.
아니라,
343.
컴파일
344.
타임에
345.
검사
346.
가능
347.
348.
ex)
349.
Switch.setState(true)
350.
-
351.
Switch.beOn()
352.
파라미터
353.
값의
354.
변화가
355.
크다면,
356.
이
357.
리팩토링을
358.
적용하면
359.
안됨.
360.
Preserve
361.
Whole
362.
Object 어떤
363.
객체에서
364.
여러개의
365.
값을
366.
얻은
367.
다음
368.
메소드를
369.
호출하면서
370.
파라미터로
371.
넘기고
372.
있다면,
373.
대신
374.
그
375.
객체를
376.
넘겨라 int
377.
low
378.
=
379.
daysTempRange().getLow();
380.
int
381.
high
382.
=
383.
daysTempRange().getHigh();
384.
385.
withinPlan
386.
=
387.
plan.withinRange(low,
388.
high); withinPlan
389.
=
390.
plan.withinRange(daysTempRange()); 장점:
391.
파라미터
392.
리스트
393.
변경에
394.
유연하게
395.
대처가
396.
가능,
397.
코드의
398.
가독성을
399.
높임.
400.
단점:
401.
파라미터로
402.
넘겨진
403.
객체와
404.
호출된
405.
객체
406.
사이에
407.
종속성을
408.
생성
409.
만약
410.
이
411.
리팩토링이
412.
종속성
413.
구조를
414.
나쁘면
415.
한다면
416.
사용하면
417.
안됨.
418.
Preserve
419.
Whole
420.
Object
421.
(Example) class
422.
Room... boolean
423.
withinPlan(HeatingPlan
424.
plan)
425.
{
426.
427.
int
428.
low
429.
=
430.
daysTempRange().getLow();
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
int
444.
high
445.
=
446.
daysTempRange().getHigh();
447.
448.
449.
450.
451.
452.
453.
454.
455.
456.
457.
458.
return
459.
plan.withinRange(low,
460.
high);
461.
462.
463.
464.
465.
466.
467.
468.
}
469.
470.
! class
471.
HeatingPlan...
472.
boolean
473.
withinRange
474.
(int
475.
low,
476.
int
477.
high)
478.
{
479.
return
480.
(low
481.
=
482.
_range.getLow()
483.
484.
485.
486.
487.
488.
489.
490.
491.
492.
493.
494.
495.
496.
497.
498.
high
499.
=
500.
_range.getHigh());
501.
502.
503.
504.
505.
506.
507.
508.
} private
509.
TempRange
510.
_range;
511.
512.
class
513.
Room...
514.
515.
boolean
516.
withinPlan(HeatingPlan
517.
plan)
518.
{
519.
520.
return
521.
plan.withinRange(daysTempRange());
522.
523.
}
524.
! class
525.
HeatingPlan...
526.
boolean
527.
withinRange
528.
(TempRange
529.
roomRange)
530.
{
531.
532.
533.
return
534.
(roomRange.getLow()
535.
=
536.
_range.getLow()
537.
538.
539.
540.
541.
542.
543.
roomRange.getHigh()
544.
=
545.
_range.getHigh());
546.
547.
} class
548.
HeatingPlan...
549.
boolean
550.
withinRange
551.
(TempRange
552.
roomRange)
553.
{
554.
555.
556.
return
557.
(_range.includes(roomRange));
558.
559.
560.
}
561.
! class
562.
TempRange...
563.
boolean
564.
includes
565.
(TempRange
566.
arg)
567.
{
568.
569.
570.
return
571.
arg.getLow()
572.
=
573.
this.getLow()
574.
575.
576.
577.
578.
579.
arg.getHigh()
580.
=
581.
this.getHigh();
582.
583.
}
584.
Replace
585.
Parameter
586.
with
587.
Method 객체가
588.
메소드를
589.
호출한
590.
결과를
591.
다른
592.
메소드에
593.
파라미터로
594.
넘기는
595.
상황에서,
596.
호출된
597.
메소드가
598.
이
599.
메소드를
600.
호출할
601.
수
602.
있다면,
603.
직접
604.
호출하도록
605.
변경 int
606.
basePrice
607.
=
608.
_quantity
609.
*
610.
_itemPrice; discountLevel
611.
=
612.
getDiscountLevel(); double
613.
finalPrice
614.
=
615.
discountedPrice
616.
(basePrice,
617.
discountLevel); int
618.
basePrice
619.
=
620.
_quantity
621.
*
622.
_itemPrice; double
623.
finalPrice
624.
=
625.
discountedPrice
626.
(basePrice); 파라미터는
627.
필요할
628.
때만
629.
사용하라.
630.
Replace
631.
Parameter
632.
with
633.
Method
634.
(Example) public
635.
double
636.
getPrice()
637.
{ int
638.
basePrice
639.
=
640.
_quantity
641.
*
642.
_itemPrice; int
643.
discountLevel; if
644.
(_quantity
645.
646.
100)
647.
discountLevel
648.
=
649.
2; else
650.
discountLevel
651.
=
652.
1; double
653.
finalPrice
654.
=
655.
discountedPrice
656.
(basePrice,
657.
discountLevel);
658.
659.
660.
661.
return
662.
finalPrice;
663.
664.
665.
666.
667.
668.
669.
670.
671.
}
672.
private
673.
double
674.
discountedPrice
675.
(int
676.
basePrice,
677.
int
678.
discountLevel)
679.
{
680.
681.
682.
if
683.
(discountLevel
684.
==
685.
2)
686.
return
687.
basePrice
688.
*
689.
0.1;
690.
691.
else
692.
return
693.
basePrice
694.
*
695.
0.05;
696.
697.
} public
698.
double
699.
getPrice()
700.
{
701.
int
702.
basePrice
703.
=
704.
_quantity
705.
*
706.
_itemPrice;
707.
int
708.
discountLevel
709.
=
710.
getDiscountLevel();
711.
double
712.
finalPrice
713.
=
714.
discountedPrice
715.
(basePrice,
716.
discountLevel);
717.
718.
719.
return
720.
finalPrice;
721.
}
722.
private
723.
double
724.
discountedPrice
725.
(int
726.
basePrice,
727.
int
728.
discountLevel)
729.
{
730.
if
731.
(getDiscountLevel()
732.
==
733.
2)
734.
return
735.
basePrice
736.
*
737.
0.1;
738.
739.
740.
else
741.
return
742.
basePrice
743.
*
744.
0.05;
745.
}
746.
! private
747.
int
748.
getDiscountLevel()
749.
{
750.
751.
752.
if
753.
(_quantity
754.
755.
100)
756.
return
757.
2;
758.
else
759.
return
760.
1;
761.
} public
762.
double
763.
getPrice()
764.
{
765.
int
766.
basePrice
767.
=
768.
_quantity
769.
*
770.
_itemPrice;
771.
double
772.
finalPrice
773.
=
774.
discountedPrice
775.
(basePrice);
776.
777.
778.
return
779.
finalPrice;
780.
}
781.
private
782.
double
783.
discountedPrice
784.
(int
785.
basePrice,)
786.
{
787.
if
788.
(getDiscountLevel()
789.
==
790.
2)
791.
return
792.
basePrice
793.
*
794.
0.1;
795.
796.
797.
else
798.
return
799.
basePrice
800.
*
801.
0.05;
802.
} private
803.
double
804.
getPrice
805.
()
806.
{
807.
if
808.
(getDiscountLevel()
809.
==
810.
2)
811.
return
812.
getBasePrice()
813.
*
814.
0.1;
815.
816.
817.
else
818.
return
819.
getBasePrice()
820.
*
821.
0.05;
822.
}
823.
! private
824.
double
825.
getBasePrice()
826.
{
827.
828.
829.
return
830.
_quantity
831.
*
832.
_itemPrice;
833.
} Extract
834.
Method Replace
835.
Parameter
836.
with
837.
Method Inline
838.
Method
839.
Introduce
840.
Parameter
841.
Object 자연스럽게
842.
몰려
843.
다니는
844.
파라미터
845.
그룹을
846.
가지고
847.
있다면,
848.
그것을
849.
객체로
850.
바꾸어라. Customer amountInvoiceIn(Date
851.
start,
852.
Date
853.
end)
854.
amountReceivedIn(Date
855.
start,
856.
Date
857.
end)
858.
amountOverdueIn(Date
859.
start,
860.
Date
861.
end) Customer amountInvoiceIn(DateRange)
862.
amountReceivedIn(DateRange)
863.
amountOverdueIn(DateRange)
864.
Preserve
865.
Whole
866.
Object
867.
와
868.
유사
869.
차이점:
870.
이
871.
리팩토링은
872.
새로운
873.
객체를
874.
도입함으로,
875.
리팩토링
876.
절차가
877.
틀림.
878.
불필요한
879.
정보를
880.
숨기는
881.
리팩토링 •Remove
882.
Setting
883.
Method
884.
• 어떤
885.
필드가
886.
생성시에
887.
값이
888.
정해지고,
889.
이후
890.
변경되지
891.
않아야
892.
한다면
893.
설정
894.
메소드를
895.
제거하라
896.
•Hide
897.
Method
898.
• 메소드가
899.
다른
900.
클래스에서
901.
사용되지
902.
않는다면,
903.
private로
904.
만들어라
905.
•Encapsulate
906.
Downcast
907.
• 메소드가
908.
그
909.
호출부에서
910.
다운캐스트
911.
될
912.
필요가
913.
있는
914.
객체를
915.
리턴하고
916.
있다면,
917.
다운
918.
919.
캐스트를
920.
메소드
921.
안으로
922.
옮겨라
923.
(ex:
924.
java
925.
1.4이하
926.
버전의
927.
Collection
928.
Classes)
929.
Replace
930.
Constructor
931.
With
932.
Factory
933.
Method 객체를
934.
생성할
935.
때
936.
생성하는
937.
것외에
938.
다른
939.
작업을
940.
하고
941.
있다면,
942.
생성자를
943.
팩토리
944.
메소드로
945.
대체하라 class
946.
Employee
947.
{
948.
private
949.
int
950.
_type; static
951.
final
952.
int
953.
ENGINEER
954.
=
955.
0;
956.
957.
958.
959.
static
960.
final
961.
int
962.
SALESMAN
963.
=
964.
1;
965.
966.
967.
968.
969.
970.
971.
972.
973.
static
974.
final
975.
int
976.
MANAGER
977.
=
978.
2;
979.
980.
981.
982.
983.
984.
985.
986.
987.
988.
Employee
989.
(int
990.
type)
991.
{
992.
993.
994.
995.
_type
996.
=
997.
type;
998.
999.
}
1000.
} static
1001.
Employee
1002.
create(int
1003.
type)
1004.
{
1005.
1006.
1007.
switch
1008.
(type)
1009.
{
1010.
1011.
1012.
case
1013.
ENGINEER:
1014.
1015.
1016.
return
1017.
new
1018.
Engineer();
1019.
1020.
1021.
case
1022.
SALESMAN:
1023.
1024.
1025.
return
1026.
new
1027.
Salesman();
1028.
1029.
1030.
case
1031.
MANAGER:
1032.
1033.
1034.
return
1035.
new
1036.
Manager();
1037.
1038.
1039.
default:
1040.
1041.
1042.
1043.
…⋯
1044.
1045.
}
1046.
}
1047.
Employee.create(ENGINEER); class
1048.
Person...
1049.
static
1050.
Person
1051.
createMale(){
1052.
1053.
1054.
return
1055.
new
1056.
Male();
1057.
1058.
1059.
}
1060.
1061.
static
1062.
Person
1063.
createFemale()
1064.
{
1065.
1066.
1067.
1068.
return
1069.
new
1070.
Female();
1071.
1072.
}
1073.
}
1074.
…⋯
1075.
Person
1076.
kent
1077.
=
1078.
Person.createMale(); 문자열을
1079.
이용한
1080.
서브
1081.
클래스
1082.
객체
1083.
생성 명시적
1084.
메소드로
1085.
서브
1086.
클래스
1087.
객체
1088.
생성 etc)
1089.
문자열을
1090.
이용한
1091.
생성
1092.
메소드
1093.
예외
1094.
선언과
1095.
관련된
1096.
리팩토링 테스트와
1097.
예외를
1098.
구분하여
1099.
사용하라
1100.
Replace
1101.
Error
1102.
Code
1103.
with
1104.
Exception 메소드가
1105.
에러를
1106.
나타내는
1107.
특별한
1108.
코드를
1109.
가지고
1110.
있다면,
1111.
대신
1112.
예외를
1113.
던져라. int
1114.
withdraw(int
1115.
amount)
1116.
{
1117.
1118.
1119.
if
1120.
(amount
1121.
1122.
_balance)
1123.
1124.
1125.
return
1126.
-1;
1127.
1128.
1129.
else
1130.
{
1131.
1132.
1133.
_balance
1134.
-=
1135.
amount;
1136.
1137.
1138.
return
1139.
0;
1140.
1141.
1142.
}
1143.
} void
1144.
withdraw(int
1145.
amount)
1146.
throws
1147.
BalanceException
1148.
{
1149.
if
1150.
(amount
1151.
1152.
_balance)
1153.
1154.
1155.
1156.
throw
1157.
new
1158.
BalanceException();
1159.
1160.
1161.
_balance
1162.
-=
1163.
amount;
1164.
} 비검사
1165.
예외를
1166.
사용하는
1167.
경우:
1168.
검사의
1169.
책임이
1170.
호출부에
1171.
있는
1172.
경우
1173.
검사
1174.
예외를
1175.
사용하는
1176.
경우:
1177.
검사의
1178.
책임이
1179.
수신수에
1180.
있는
1181.
경우
1182.
Replace
1183.
Exception
1184.
with
1185.
Test 호출부에서
1186.
먼저
1187.
검사할
1188.
수
1189.
있는
1190.
조건에
1191.
대해
1192.
예외를
1193.
던지고
1194.
있다면,
1195.
호출부가
1196.
먼저
1197.
검사하도록
1198.
바꿔라. double
1199.
getValueForPeriod
1200.
(int
1201.
periodNumber)
1202.
{
1203.
1204.
1205.
try
1206.
{
1207.
1208.
1209.
return
1210.
_values[periodNumber];
1211.
}
1212.
catch
1213.
(ArrayIndexOutOfBoundsException
1214.
e)
1215.
{
1216.
1217.
1218.
return
1219.
0;
1220.
1221.
1222.
}
1223.
} double
1224.
getValueForPeriod
1225.
(int
1226.
periodNumber)
1227.
{
1228.
if
1229.
(periodNumber
1230.
=
1231.
_values.length)
1232.
1233.
1234.
1235.
return
1236.
0;
1237.
1238.
1239.
return
1240.
_values[periodNumber];
1241.
} 예외가
1242.
조건
1243.
테스트를
1244.
대신하는
1245.
역할을
1246.
하면
1247.
안된다.
1248.
호출부에서
1249.
동작을
1250.
호출하기
1251.
전에
1252.
조건을
1253.
테스트
1254.
할
1255.
수
1256.
있다면
1257.
테스트를
1258.
제공해야
1259.
하고,
1260.
호출부에서
1261.
그것을
1262.
사용해야
1263.
한다.
1264.
QA
1265.
Reference • Martin
1266.
Fowler.
1267.
리팩토링.
1268.
(윤성준,
1269.
조재박역).
1270.
서울:
1271.
대청미디어,
1272.
2003
Jetzt herunterladen