How often should you refactor?

Just like you said: refactor early, refactor often. Refactoring early means the necessary changes are still fresh on my mind. Refactoring often means the changes tend to be smaller. Delaying refactoring only ends up making a big mess which further makes it harder to refactor. Cleaning up as soon as I notice the mess prevents … Read more

What is refactoring and what is only modifying code?

Martin Fowler’s “Refactoring: Improving the Design of Existing Code” is perhaps THE reference: Refactoring is a controlled technique for improving the design of an existing code base. Its essence is applying a series of small behavior-preserving transformations, each of which “too small to be worth doing”. However the cumulative effect of each of these transformations … Read more

What’s the best way to refactor a method that has too many (6+) parameters?

I’m going to assume you mean C#. Some of these things apply to other languages, too. You have several options: switch from constructor to property setters. This can make code more readable, because it’s obvious to the reader which value corresponds to which parameters. Object Initializer syntax makes this look nice. It’s also simple to … Read more

error code: 521