refactoring – simple word which all of you already heard about it - do minh tuan
TRANSCRIPT
RefactoringA simple word which all of you already heard about
–Do Minh Tuan
I’m Tuan• Live in Da Nang.
• Working in Axon Active Vietnam.
• Scrum Master, Team Leader, Software Engineer.
• Java, Javascript, Code Generator.
Story
–Martin Fowler
“a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.”
What is Refactoring ?
ADDING FUNCTION REFACTORING
you can only wear one hat at a time
Why should you refactor ?
Improve your software design
Easier to understand
Future Developer
Save your energy
Finding bugs
Programming faster
Video
When do you refactor ?
–Don Roberts
“The first time you do something, you just do it. The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway. The third time you do something similar, you refactor”
Adding function
Fixing bugs
Coding review
“If it stinks, change it”
Long Method
Large Class
Long Parameter List
Divergent Change
Shotgun Surgery
Data Clumps
Feature Envy
Primitive Obsession
Switch Statements
Parallel Inheritance HierarchiesSpeculative Generality
Temporary Field
Message Chains
Middle manInappropriate IntimacyIncomplete Library Class
Data ClassRefuse Bequest
Comment
Duplicated Code
Demo
–Kent Beck
“I’m not a great programmer, I’m just a good programmer with great habits.”