Quality Coding
Shares

Refactoring Demo: Is It More than Just Changing Stuff?

Shares

Refactoring. It’s a word I hear quite a bit. Usually, in the context of conversations with management, it means, “Rewriting that thing. Hopefully without introducing bugs.” Often, among developers, it means, “One of the options in the Refactoring menu in my IDE.”

Inigo Montoya meme: "Refactoring, you keep using that word. I do not think it means what you think it means."

Tools vs. discipline

A tool is not the same thing as a discipline. For example, Jenkins is not Continuous Integration. And just because you’re using Jenkins doesn’t mean you’re practicing CI. You may only be doing “CI Theatre“.

I’m afraid the same is true of refactoring. Just because you use a menu item doesn’t mean you’re refactoring. You may only be doing Refactoring Theatre.

Screencast demo

So here’s a new 12-minute screencast in which I demonstrate refactoring. In my TDD sample app, I want to move a line of code into a class which doesn’t yet exist. Whenever I run unit tests, I call it out with a “ding” sound effect, and a text overlay in the upper-right corner. Watch how many times I run my unit tests, and how often.

I hope my use of AppCode, and calling out the shortcuts I use, doesn’t detract from my message. I’m a big believer in having good tools and using them well. For me, that means I prefer AppCode, which is a keyboard-centric IDE. Despite the shortcuts I use in Xcode, it remains largely mouse-centric.

My goal in this screencast is to pretend that we’re pair programming. That way you can see not just the end result, but the steps I take, and how.

Do you have the Refactoring book?

The Refactoring book completely changed the way I code. Don’t delay: Buy yourself a copy today!

Disclosure: Please note that these book links are affiliate links. If you buy anything, I earn a commission, at no extra cost to you. I recommend only books that have had a positive impact on me.

Have you seen this kind of refactoring in your workplace? Please share your experiences in the comments below.

About the Author Jon Reid

Jon is a coach and consultant on iOS Clean Code (Test Driven Development, unit testing, refactoring, design). He's been practicing TDD since 2001. You can learn more about his background, or see what services he can bring to your organization.

follow me on:

Leave a Comment:

5 comments
Add Your Reply