Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.
0
votes
1answer
51 views
How to 'convert' a Static Access style project to IoC/DI style?
Are there any best approaches for refactoring a programming project that has previously been written with the static reference anti-pattern (the majority of classes refer at some point to a static ...
3
votes
2answers
447 views
How many regression bugs from refactoring is too many.
Recent QA testing has found some regression bugs in our code. My team lead blames recent refactoring efforts for the regressions.
My team lead's stance is "refactor, but don't break too many things", ...
0
votes
0answers
58 views
Patterns for refactoring
I have a existing legacy library which has multiple helper classes. For example Helper1, Helper2. They are not well organized. I want provide an easy to use interface like this:
...
2
votes
1answer
106 views
Agile: When to re-factor and when to extend while accruing technical debt? [duplicate]
Consider the following scenario.
You currently have a feature set A you wish to extend to include feature set B. In the near feature there's a high possibility that you wish to extend this even ...
2
votes
3answers
140 views
Evaluating the complete revision of other's software
I'm having some difficulty to evaluate the revision of a software: the software was paid by customer years ago, never used, and now the customer have noticed that it doesn't work as expected.
Now ...
5
votes
2answers
331 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
4answers
402 views
Hating your own code - for good or bad, how do you deal with it? [closed]
Have you ever had this feeling that your code is bad, the whole project is a mess, and you just want to step off? On your daily job you can explain this feeling away with your coworkers, asshole boss, ...
1
vote
0answers
89 views
Refactoring expansive message architecture
I am currently working with a system that acts like a message bus. A message comes in to the service (WCF Windows Service hosted). The system then uses a service locator pattern to look up which ...
6
votes
3answers
177 views
Should a new class refactored out of an existing one have history pointing back to it's progenitor
If I split one class into two classes should both classes have history in source control tracing back to the original class that contained both; or should the new class be added as a new file without ...
39
votes
10answers
2k views
Is it a good idea to schedule regular time to clean up code? [closed]
I'm managing a small team of developers. Every so often we decide we're going to spend a day or two to clean up our code.
Would it be a good idea to schedule regular time, say 1 week every 2 months, ...
4
votes
2answers
428 views
How do I handle having so many SQL queries?
I have an MVC3 project that uses SQL Server.
I use data from the SQL database all the time and I often find that I'm reusing/duplicating some SQL queries. I thought I'd solve this problem by creating ...
4
votes
3answers
185 views
Using the mouse as a multi-tool creates heavy conditional logic for executing commands, how do I change this?
The feature is in many different types of editing programs where a mouse click may have completely different commands to execute (using the Command Pattern)
Currently I have an overarching ...
3
votes
7answers
250 views
Naming guard clauses that throw exceptions
I have a function evaluate() that parses a String for some variables and replaces them with their corresponding value:
public String evaluate() {
String result = templateText;
for ...
4
votes
2answers
324 views
Is it possible to avoid enormously big switch in that case? [duplicate]
I'm writing a simple chess-related code with intention to write it clearly (performance doesn't matter at all). And this method I have doesn't look clean to me at all:
public static Piece ...
5
votes
2answers
169 views
How to do unit tests on a method that takes the elapsed time into account?
I'm currently in the middle of refactoring an important method in a legacy-system. There were almost zero test until I've started working on it, and I've added quite a lot to ensure the correct work ...