Los Techies : Blogs about software and anything tech!

31 Days of Refactoring


Refactoring is an integral part of continually improving your code while it moves forward through time. Without refactoring you accrue technical debt, forget what portions of code do and create code that is resistant to any form of testing. It is an easy concept to get started with and opens the door to much better practices such as unit testing, shared code ownership and more reliable, bug-free code in general.

Because of the importance of refactoring, throughout the month of August I will be describing one refactoring a day for the 31 days of August. Before I begin, let me prefix this series with the fact that I am not claiming ownership of the refactorings I will describe, although I will try to bring some additional description and perhaps some discussion around each. I have chosen not to list the full set of refactorings on this first post until I actually post the refactoring. So as the month progresses I will update this post with links to each of the refactorings.

First on the list is credit where it is due. The majority of these refactorings can be found Refactoring.com, some are from Code Complete 2nd Edition and others are refactorings that I find myself doing often and from various other places on the interwebs. I don’t think its important to note on each refactoring where it came from, as you can find refactorings of similar names found on various blogs and articles online.

On that note, I will be publishing the first post starting tomorrow that begins the 31 day marathon of various refactorings. I hope you all enjoy and learn something from the refactorings!

 

  1. Refactoring Day 1 : Encapsulate Collection
  2. Refactoring Day 2 : Move Method
  3. Refactoring Day 3 : Pull Up Method
  4. Refactoring Day 4 : Push Down Method
  5. Refactoring Day 5 : Pull Up Field
  6. Refactoring Day 6 : Push Down Field
  7. Refactoring Day 7 : Rename (method, class, parameter)
  8. Refactoring Day 8 : Replace Inheritance with Delegation
  9. Refactoring Day 9 : Extract Interface
  10. Refactoring Day 10 : Extract Method
  11. Refactoring Day 11 : Switch to Strategy
  12. Refactoring Day 12 : Break Dependencies
  13. Refactoring Day 13 : Extract Method Object
  14. Refactoring Day 14 : Break Responsibilities
  15. Refactoring Day 15 : Remove Duplication
  16. Refactoring Day 16 : Encapsulate Conditional
  17. Refactoring Day 17 : Extract Superclass
  18. Refactoring Day 18 : Replace exception with conditional
  19. Refactoring Day 19 : Extract Factory Class
  20. Refactoring Day 20 : Extract Subclass
  21. Refactoring Day 21 : Collapse Hierarchy
  22. Refactoring Day 22 : Break Method
  23. Refactoring Day 23 : Introduce Parameter Object
  24. Refactoring Day 24 : Remove Arrowhead Antipattern
  25. Refactoring Day 25 : Introduce Design By Contract Checks
  26. Refactoring Day 26 : Remove Double Negative
  27. Refactoring Day 27 : Remove God Classes
  28. Refactoring Day 28 : Rename boolean methods
  29. Refactoring Day 29 : Remove Middle Man
  30. Refactoring Day 30 : Return ASAP
  31. Refactoring Day 31 : Replace Conditional with Polymorphism
Kick It on DotNetKicks.com
Posted Jul 31 2009, 08:52 AM by schambers

Comments

Random Links #22 | YASDW - yet another software developer weblog wrote Random Links #22 | YASDW - yet another software developer weblog
on 07-31-2009 10:46 AM

Pingback from  Random Links #22 | YASDW - yet another software developer weblog

Weekly Links #64 | GrantPalin.com wrote Weekly Links #64 | GrantPalin.com
on 08-02-2009 9:02 PM

Pingback from  Weekly Links #64 | GrantPalin.com

Reflective Perspective - Chris Alcock » The Morning Brew #403 wrote Reflective Perspective - Chris Alcock » The Morning Brew #403
on 08-03-2009 5:11 AM

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #403

DotNetKicks.com wrote 31 Days of Refactoring
on 08-03-2009 10:26 AM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

What is Code Quality? | Wizards of Smart wrote What is Code Quality? | Wizards of Smart
on 08-04-2009 10:10 AM

Pingback from  What is Code Quality? | Wizards of Smart

Summary 05.08.2009 « Bogdan Brinzarea’s blog wrote Summary 05.08.2009 « Bogdan Brinzarea’s blog
on 08-05-2009 10:31 AM

Pingback from  Summary 05.08.2009 «  Bogdan Brinzarea’s blog

ComponentGear.com Feed wrote This Week C9: Win7 on MSDN, PDC 2009, Drunktender
on 08-07-2009 2:28 PM

This week on C9, Brian and Christian "Littleguru" Liensberger review the week's top developer

Sean Chambers wrote 31 Days of Refactoring Series complete!
on 08-31-2009 1:34 PM

Well, we have come to the end of the series. I hope everyone has found some value in the series. Some

Chad Myers' Blog wrote Is Blogging Dead?
on 08-31-2009 9:54 PM

The other day I was at lunch with some folks (I won’t name drop except to give credit for the person

mpeterson wrote re: 31 Days of Refactoring
on 08-31-2009 11:06 PM

Nice series... thanks for posting!

Lucho wrote re: 31 Days of Refactoring
on 09-01-2009 8:03 AM

Nice posts!, I enjoyed following them

Thanks!

Sean Chambers wrote 31 Days of Refactoring eBook
on 10-20-2009 7:34 PM

Back in August I did the 31 Days of Refactoring blog series. Fellow LosTechies as well as other community

CodeClimber wrote 31 Days of Refactoring eBook
on 10-22-2009 3:50 AM

31 Days of Refactoring eBook

Refactoring with the Decorator Pattern | Wizards of Smart wrote Refactoring with the Decorator Pattern | Wizards of Smart
on 10-24-2009 1:39 PM

Pingback from  Refactoring with the Decorator Pattern | Wizards of Smart

jaxosu wrote re: 31 Days of Refactoring
on 10-25-2009 2:42 AM

va6VY6  <a href="hjchdcyfefdr.com/.../a>, [url=http://amyuiyrumjzr.com/]amyuiyrumjzr[/url], [link=http://wuexnxdgssfb.com/]wuexnxdgssfb[/link], http://qfvfpecptszm.com/

wnjmsaykwpc wrote re: 31 Days of Refactoring
on 10-25-2009 3:19 AM

DyA7Qd  <a href="jifjecentyqh.com/.../a>, [url=http://obykyxqfpryu.com/]obykyxqfpryu[/url], [link=http://txhucyswhako.com/]txhucyswhako[/link], http://hpzxvqrcedqp.com/

张逸 wrote 31天速成重构
on 10-28-2009 5:35 AM

当我看到什么速成或者多少天学会某种技术时,我泰半会采取怀疑的态度。这属于典型的标题党。那么,重构能够在31天速成吗?能,前提作为读者的你必须具备非常扎实的设计技能,以及丰富的项目经验。如果真是这样的读...

李飞 wrote re: 31 Days of Refactoring
on 10-28-2009 5:47 AM

E文的,能不能翻译下啊

31 Days of Refactoring « Vincent Leung's .NET Tech Clips wrote 31 Days of Refactoring &laquo; Vincent Leung&#039;s .NET Tech Clips
on 10-28-2009 9:28 AM

Pingback from  31 Days of Refactoring « Vincent Leung's .NET Tech Clips

alexliu wrote re: 31 Days of Refactoring
on 10-29-2009 10:34 PM

hi schambers ,

Can I translate your perfect article to Chinese and post it on my blog share with a lot of dotNet friends?

Regards,

Alex.

rainspt@hotmail.com

tramadol wrote re: 31 Days of Refactoring
on 12-21-2009 3:57 AM

Hello!

<a href="blogs.emantra.com.au/.../CHEAPTRAMADOL377.aspx">does tramadol cause high blood pressure</a> ,

viagra wrote re: 31 Days of Refactoring
on 12-24-2009 8:11 PM

Hello!

<a href="twentyounce.com/.../a> ,

viagra wrote re: 31 Days of Refactoring
on 12-26-2009 2:33 AM
cialis wrote re: 31 Days of Refactoring
on 12-28-2009 10:29 PM
generic_viagra wrote re: 31 Days of Refactoring
on 01-03-2010 7:52 PM
cialis wrote re: 31 Days of Refactoring
on 01-03-2010 11:05 PM

Hello!

<a href="kingofthemountainelectronics.com/.../a> , <a href="kingofthemountainelectronics.com/viagra.html">generic viagra</a> , <a href="citasmx.com/.../a> , <a href="citasmx.com/cialis.html">cialis experience</a> , <a href=""></a> ,

cialis wrote re: 31 Days of Refactoring
on 01-07-2010 1:53 AM
viagra wrote re: 31 Days of Refactoring
on 01-09-2010 8:05 AM

Hello!

<a href="vote4alonghorn.com/.../a> ,

viagra wrote re: 31 Days of Refactoring
on 01-15-2010 4:51 AM
cialis wrote re: 31 Days of Refactoring
on 01-16-2010 2:56 AM
phentermine wrote re: 31 Days of Refactoring
on 01-16-2010 11:42 AM
viagra wrote re: 31 Days of Refactoring
on 01-16-2010 6:36 PM
cialis wrote re: 31 Days of Refactoring
on 01-16-2010 8:00 PM

Hello!

<a href="abstractzen.org/.../a> ,

viagra wrote re: 31 Days of Refactoring
on 01-17-2010 3:46 AM
xanax wrote re: 31 Days of Refactoring
on 01-18-2010 12:13 AM
viagra wrote re: 31 Days of Refactoring
on 01-18-2010 4:40 AM
xanax wrote re: 31 Days of Refactoring
on 01-18-2010 4:47 AM
viagra wrote re: 31 Days of Refactoring
on 01-18-2010 6:27 AM

Hello!

<a href="www.webjam.com/.../a> , <a href="www.webjam.com/ordercialis1">buy cialis</a> , <a href="community.cmefcu.org/.../a> , <a href="www.webjam.com/ordertramadol1">buy tramadol</a> , <a href="wiki.openqa.org/.../a> ,

cialis wrote re: 31 Days of Refactoring
on 01-18-2010 10:21 AM
viagra wrote re: 31 Days of Refactoring
on 01-18-2010 11:05 PM
cialis wrote re: 31 Days of Refactoring
on 01-18-2010 11:19 PM
xanax wrote re: 31 Days of Refactoring
on 01-19-2010 3:23 PM
viagra wrote re: 31 Days of Refactoring
on 01-19-2010 9:57 PM
phentermine wrote re: 31 Days of Refactoring
on 01-20-2010 1:30 AM

Hello!

<a href="vampirefreaks.com/.../a> ,

codeSMART wrote 31 Days of Refactoring on LosTechies
on 01-20-2010 6:03 PM

31 Days of Refactoring on LosTechies

phentermine wrote re: 31 Days of Refactoring
on 01-21-2010 4:49 PM
cialis wrote re: 31 Days of Refactoring
on 01-21-2010 5:35 PM
tramadol wrote re: 31 Days of Refactoring
on 01-22-2010 1:20 PM

Hello!

<a href="www.freerepublic.com/.../a> ,

cialis wrote re: 31 Days of Refactoring
on 01-22-2010 9:58 PM
Herding Code 70: Sean Chambers on Migrations in .NET | Herding Code wrote Herding Code 70: Sean Chambers on Migrations in .NET | Herding Code
on 01-25-2010 2:06 AM

Pingback from  Herding Code 70: Sean Chambers on Migrations in .NET | Herding Code

cialis wrote re: 31 Days of Refactoring
on 01-25-2010 7:27 PM

Hello!

<a href="vfwpost9981.org/.../a> ,

phentermine wrote re: 31 Days of Refactoring
on 01-30-2010 4:22 PM
cialis wrote re: 31 Days of Refactoring
on 01-31-2010 4:14 PM

Hello!

<a href="thinkchris.net/.../a> , <a href="yplusy.com/">motorcycle accesories</a> , <a href="portageport.com/.../a> , <a href="fosamax.org/cialis.html">buy cialis</a> , <a href="portageport.com/.../a> ,

tramadol wrote re: 31 Days of Refactoring
on 02-01-2010 3:32 AM
phentermine wrote re: 31 Days of Refactoring
on 02-01-2010 5:01 AM
tramadol wrote re: 31 Days of Refactoring
on 02-01-2010 11:32 PM
viagra wrote re: 31 Days of Refactoring
on 02-13-2010 12:06 PM
viagra wrote re: 31 Days of Refactoring
on 02-13-2010 12:14 PM
viagra wrote re: 31 Days of Refactoring
on 02-13-2010 12:14 PM

Hello!

<a href="iconicconcepts.com/.../a> , <a href="my-cons.com/.../a> , <a href="jmpapn.org/">viagra online</a> , <a href="o2hphoto.com/.../a> , <a href="lowcountrycwrt.org/.../a> ,

tramadol wrote re: 31 Days of Refactoring
on 02-13-2010 12:15 PM
viagra wrote re: 31 Days of Refactoring
on 02-13-2010 12:24 PM
Markus Tamm » Blog Archive » Links 21.02.2010 wrote Markus Tamm &raquo; Blog Archive &raquo; Links 21.02.2010
on 02-21-2010 1:55 PM

Pingback from  Markus Tamm  » Blog Archive   » Links 21.02.2010

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

Enter the numbers above:
Copyright Los Techies 2008, 2009. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems