ݺߣ

ݺߣShare a Scribd company logo
Code Smells and Refactoring
stanly@odd-e.com
@stanlylau
Stanly Lau
Lives in Singapore
Software development coach / mentor
Lead Agile Singapore community
Im Stanly
? Lives in Singapore
? Agile coach, SW developer
? Worked in small to large companies
? Experienced in Insurance, Mobile Safety, Education, Logistics and Banking
? Java, .Net, JavaScript, Objective-C
Im Stanly
? Lives in Singapore
? Agile coach, SW developer
? Worked in small to large companies
? Experienced in Insurance, Mobile Safety, Education, Logistics and Banking
? Java, .Net, JavaScript, Objective-C
Agile Singapore 2016 Conference
https://www.facebook.com/AgileSingapore
Martin Fowler
Author of Refactoring, Enterprise
Architecture Patterns and more
https://www.facebook.com/AgileSingapore
Software maintainability
http://www.marketing?repower.info/the-mine?eld-you-didnt-know-you-were-in
Seeing system dynamics:
Casual Loop Diagram
bank
balance
earned
interest
Reinforcing loop
feature
velocity
#defects
Balancing loop
The nature of software
development
Learning this nature and dealing with it helps
to increase ?exibility.
amount of
bad code
# bugs
time spent
on ?xing
bugs
panicquick hacks
motivation of
developers
refactoring
amount of
code smells
indicates
opportunity for
What is Code Smell?
a code smell is a surface indication that usually
corresponds to a deeper problem in the system

Martin Fowler
Duplicated Code
Magic Number
Feature Envy
Primitive Obsession
Long Method
Comments
What is Refactoring?
is a disciplined technique for restructuring an existing body
of code, altering its internal structure without changing its
external behavior. 

Martin Fowler
Extract Local
Variable
Extract Class
Introduce Local
Variable
Rename
Move Method
Extract Method
Demo
Some Recommended Readings
Thank you
stanly@odd-e.com

More Related Content

Code Smells and Refactoring

  • 1. Code Smells and Refactoring stanly@odd-e.com @stanlylau
  • 2. Stanly Lau Lives in Singapore Software development coach / mentor Lead Agile Singapore community
  • 3. Im Stanly ? Lives in Singapore ? Agile coach, SW developer ? Worked in small to large companies ? Experienced in Insurance, Mobile Safety, Education, Logistics and Banking ? Java, .Net, JavaScript, Objective-C
  • 4. Im Stanly ? Lives in Singapore ? Agile coach, SW developer ? Worked in small to large companies ? Experienced in Insurance, Mobile Safety, Education, Logistics and Banking ? Java, .Net, JavaScript, Objective-C Agile Singapore 2016 Conference https://www.facebook.com/AgileSingapore
  • 5. Martin Fowler Author of Refactoring, Enterprise Architecture Patterns and more https://www.facebook.com/AgileSingapore
  • 7. Seeing system dynamics: Casual Loop Diagram bank balance earned interest Reinforcing loop feature velocity #defects Balancing loop
  • 8. The nature of software development Learning this nature and dealing with it helps to increase ?exibility. amount of bad code # bugs time spent on ?xing bugs panicquick hacks motivation of developers refactoring amount of code smells indicates opportunity for
  • 9. What is Code Smell? a code smell is a surface indication that usually corresponds to a deeper problem in the system Martin Fowler Duplicated Code Magic Number Feature Envy Primitive Obsession Long Method Comments
  • 10. What is Refactoring? is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. Martin Fowler Extract Local Variable Extract Class Introduce Local Variable Rename Move Method Extract Method
  • 11. Demo