Monthly Archives: August 2009

Refactoring Day 22 : Break Method

Today’s refactoring didn’t really come from any one source. It just named it although someone else may have something similar that’s named differently. If you know of anyone that has a name for this other than Break Method, please let … Continue reading 

Posted in Uncategorized | 2 Comments

Refactoring Day 21 : Collapse Hierarchy

Todays refactoring comes from Martin Fowlers catalog of patterns. You can find this refactoring in his catalog here Yesterday we looked at extracting a subclass for moving responsibilities down if they are not needed across the board. A Collapse Hierarchy … Continue reading 

Posted in Uncategorized | Leave a comment

Refactoring Day 20 : Extract Subclass

Todays refactoring comes from Martin Fowlers catalog of patterns. You can find this refactoring in his catalog here This refactoring is useful when you have methods on a base class that are not shared amongst all classes and needs to … Continue reading 

Posted in Uncategorized | Leave a comment

Refactoring Day 19 : Extract Factory Class

Todays refactoring was first coined by the GangOfFour and has many resources on the web that have different usages of this pattern. Two different aims of the factory pattern can be found on the GoF website here and here. Often … Continue reading 

Posted in Uncategorized | 1 Comment

Refactoring Day 18 : Replace exception with conditional

Today’s refactoring doesn’t come from any place specifically, just something I’ve picked up over time that I find myself using often. Any variations/comments would be appreciated to this approach. I think there’s some other good refactorings around these type of … Continue reading 

Posted in Uncategorized | 3 Comments

Refactoring Day 17 : Extract Superclass

Today’s refactoring is from Martin Fowler’s refactoring catalog. You can find the original description here This refactoring is used quite often when you have a number of methods that you want to “pull up” into a base class to allow … Continue reading 

Posted in Uncategorized | Leave a comment

Refactoring Day 16 : Encapsulate Conditional

Sometimes when doing a number of different checks within a conditional the intent of what you are testing for gets lost in the conditional. In these instances I like to extract the conditional into an easy to read property, or … Continue reading 

Posted in Uncategorized | Leave a comment

Refactoring Day 15 : Remove Duplication

A day late on this one. Sorry about that! This is probably one of the most used refactoring in the forms of methods that are used in more than one place. Duplication will quickly sneak up on you if you’re … Continue reading 

Posted in Uncategorized | 2 Comments

Refactoring Day 14 : Break Responsibilities

When breaking apart responsibilities on a class this is enforcing Single Responsiblity Principle from SOLID. It’s an easy approach to apply this refactoring although it’s often disputed as what consitutes a “responsibility”. While I won’t be answering that here, I … Continue reading 

Posted in Uncategorized | 5 Comments

Refactoring Day 13 : Extract Method Object

Today’s refactoring comes from Martin Fowlers list of refactorings. You can find his original article here with a brief description. This is a more infrequent refactoring that I see myself using but it comes in handy at times. When trying … Continue reading 

Posted in Uncategorized | 7 Comments