One more thing: Refactoring

189 views
Skip to first unread message

Philip Markgraf

unread,
Jul 3, 2013, 4:03:13 PM7/3/13
to clean-code...@googlegroups.com
One closely related topic to TDD that I think is all to often neglected is Refactoring.

It is a funny thing, everyone seems to THINK they know how to refactor, but I see so few that are actually good at it. The topic just intuitively sounds simple, but developing the discipline to evolve and clean code in small steps is apparently counterintuitive. I can't count how many times I've had someone tell me they are refactoring some code and a few more questions uncovers that their so-called refactoring attempt is a day-and-a-half along with the code in a horribly disrupted state with no end in sight.

Now, it may be that this kind of failing is isolated to my field. (My team writes C++ embedded systems code for safety-critical medical devices.) The automatic refactoring tools in our world aren't half-as-cool as the stuff in Intelli-J we see in the Clean Code Videos. (We also have some environment and architecture issues that are making the build/test cycle too long, which probably contributes to the problem. Trust me, we're working to fix them.) But I think the real reason I see refactorings going astray is we are mis-applying the term "Refactoring" as a blanket for any redesign work, and I don't feel there is enough understanding of how to keep a system running when you are making changes of greater significance than doing a rename.

Are there any plans to address Refactoring as its own topic, during the Clean Code series? We see some of it taking place during the various TDD examples, but I think it warrants coverage as its own topic. I would prefer to see this content in conjunction with the other advanced TDD content, before we head off into other areas.

Thanks!
Phil

P.S. My team uses Extreme Programming to meet a lot of our regulatory required code-inspection and test requirements, which is pretty cool. And once we got the team up the learning curve (and the folks who didn't want to do XP had found gigs more to their liking), it is a very fun environment. But based on the folks we've interviewed over the years, Test Driven Development and Pair Programming is nearly unheard of in embedded systems. This just plain gives me the willies, knowing how many safety-critical software systems we all depend on. (On the other hand, if you are a C++ programmer that wants to do TDD in Southern California... I can suggest a good place to call.)

Uncle Bob

unread,
Jul 4, 2013, 9:48:39 AM7/4/13
to clean-code...@googlegroups.com
Phil,

Hmmm.  An episode (or, given recent history a series of episodes) on refactoring.  That's not a bad idea.  I do tend to breeze over the topic in my codecasts.  I'll give that some thought.  

As for C++, I'm sure you are aware of the work of James Grenning, and the wonderful book he wrote on TDD in C and C++: Test Driven Development for Embedded C.  I've been hoping that James would do a few episodes, or start his own series.  He's a busy guy, so hasn't been able to do so yet; but I'd love to see that happen.

Frédéric Bouquet

unread,
Jul 4, 2013, 12:37:50 PM7/4/13
to clean-code...@googlegroups.com
Hi,

> Hmmm. An episode (or, given recent history a series of episodes) on
> refactoring. That's not a bad idea. I do tend to breeze over the topic in
> my codecasts. I'll give that some thought.

I think two episodes would not be too much...
Before refactoring, we need full coverage of the code. The problem
with this prerequisite is that when we need refactoring, it's because
we are working on (pseudo-)legacy code that may not have been tested
yet (and in many cases, not possible to unit test it easily, or
without hundreds of mocks and with a high focus on... implementation).
I think an episode explaining good practices in such cases (test of
legacy code with an horrible architecture) would be a great idea.

WDYT ?


--
Frédéric Bouquet
Twitter/Github : bouquetf
http://www.espacedefouille.org/

Caio Fernando Bertoldi Paes de Andrade

unread,
Jul 4, 2013, 12:57:49 PM7/4/13
to clean-code...@googlegroups.com
Frédéric, you mean Working Effectively with Legacy Code? That book is amazing!

That's a bit different from Refactoring itself, but I think it's worth a series of episodes as well (maybe made by Michael Feathers?)

Cheers,
Caio

--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.



Uncle Bob

unread,
Jul 4, 2013, 2:56:01 PM7/4/13
to clean-code...@googlegroups.com
I'd love Michael Feathers to do a video series on Working Effectively with Legacy Code.  

Frédéric Bouquet

unread,
Jul 8, 2013, 9:50:00 AM7/8/13
to clean-code...@googlegroups.com
> Frédéric, you mean Working Effectively with Legacy Code? That book is
> amazing!

Yep, exactly ! :)

nicholas lemay

unread,
Jul 10, 2013, 1:19:10 PM7/10/13
to clean-code...@googlegroups.com
+1

I would definitely subscribe to such a series. 
Reply all
Reply to author
Forward
0 new messages