What is the best way of doing version control of large scale refactoring?
My typical style of programming (actually of writing documents as well) is getting something out as quickly as possible and then refactoring it. Typically, refactoring takes place at the same time as adding other functionality. In addition to standard refactoring ...
I have a large codebase which has suffered many changes over the years. I would like to remove the functions that are no longer called or relevant. Is there a tool that will analysis the codebase and determine if a method is ever used?
I'm also using phpunit/xdebug which reports which functions have not been run for the unit tests, how...
I am using several months ReSharper 4.5 It's very powerfull tool but use a lot of system resources and VS working very slow with it. With which tool I can replace Resharper with the same functionality. Which refactoring tool do you use?
...
I am refactoring a method which is over 500 lines (don't ask me why)
The method basically queries a list of maps from the database and for each map in the list does some computation and adds the value of that computation to the map. There are however too many computations and puts being done that the code has reached over 500 lines alr...
Similar to this question. I would like to find all commented files. But in my case /* */ is a possibility.
Apparently when you write changes to a database project, dropped objects are only commented out instead of deleting the file. I would like to remove all of these commented out files from the project.
Is is possible to find all fil...
I have two methods f(vector<int>& x, ....) and g(DBConn& x, ....)
where the (....) parameters are all identical.
The code inside the two methods are completely identical except for one statement
where we do different actions based on the type of x:
in f(): we do x.push_back(i)
in g(): we do x.DeleteRow(i)
What is the simplest way to...
I have a Ruby app with a lot of classes/modules, and some of them are not used. Is there an easy way of finding out which?
I was thinking to do a profile, and then work with it's output. Any other ideas?
...
I want to fetch posts based on their status, so I have this code inside my PostsController index action. It seems to be cluttering the index action, though, and I'm not sure it belongs here.
How could I make it more concise and where would I move it in my application so it doesn't clutter up my index action (if that is the correct thing...
Imagine I have a class like this:
class A
attr_accessor :a
attr_accessor :b
def check
raise "a must meet some condition" if !condition(@a)
raise "b must meet some condition" if !condition(@b)
end
def do_some_work
check()
# more work here
end
def do_some_more_work
check()
# othe...
I am trying to figure out how to refactor this LINQ code nicely. This code and other similar code repeats within the same file as well as in other files. Sometime the data being manipulated is identical and sometimes the data changes and the logic remains the same.
Here is an example of duplicated logic operating on different fields of ...
As a part of maintaining large piece of legacy code, we need to change part of the design mainly to make it more testable (unit testing). One of the issues we need to resolve is the existing interface between components. The interface between two components is a class that contains static methods only.
Simplified example:
class ABInte...
How can I make this function more efficient. It's currently running at 6 - 45 seconds.
I've ran dotTrace profiler on this specific method, and it's total time is anywhere between 6,000ms to 45,000ms. The majority of the time is spent on the "MoveNext" and "GetEnumerator" calls.
and example of the times are
71.55% CreateTableFromReport...
Unfortunately on a project here at work, someone had the great idea to put every header every single file from pretty big project into the precompiled header. This means any change to any header in the project has to recompile the entire project, and all cpp files taking way too long.
Is there any decent C++ refactoring tool which coul...
I am using a module that is part of a commercial software API. The good news is there is a python module - the bad news is that its pretty unpythonic.
To iterate over rows, the follwoing syntax is used:
cursor = gp.getcursor(table)
row = cursor.next()
while row:
#do something with row
row = cursor.next()
What is the most ...
Some .net-framework interfaces and attributes become obsolete and deprecated since new framework version appears. I am warned that such code may be removed or become unpredictable in next versions but have you ever faced the situation when you were forced to refactor code because code came uncompilable or start to behave weird? What was ...
I have a big mess of code. Admittedly, I wrote it myself - a year ago. It's not well commented but it's not very complicated either, so I can understand it -- just not well enough to know where to start as far as refactoring it.
I violated every rule that I have read about over the past year. There are classes with multiple responsibili...
Hi,
I am new to Ruby and I know that I am not using the simple and powerful methods available within it. I made my code work but it has to be simple not this huge (especially I feel I am very bad at loop variables)
i = 0
j = 0
loop_count = ((to_date-from_date)/(60*60*24)).to_i#diff b/w two dates in days
loop_count.times do
48.time...
I am setting up a World Cup Challenge between some friends, and decided to practice my Ruby and write a small script to automate the process.
The Problem:
32 World Cup qualifiers split into 4 tiers by their Fifa ranking
8 entries
Each entry is assigned 1 random team per tier
Winner takes all :-)
I wrote something that suffices yet...
I have a legacy class that is rahter complex to maintain:
class OldClass {
method1(arg1, arg2) {
... 200 lines of code ...
}
method2(arg1) {
... 200 lines of code ...
}
...
method20(arg1, arg2, arg3) {
... 200 lines of code ...
}
}
methods are huge, unstructured and repetitive (developer loved...
I have written
List<Attachment> lstAttachment = new List<Attachment>();
//Check if any error file is present in which case it needs to be send
if (new FileInfo(Path.Combine(errorFolder, errorFileName)).Exists)
{
Attachment unprocessedFile = new Attachment(Path.Combine(errorFolder, err...