refactoring without a net

Refactoring Without A Net – Webinar Recording

What exactly is refactoring? Is it just changing code? What does “not changing functionality” really means? Well, you’ve come to the right place. I’ve got just the webinar for you. And not only that, I’m going to show you how… Continue Reading…

Gil Zilberfeld explains refactoring in legacy code, when using ApprovalTests and something unexpected happens

Refactoring Kung-Fu, Part VI

Ok, time to run the test. Well, that’s interesting. The test is not even running until the end, we’re crashing before it completes. Let’s see what’s wrong. Seems that this line breaks: List<Ingredient> fillingIngredients = new ArrayList<Ingredient>(ingredients.subList(1, ingredients.size() – 1));… Continue Reading…

Refactoring Kung-Fu, Part V

Last time we talked about flow analysis in the code. We figured out the cases we want covered. But, even for these cases, we don’t know what the expected result is. It’s worse than that in the real world. In our… Continue Reading…

Gil Zilberfeld explains about refactoring test cases in legacy code

Refactoring Kung Fu – Part IV

The current code version we’re talking about is tag 1.1. Last time, we have surrounded our code with a boundary, doing some early refactoring. We now know the entry points, and the exits are covered by interfaces, leaving code we… Continue Reading…

Gil Zilberfeld explains refactoring for legacy code, about method extraction and constructor injection for refactoring legacy code

Refactoring Kung Fu: Part III

Check out the original version of the code (Java, and also in C#, in tag 1.0). Right, time to move some code around. Before we do that, remember step #1 in our process: Draw a line around our tested code.… Continue Reading…

Gil Zilberfeld explains the principles of refactoring legacy code

Refactoring Kung Fu – Part II

Last time I gave you a sneak peak at our PastaMaker. You can check the whole project here. Let’s take a closer look. The main logic is in our PastaMaker, so focusing on testing it makes sense. Most of the… Continue Reading…

Gil Zilberfeld goes through an example of refactoring legacy code, on the way to creating tests for it

Refactoring Kung Fu – Part I

As long time readers, you know that if we’ve got legacy code, we want tests for that. However, the code doesn’t always play along. As you’ll see in this example, this is the kind of code that really needs tests.… Continue Reading…

Legacy Code To Testable Code #12: Instance Constructors

Other awesome posts in the series: So we talked about static constructors and how to go around them. How about instance constructors? Are they innocent or guilty of the same crimes as their static brothers? I think Java got the… Continue Reading…

Legacy Code to Testable Code #11: MOAR Static Constructors

The other posts in the series: Where we last left off, we discussed how to dismantle the static constructor (or initializer) booby traps. And I promised you an example. I’ll do that in C#, but the operations apply to any… Continue Reading…

Legacy Code to Testable Code #10: Getting Rid of Static Constructors

Here is the rest of the gang: This time we’re going to tackle the most problematic issue in testing object-oriented languages. Obviously because constructors only exist in those, but also, because even power tools have problems handling them. But we’ll start… Continue Reading…

Copyright Gil Zilberfeld, 2025