-
Recent Posts
Recent Comments
- gunasekaran sambandhan on PTOM: The Decorator Pattern
- NK Sharma on Refactoring Day 3 : Pull Up Method
- Efim Zabarsky on 31 Days of Refactoring
- Slawek Ludwiczak on Refactoring Day 8 : Replace Inheritance with Delegation
- Maxi on Refactoring Day 13 : Extract Method Object
Archives
Categories
Meta
Author Archives:
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
Refactoring Day 12 : Break Dependencies
Today’s refactoring is useful if you are trying to introduce unit tests into your code base as testing “seams” are needed to properly mock/isolate areas you don’t wish to test. In this example we have client code that is using … Continue reading
Posted in Uncategorized
4 Comments
Refactoring Day 11 : Switch to Strategy
Todays refactoring doesn’t come from any one source, rather I’ve used different versions over the years and I’m sure other have different variations of the same aim. This refactoring is used when you have a larger switch statement that continually … Continue reading
Posted in Uncategorized
5 Comments
Refactoring Day 10 : Extract Method
Today we look at the Extract Method refactoring. This is an extremely easy refactoring with several benefits. First, it helps to make code more readable by placing logic behind descriptive method names. This reduces the amount of investigation the next … Continue reading
Posted in Uncategorized
4 Comments
Refactoring Day 9 : Extract Interface
Today we look at an often overlooked refactoring. Extract Interface. When you notice more than one class using a similar subset of methods on a class, it is useful to break the dependency and introduce an interface that the consumers … Continue reading
Posted in Uncategorized
1 Comment
