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

11
votes
4answers
385 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
930 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
520 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
1answer
320 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 ...
5
votes
4answers
167 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
188 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
714 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
578 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
579 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
524 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
208 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
599 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
294 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 ...