Going Backwards to Go Forwards

I worked on an interesting problem this week that might have looked like I was running around in circles if you just looked at my SVN commits. The problem, and the eventual solution, reminded me of an important part of software development—of building anything really. Sometimes you must tear it down! No really, sometimes you build a structure only to …

Types of Duplication in Code

One of the biggest reasons to refactor code is to eliminate duplication.  It is pretty easy to introduce duplication in our code either unintentionally or because we don’t know how to prevent or get rid of it. The three types of duplication I’ve found that there are three basic types of duplication that we can eliminate from our code that …

Small Refactorings are OK

Many programmers seems to get caught up on the idea of refactoring. Most of us are familiar with the Boy Scout rule which says: Always leave code better than when you found it But do you actually apply it in your day to day work? I’ve found that for myself the answer to this question is sometimes “no.” Why we …

Refactoring Switches to Classes

I’ve talked about refactoring switch statements several times before. Switch is Just a Fancy If Else Pulling out the Switch: It’s Time for a Whooping Refactoring Switches Advanced I’ve even created a defaultable dictionary for refactoring a switch statement into a dictionary of actions. This time, I am going to talk about refactoring switches when you have switch statements operating …

Explaining What Action And Func Are

In C#, Action and Func are extremely useful tools for reducing duplication in code and decreasing coupling. It is a shame that many developers shy away from them because they don’t really understand them. Adding Action and Func to your toolbox is a very important step in improving your C# code. It’s not really that hard to understand what they …

gump.jpg

Clean Code, Saves Money or Is Art?

Lately there has been a lot of chatter about whether writing clean code actually saves money or whether it is more about art, i.e. making things pretty. (See John MacIntyre’s post here if you are interested, and Uncle Bob’s response here.) Well, as Forest Gump would say,  “Maybe it’s both.” How can it be both? I think overall writing clean …