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

14
votes
7answers
921 views

Should I change author name in class file if I make more than 80% changes?

I am refactoring existing set of java test classes for automated UI tests. At times I end up in making massive changes in class file or completely revamping it. This makes me think that when I am ...
8
votes
7answers
459 views

Refactoring While Programming

When posed with a problem, particularly when it is complicated in nature, I try to take some time to think about the approach I am going to take to solve the problem. Despite this, what often happens ...
6
votes
1answer
343 views

General approach to re-factoring an large, very badly written legacy system [duplicate]

Possible Duplicate: Techniques to re-factor garbage and maintain sanity? What is a good way to refactor a large, terribly written code base by myself? Really open question here. I'm not ...
0
votes
2answers
207 views

How often do you refactor or restructure your code in long term projects? [duplicate]

As developers we are always eager to learn new things and better ourselves at what we do. You've all had moments when you look at your old code and get that feeling: "WTH, I can't believe I used ...
11
votes
4answers
412 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 ...
9
votes
7answers
956 views

Should I be bothered if my LOC/day ratio is too high?

I'm currently working on an indie project, so I don't exactly have the luxury of throughout human testing or external code review — however, I don't see any difficult bugs in my current code (I fix ...
8
votes
3answers
607 views

What would help when refactoring a large method to ensure that I don't break anything?

I'm currently refactoring a part of a large codebase with no unit tests whatsoever. I tried to refactor code the brute way, i.e. by trying to guess what the code is doing and what changes wouldn't ...
6
votes
2answers
449 views

When is it inappropriate to make objects immutable?

I have a class which represents an entity object in our system (for sake of argument, a Customer object) public class Customer() { private int id; private String name; ... // 30+ fields ...
5
votes
1answer
705 views

How to unit test large legacy systems? [duplicate]

Possible Duplicate: Best practices for retrofitting legacy code with automated tests When working in large legacy systems (large systems with no unit testing ever) I often come across ...
5
votes
4answers
194 views

What are some common algorithm optimization opportunities - mathematical or otherwise

What are some common algorithmic optimization opportunities that everyone should be aware of? I have recently be revising/reviewing some code from an application, and noticed that it appeared to be ...
3
votes
1answer
251 views

Object Calisthenics - reducing to two attributes

I'm refactoring an expense tracker system using Object Calisthenics. I'm able to bring my Class down to five attributes. How do I go forward from here? This is my class right now. public class ...
3
votes
4answers
1k views

Get rid of long/Complex if..else statements using Chain of Responsibility?

I've an HttpHandler, which allows users to login to a system by passing in an encrypted code. Inside the ProcessRequest it performs quite a few steps. Retrieve the encrypted code from request ...
2
votes
2answers
641 views

How Visual Studio could help to avoid duplicating code?

I work within a team of developers. Everyone is making their changes without carrying too much if the same thing is already implemented in the codebase. This leads to classes constantly growing and to ...
2
votes
2answers
1k views

What is the best way to work with DAL and BLL?

I'm currently refactoring my DLL and BLL and I need some advice on what is the best way to work with DAL and BLL. My current solution is like this: // DAL class only consists of SQL queries and ...
12
votes
5answers
604 views

How does one determine whether or not to rewrite poorly-designed code? [duplicate]

Possible Duplicate: When is a BIG Rewrite the answer? I'm on a small team that's been handed a poorly-written, half-finished 2D Java game. Our objective is to do as much as we can to make ...
8
votes
2answers
679 views

Refactoring several huge C++ classes / methods. How to start? [duplicate]

Possible Duplicate: I’ve inherited 200K lines of spaghetti code — what now? I'm dealing with legacy code. It contains some BIG classes (line count 8000+) and some BIG methods (line count ...
4
votes
4answers
304 views

How to avoid excessive method overloading?

We have quite a lot of places in the source code of our application , where one class has many methods with same names and different parameters. Those methods always have all the parameters of a ...
3
votes
3answers
627 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? ...
2
votes
5answers
444 views

DRY code, DRY tests?

At some point I had to create some class "Class1" and that class needs a method "method". So I have the following: Class1MethodTest: A total of N tests that check the behavior of Class1.method Class1 ...
2
votes
5answers
306 views

how to evaluate own project

I am working on a open source project in pure C, that I have started some time ago, but only recently found time to add some features. I can clearly some weaknesses of my old design, so I am trying to ...