SlideShare uma empresa Scribd logo
1 de 24
Introduction to Refactoring

           Step 1
    What, Why, When, How
     bw.moon@lge.com
What is refactoring
• Fowler's definition “A change made to the
  internal structure of software to make it
  easier to understand and cheaper to
  modify without changing its observable
  behavior”
Why
Bad Smell
Good Smell
When
Bad Smell
Iterative
Unit test
How : Extract
Extract Class
Extract Method
Remove
Remove Middle Man
Remove Setting Method
Replace
Replace Assignment with
      Initialization

 void foo() { int i; // .... i = 7; }




  void foo() { // ... int i = 7; }
Replace Constructor with Factory
            Method

    Employee (int type) { _type = type; }




static Employee create(int type) { return new
             Employee(type); }
Hide
Hide Delegate
Hide Method
Resources 1
1장. 리팩토링 비디오
2장. 리팩토링의 원리
3장. 코드에서의 나쁜 냄새
4장. 테스트 만들기
5장. 리팩토링 카탈로그로...
6장. 메쏘드 구성
7장. 객체간의 기능 이동
8장. 데이터 구성
9장. 조건문의 단순화
10장. 메쏘드 호출의 단순화
11장. 일반화 다루기
12장. 대규모 리팩토링
13장. 리팩토링 재사용, 그리고 현실
14장. 리팩토링 도구
15장. 모두 합치기
Resources 2
•   [항목 24] 컴파일 경고 메시지가 없게 하자 158
•   [항목 30] int 상수 대신 enum을 사용하자 201
•   [항목 38] 매개 변수가 유효한지 검사하자 247
•   [항목 43] null대신 비어있는 배열이나 컬렉션을 반환하자 274
•   [항목 45] 지역 변수의 유효 범위를 최소화 하자 285
•   [항목 47] 라이브러리를 배우고 사용하자 293
•   [항목 48] 정확한 계산에는 float나 double 타입을 쓰지 말자 297
•   [항목 49] 박스화 기본형보다는 기본형을 사용하자 300
•   [항목 56] 보편화된 작명 규칙을 따르자 323
•   [항목 62] 메소드가 던지는 모든 예외를 문서화하자 344
•   [항목 63] 실패 상황 정보를 상세 메시지에 포함하자 346
•   [항목 64] 실패 원자성을 갖도록 노력하자 349
Q&A

Mais conteúdo relacionado

Destaque

study refactoring
study refactoringstudy refactoring
study refactoring재원 최
 
The roadtocodecraft
The roadtocodecraftThe roadtocodecraft
The roadtocodecraftbbongcsu
 
Bnf seeg ws
Bnf seeg wsBnf seeg ws
Bnf seeg wsbbongcsu
 
Big refactoring #12
Big refactoring #12Big refactoring #12
Big refactoring #12Jay Kim
 
OPEN Forum: Women Business Owners
OPEN Forum: Women Business OwnersOPEN Forum: Women Business Owners
OPEN Forum: Women Business OwnersRashmi Sinha
 
Clean code
Clean codeClean code
Clean codebbongcsu
 
TDD&Refactoring Day 02: TDD
TDD&Refactoring Day 02: TDDTDD&Refactoring Day 02: TDD
TDD&Refactoring Day 02: TDDSuwon Chae
 
Refactoring #7
Refactoring #7Refactoring #7
Refactoring #7Jay Kim
 
Mongo db로 배우는 nosql
Mongo db로 배우는 nosqlMongo db로 배우는 nosql
Mongo db로 배우는 nosqlSuwon Chae
 
Refactoring -chapter 7,8-
Refactoring -chapter 7,8-Refactoring -chapter 7,8-
Refactoring -chapter 7,8-Kwang Jung Kim
 
Refactoring tutorial
Refactoring tutorialRefactoring tutorial
Refactoring tutorialBingu Shim
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous IntegrationDonghyun Seo
 
refactoring database
refactoring databaserefactoring database
refactoring database기룡 남
 
[235]루빅스개발이야기 황지수
[235]루빅스개발이야기 황지수[235]루빅스개발이야기 황지수
[235]루빅스개발이야기 황지수NAVER D2
 
리팩토링 (Refactoring)
리팩토링 (Refactoring)리팩토링 (Refactoring)
리팩토링 (Refactoring)Ashal aka JOKER
 
Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]bbongcsu
 
Refactoring(inline class, Hide delegate, remove middle man)
Refactoring(inline class, Hide delegate, remove middle man)Refactoring(inline class, Hide delegate, remove middle man)
Refactoring(inline class, Hide delegate, remove middle man)DaeMyung Kang
 
스프링 프로젝트 시작하기
스프링 프로젝트 시작하기스프링 프로젝트 시작하기
스프링 프로젝트 시작하기Ashal aka JOKER
 

Destaque (20)

study refactoring
study refactoringstudy refactoring
study refactoring
 
Refactoring#9
Refactoring#9Refactoring#9
Refactoring#9
 
The roadtocodecraft
The roadtocodecraftThe roadtocodecraft
The roadtocodecraft
 
Bnf seeg ws
Bnf seeg wsBnf seeg ws
Bnf seeg ws
 
Big refactoring #12
Big refactoring #12Big refactoring #12
Big refactoring #12
 
OPEN Forum: Women Business Owners
OPEN Forum: Women Business OwnersOPEN Forum: Women Business Owners
OPEN Forum: Women Business Owners
 
Clean code
Clean codeClean code
Clean code
 
Working with code
Working with codeWorking with code
Working with code
 
TDD&Refactoring Day 02: TDD
TDD&Refactoring Day 02: TDDTDD&Refactoring Day 02: TDD
TDD&Refactoring Day 02: TDD
 
Refactoring #7
Refactoring #7Refactoring #7
Refactoring #7
 
Mongo db로 배우는 nosql
Mongo db로 배우는 nosqlMongo db로 배우는 nosql
Mongo db로 배우는 nosql
 
Refactoring -chapter 7,8-
Refactoring -chapter 7,8-Refactoring -chapter 7,8-
Refactoring -chapter 7,8-
 
Refactoring tutorial
Refactoring tutorialRefactoring tutorial
Refactoring tutorial
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
refactoring database
refactoring databaserefactoring database
refactoring database
 
[235]루빅스개발이야기 황지수
[235]루빅스개발이야기 황지수[235]루빅스개발이야기 황지수
[235]루빅스개발이야기 황지수
 
리팩토링 (Refactoring)
리팩토링 (Refactoring)리팩토링 (Refactoring)
리팩토링 (Refactoring)
 
Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]
 
Refactoring(inline class, Hide delegate, remove middle man)
Refactoring(inline class, Hide delegate, remove middle man)Refactoring(inline class, Hide delegate, remove middle man)
Refactoring(inline class, Hide delegate, remove middle man)
 
스프링 프로젝트 시작하기
스프링 프로젝트 시작하기스프링 프로젝트 시작하기
스프링 프로젝트 시작하기
 

Semelhante a Refactoring Seminar

DevRookie 리펙터링.pptx
DevRookie 리펙터링.pptxDevRookie 리펙터링.pptx
DevRookie 리펙터링.pptxMUUMUMUMU
 
Javascript refactoring workshop
Javascript refactoring workshopJavascript refactoring workshop
Javascript refactoring workshopJaehoon Oh
 
Devon 2011-b-5 효과적인 레거시 코드 다루기
Devon 2011-b-5 효과적인 레거시 코드 다루기Devon 2011-b-5 효과적인 레거시 코드 다루기
Devon 2011-b-5 효과적인 레거시 코드 다루기Daum DNA
 
HolubOnPatterns/chapter2_2
HolubOnPatterns/chapter2_2HolubOnPatterns/chapter2_2
HolubOnPatterns/chapter2_2SeungHyun Hwang
 
xUnitTestPattern/chapter8
xUnitTestPattern/chapter8xUnitTestPattern/chapter8
xUnitTestPattern/chapter8hyun soomyung
 
이펙티브 C++ (7~9)
이펙티브 C++ (7~9)이펙티브 C++ (7~9)
이펙티브 C++ (7~9)익성 조
 
More effective c++ 챕터3~4ppt
More effective c++ 챕터3~4pptMore effective c++ 챕터3~4ppt
More effective c++ 챕터3~4pptInjae Lee
 
The Cucumber for Java
The Cucumber for JavaThe Cucumber for Java
The Cucumber for JavaJonghwa Lee
 
02 01 아이디어_발상법-김용경[최종]
02 01 아이디어_발상법-김용경[최종]02 01 아이디어_발상법-김용경[최종]
02 01 아이디어_발상법-김용경[최종]Seonghee Jeon
 
Testing & refactoring
Testing & refactoringTesting & refactoring
Testing & refactoringLim Hosung
 
Chapter7~9 ppt
Chapter7~9 pptChapter7~9 ppt
Chapter7~9 pptInjae Lee
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usageTae Young Lee
 
Effective c++ chapter 7,8
Effective c++ chapter 7,8Effective c++ chapter 7,8
Effective c++ chapter 7,8문익 장
 

Semelhante a Refactoring Seminar (16)

DevRookie 리펙터링.pptx
DevRookie 리펙터링.pptxDevRookie 리펙터링.pptx
DevRookie 리펙터링.pptx
 
Javascript refactoring workshop
Javascript refactoring workshopJavascript refactoring workshop
Javascript refactoring workshop
 
Devon 2011-b-5 효과적인 레거시 코드 다루기
Devon 2011-b-5 효과적인 레거시 코드 다루기Devon 2011-b-5 효과적인 레거시 코드 다루기
Devon 2011-b-5 효과적인 레거시 코드 다루기
 
The Introduction to Refactoring
The Introduction to Refactoring The Introduction to Refactoring
The Introduction to Refactoring
 
HolubOnPatterns/chapter2_2
HolubOnPatterns/chapter2_2HolubOnPatterns/chapter2_2
HolubOnPatterns/chapter2_2
 
xUnitTestPattern/chapter8
xUnitTestPattern/chapter8xUnitTestPattern/chapter8
xUnitTestPattern/chapter8
 
EC 789
EC 789EC 789
EC 789
 
이펙티브 C++ (7~9)
이펙티브 C++ (7~9)이펙티브 C++ (7~9)
이펙티브 C++ (7~9)
 
More effective c++ 챕터3~4ppt
More effective c++ 챕터3~4pptMore effective c++ 챕터3~4ppt
More effective c++ 챕터3~4ppt
 
The Cucumber for Java
The Cucumber for JavaThe Cucumber for Java
The Cucumber for Java
 
02 01 아이디어_발상법-김용경[최종]
02 01 아이디어_발상법-김용경[최종]02 01 아이디어_발상법-김용경[최종]
02 01 아이디어_발상법-김용경[최종]
 
04 3 함수와반환문
04 3 함수와반환문04 3 함수와반환문
04 3 함수와반환문
 
Testing & refactoring
Testing & refactoringTesting & refactoring
Testing & refactoring
 
Chapter7~9 ppt
Chapter7~9 pptChapter7~9 ppt
Chapter7~9 ppt
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usage
 
Effective c++ chapter 7,8
Effective c++ chapter 7,8Effective c++ chapter 7,8
Effective c++ chapter 7,8
 

Mais de Byeongweon Moon

No sql solutions - 공개용
No sql solutions - 공개용No sql solutions - 공개용
No sql solutions - 공개용Byeongweon Moon
 
실시간 인벤트 처리
실시간 인벤트 처리실시간 인벤트 처리
실시간 인벤트 처리Byeongweon Moon
 
3GPP UICC Spec. differences
3GPP UICC Spec. differences3GPP UICC Spec. differences
3GPP UICC Spec. differencesByeongweon Moon
 
USAT : USIM Application Toolkit
USAT : USIM Application ToolkitUSAT : USIM Application Toolkit
USAT : USIM Application ToolkitByeongweon Moon
 
공개SW공모대전 2009 기술캠프 강의자료
공개SW공모대전 2009 기술캠프 강의자료공개SW공모대전 2009 기술캠프 강의자료
공개SW공모대전 2009 기술캠프 강의자료Byeongweon Moon
 
미스터리쇼핑 발표
미스터리쇼핑 발표미스터리쇼핑 발표
미스터리쇼핑 발표Byeongweon Moon
 
Google Summer Of Code 2008
Google Summer Of Code 2008Google Summer Of Code 2008
Google Summer Of Code 2008Byeongweon Moon
 
한양대 문병원 최종
한양대 문병원 최종한양대 문병원 최종
한양대 문병원 최종Byeongweon Moon
 

Mais de Byeongweon Moon (11)

No sql solutions - 공개용
No sql solutions - 공개용No sql solutions - 공개용
No sql solutions - 공개용
 
Introduction to HBase
Introduction to HBaseIntroduction to HBase
Introduction to HBase
 
Redis
RedisRedis
Redis
 
실시간 인벤트 처리
실시간 인벤트 처리실시간 인벤트 처리
실시간 인벤트 처리
 
SIM Initialization
SIM InitializationSIM Initialization
SIM Initialization
 
3GPP UICC Spec. differences
3GPP UICC Spec. differences3GPP UICC Spec. differences
3GPP UICC Spec. differences
 
USAT : USIM Application Toolkit
USAT : USIM Application ToolkitUSAT : USIM Application Toolkit
USAT : USIM Application Toolkit
 
공개SW공모대전 2009 기술캠프 강의자료
공개SW공모대전 2009 기술캠프 강의자료공개SW공모대전 2009 기술캠프 강의자료
공개SW공모대전 2009 기술캠프 강의자료
 
미스터리쇼핑 발표
미스터리쇼핑 발표미스터리쇼핑 발표
미스터리쇼핑 발표
 
Google Summer Of Code 2008
Google Summer Of Code 2008Google Summer Of Code 2008
Google Summer Of Code 2008
 
한양대 문병원 최종
한양대 문병원 최종한양대 문병원 최종
한양대 문병원 최종
 

Refactoring Seminar

  • 1. Introduction to Refactoring Step 1 What, Why, When, How bw.moon@lge.com
  • 2. What is refactoring • Fowler's definition “A change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior”
  • 3. Why
  • 17. Replace Assignment with Initialization void foo() { int i; // .... i = 7; } void foo() { // ... int i = 7; }
  • 18. Replace Constructor with Factory Method Employee (int type) { _type = type; } static Employee create(int type) { return new Employee(type); }
  • 19. Hide
  • 22. Resources 1 1장. 리팩토링 비디오 2장. 리팩토링의 원리 3장. 코드에서의 나쁜 냄새 4장. 테스트 만들기 5장. 리팩토링 카탈로그로... 6장. 메쏘드 구성 7장. 객체간의 기능 이동 8장. 데이터 구성 9장. 조건문의 단순화 10장. 메쏘드 호출의 단순화 11장. 일반화 다루기 12장. 대규모 리팩토링 13장. 리팩토링 재사용, 그리고 현실 14장. 리팩토링 도구 15장. 모두 합치기
  • 23. Resources 2 • [항목 24] 컴파일 경고 메시지가 없게 하자 158 • [항목 30] int 상수 대신 enum을 사용하자 201 • [항목 38] 매개 변수가 유효한지 검사하자 247 • [항목 43] null대신 비어있는 배열이나 컬렉션을 반환하자 274 • [항목 45] 지역 변수의 유효 범위를 최소화 하자 285 • [항목 47] 라이브러리를 배우고 사용하자 293 • [항목 48] 정확한 계산에는 float나 double 타입을 쓰지 말자 297 • [항목 49] 박스화 기본형보다는 기본형을 사용하자 300 • [항목 56] 보편화된 작명 규칙을 따르자 323 • [항목 62] 메소드가 던지는 모든 예외를 문서화하자 344 • [항목 63] 실패 상황 정보를 상세 메시지에 포함하자 346 • [항목 64] 실패 원자성을 갖도록 노력하자 349
  • 24. Q&A