+ All Categories
Home > Technology > Refactoring

Refactoring

Date post: 15-Jan-2015
Category:
Upload: naresh-jain
View: 2,267 times
Download: 2 times
Share this document with a friend
Description:
Chirag and Aman\'s Refactoring workshop at Agile Mumbai 2008 conference
Popular Tags:
44
Refactoring Aman & Chirag ThoughtWorks Pune
Transcript
Page 1: Refactoring

Refactoring

Aman & Chirag

ThoughtWorks Pune

Page 2: Refactoring

If it ain’t broken, why fix it?

Page 3: Refactoring

Good programmers write code that humans can understand

Page 4: Refactoring

You write code once;it gets read many times

Page 5: Refactoring

To regain control on a program that is getting out of hands

Page 6: Refactoring

To make the next change easier

Page 7: Refactoring

This brings us to Refactoring

Page 8: Refactoring

Refactoring in Action

Page 9: Refactoring

Code Smells

Page 10: Refactoring

Duplicated Code

Page 11: Refactoring

Long Method

Page 12: Refactoring

Comments

Page 13: Refactoring

Divergent Change

Page 14: Refactoring

Shotgun Surgery

Page 15: Refactoring

Feature Envy

Page 16: Refactoring

Lazy Class

Page 17: Refactoring

Switch Statements

Page 18: Refactoring

Primitive Obsession

Page 19: Refactoring

Method Chains

Page 20: Refactoring

Refactoring Catalog

Page 21: Refactoring

Refactoring Catalog

Composing methods

Page 22: Refactoring

Source: refactoring.com

Page 23: Refactoring

Source: refactoring.com

Page 24: Refactoring

Source: refactoring.com

Page 25: Refactoring

Source: refactoring.com

Page 26: Refactoring

Source: refactoring.com

Page 27: Refactoring

Source: refactoring.com

Page 28: Refactoring

Refactoring Catalog

Simplifying Conditional Expressions

Page 29: Refactoring

Source: refactoring.com

Page 30: Refactoring

Source: refactoring.com

Page 31: Refactoring

Source: refactoring.com

Page 32: Refactoring

Source: refactoring.com

Page 33: Refactoring

Source: refactoring.com

Page 34: Refactoring

Source: refactoring.com

Page 35: Refactoring

Source: refactoring.com

Page 36: Refactoring

Refactoring Catalog

Making Method Calls Simpler

Page 37: Refactoring

Source: refactoring.com

Page 38: Refactoring

Source: refactoring.com

Page 39: Refactoring

Source: refactoring.com

Page 40: Refactoring

Source: refactoring.com

Page 41: Refactoring

Accompanying XP Practices

• TDD : “Red - Green - Refactor” mantra

• Continuous Integration

• Collective Code Ownership

• Pair Programming

Page 42: Refactoring

Next steps for you

• Go read the book!!!

• Practice small refactorings– Explore the “Refactor” menu of your IDE

• Keep a look out for code smells in your project

Page 43: Refactoring

To sum it up…

• Refactoring is a good technique to clean up code

• Refactoring leads to better design (especially with Test-Code-Refactor cycles)

• Most important of all: it leaves a nice feeling at the end of it all!

Page 44: Refactoring

Thank You

• Aman King– [email protected]

• Chirag Doshi– [email protected]


Recommended