Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.
3
votes
0answers
68 views
Designing and refactoring of payment logic
Im currently working on an application that helps users to coordinate dinner clubs and all related accounting. (A dinner club is where people in a group, take turns to cook for the rest and then you ...
15
votes
7answers
926 views
To rewrite or slowly refactor old C++ project
Our team has recently inherited a relatively large project from another company (~250k lines). It was developed using C++Builder and we intend to port the Ui side to Qt. Most of the Ui code is ...
0
votes
2answers
310 views
Refactorable God v.s. too many classe [duplicate]
So I have this problem: in order to structure my code hierarchically, for every new tiny thing, I create a separate sub-folder, file, class ... and in it one 10-line function. It is an anti-pattern.
...
1
vote
4answers
147 views
Until what point should I refactor? [duplicate]
What do you think until what point should a programmer refactor the code?
Basically having
def method
do_something
end
Pieces of code would be handy, but they increase spaghetti code until the ...
2
votes
1answer
139 views
Why does the tool offer to change the code - just because it can?
Resharper (or is it Visual Studio - it's a yellow light bulb with a tiny red filament in it) offers to "invert if" on this code:
if (tItems >= 0)
{
return tItems;
}
SetTotalItemsAndTotalAmt();
...
-1
votes
1answer
171 views
Is there a tool that visually represents all the potential paths to a particular piece of code? [closed]
As an example of what I need and why I want it, I am trying to determine how a certain value (CurTotal) is getting set (wrongly). I've come up with these notes to myself to try to understand just what ...
2
votes
4answers
317 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 ...
4
votes
3answers
436 views
Is there a term for reusing code by retyping it?
I built a prototype ("one to throw away") a while ago, and I'm rebuilding it now as an alpha. My goodness, it's been worth it.
I reused some of the prototype code by copy-pasting then modifying it, ...
2
votes
1answer
87 views
What to name a new interface that is replacing an existing one?
We're redesigning our application's plugin interface, so we're using the Adapter pattern with our proof-of-concept design to show that the new interface will function without committing to using it in ...
8
votes
6answers
371 views
Is it better to have one method that takes a bool as a parameter or two methods with different names? [duplicate]
I'm writing a factory class for a Selenium Web Driver and I came across a choice that I couldn't figure out which is cleaner. Having two methods with the same parameter.
GetWebDriver(string browser)
...
2
votes
2answers
287 views
Refactored to a fancy global variable?
I am currently refactoring an application that i built in JavaScript.
The application uses a starting hour and a total working hour count in order to construct a timetable for daily, weekly and ...
3
votes
1answer
136 views
When to fracture a web application design into multiple products
Have you had this problem?
You are building a complex web application for a target market, and after a while you reach a point in complexity where you can't decide if you are building more than one ...
8
votes
3answers
273 views
I have to compromise: DRY, or Command-Query-Separation?
I was recently refactoring a method that was both a command and a query method.
After separating it into a one command method and one query method, I found that there are now multiple places in the ...
4
votes
2answers
129 views
How do you create documentation when there is none? [duplicate]
I have recently inherited a large, legacy system with a complex codebase that has a lack of documentation. I'm the sole internal developer embedded with the core users, taking some responsibility from ...
1
vote
1answer
166 views
Refactoring the shipping application code to use DDD factories
I was trying to find examples for using DDD factories and I came across the shipping application from Eric Evans' book.
However when I checked the BookingService the code to create a Cargo had this ...