Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.

learn more… | top users | synonyms (1)

5
votes
3answers
1k views

.Net Best Practices : Common Bugs Introduced By Refactoring, Carelessness, and Newbies

What are the common bugs introduced by refactoring, carelessness, and newbies? I would like to request the experienced programmers here to share their experience and list the bugs they used to ...
19
votes
12answers
610 views

Refactor or Concentrate on Completing App

Would you refactor your app as you go or focus on completing app first? Refactoring will mean progress of app app will slow down. Completing app will mean you get a possibly very hard to maintain app ...
9
votes
7answers
635 views

Best supporting argument for refactoring [duplicate]

Currently I am working on a code best described as C code living in C++ body. However I haven't been able to convince power that be to re-factor on ground of ease of maintenance. What in your ...
3
votes
3answers
685 views

Refactoring code smells in ASP.NET Web Forms Code Behind Files: Is it risky? Is it wise? Is it a waste of time?

Given a long method with Pac-Man ifs, would it be wise to: Break down code blocks into regions. Then refactor code blocks into methods. Or would it be best to leave it alone? Would it be risky? ...
44
votes
21answers
6k views

How do you explain refactoring to a non-technical person?

(This question was inspired by the most-voted answer here) How do you go about explaining refactoring (and technical debt) to a non-technical person (typically a PHB or customer)? ("What, it's going ...
14
votes
11answers
428 views

Should you fix preexisting defects while working on something else?

Conundrum: During the course of working on a new feature or fixing a defect, you find a legacy problem in code. What should you do? Fix it and risk altering the behavior of the code. It has either ...
12
votes
4answers
439 views

Code duplication with no obvious abstraction

Have you ever encountered a case of code duplication where, upon looking at the lines of code, you couldn't fit a thematic abstraction to it that faithfully describes its role in the logic? And what ...
17
votes
8answers
813 views

Does anyone else have a refactoring problem? [closed]

It seems like after I've written a significant amount of code I get this anxious feeling like I haven't done it in the best possible way, and I end up continuously refactoring and spending way too ...
3
votes
1answer
181 views

FromXYZ vs Overloaded Method

I'm trying to think of the cleanest way to implement a couple of methods that open a file. Consider the following method signatures: public static DomainObject Load(Uri urlToFile) { /* downloads ...
6
votes
10answers
2k views

What are the most common ways used to migrate a Delphi application incrementally to .NET?

If you have several million lines of Delphi code and want to incrementally migrate to .NET/C#, what strategy would you use?
18
votes
1answer
881 views

How much time should I dedicate to refactoring my code? [closed]

I don't know if it's just with me, but when I start refactoring some code I waste a lot time doing that and it never ends. Every time I read the code again, I find something that can be improved, ...
11
votes
6answers
2k views

How do you keep your unit tests working when refactoring?

In another question, it was revealed that one of the pains with TDD is keeping the testing suite in sync with the codebase during and after refactoring. Now, I'm a big fan of refactoring. I'm not ...