Originally legacy code meant code 'inherited' from authors or from a previous program/system version. Since Michael Feathers published his "Working Effectively with Legacy Code" book, new definition came to be, where code without tests is legacy code.
Questions tagged [legacy-code]
480 questions
27
votes
3 answers
Data Migration from Legacy Data Structure to New Data Structure
Ok So here is the problem we are facing.
Currently:
We have a ton of Legacy Applications that have direct database access
The data structure in the database is not normalized
The current process / structure is used by almost all applications
What…

Phill Pafford
- 83,471
- 91
- 263
- 383
26
votes
2 answers
How to generate a dummy app inside an already existing rails engine
I came to work for a company recently that has been working on a specific rails project for a while. Dropped in the middle of the development process, I'm beginning to go back and write tests for the existing code as well as the code currently being…

Austintacious1
- 330
- 3
- 10
25
votes
13 answers
Legacy Code Nightmare
I've inherited a project where the class diagrams closely resemble a spider web on a plate of spaghetti. I've written about 300 unit tests in the past two months to give myself a safety net covering the main executable.
I have my library of agile…

Kenneth Cochran
- 11,954
- 3
- 52
- 117
25
votes
9 answers
Will Windows 7 support the VB6 runtime?
I can't seem to find a straight answer on this. It appears that Visual Studio 6 won't be supported, but I'm only concerned with the runtime. We have some legacy apps that we'd rather not rewrite, but our customers will expect them to run on Windows…

Jon B
- 51,025
- 31
- 133
- 161
24
votes
4 answers
Use legacy support library option in android
Should I select the Use legacy android.support libraries option when creating a new project? What will happen if I don't select this option?

jai singh Rawat
- 253
- 1
- 2
- 7
24
votes
14 answers
Code refactoring on bad system design
I am a junior software engineer who've been given a task to take over a old system. This system has several problems, based on my preliminary assessment.
spaghetti code
repetitive code
classes with 10k lines and above
misuse and over-logging using…

ilovetolearn
- 2,006
- 5
- 33
- 64
23
votes
12 answers
I'm maintaining a Java class that's 40K lines long.. problem?
This may be a subjective question leading to deletion but I would really like some feedback.
Recently, I moved to another very large enterprise project where I work as a developer. I was aghast to find most classes in the project are anywhere from…

Billworth Vandory
- 5,003
- 5
- 29
- 34
22
votes
6 answers
Starting UnitTesting on a LARGE project
Can anyone recommend some best-practices on how to tackle the problem of starting to UnitTest a large existing CodeBase?
The problems that I'm currently facing include:
HUGE code base
ZERO existing UnitTests
High coupling between classes
Complex OM…

SaguiItay
- 2,145
- 1
- 18
- 40
21
votes
13 answers
The best way to familiarize yourself with an inherited codebase
Stacker Nobody asked about the most shocking thing new programmers find as they enter the field.
Very high on the list, is the impact of inheriting a codebase with which one must rapidly become acquainted. It can be quite a shock to suddenly find…

pookleblinky
- 623
- 1
- 11
- 23
19
votes
8 answers
How to unit test a method with a `using` statement?
How can I write a unit test for a method that has a using statement?
For example let assume that I have a method Foo.
public bool Foo()
{
using (IMyDisposableClass client = new MyDisposableClass())
{
return client.SomeOtherMethod();
…

Vadim
- 21,044
- 18
- 65
- 101
19
votes
3 answers
Reset class static variable during unit test
I am trying to write a unit test for a legacy code. The class which I'm testing has several static variables. My test case class has a few @Test methods. Hence all of them share the same state.
Is there way to reset all static variables between…

kan
- 28,279
- 7
- 71
- 101
15
votes
4 answers
How can I handle exit() calls in 3rd party library code?
I'm working on a C++ application which uses a library written in C by another team. The writers of the library like to call exit() when errors happen, which ends the program immediately without calling the destructors of objects on the stack in the…

bythescruff
- 1,869
- 2
- 17
- 33
14
votes
1 answer
BigQuery - IFERROR for standardSQL
I'm about to migrate queries from Legacy to Standard in BQ.
In Legacy I used to have x/y returning null if y=0, however, I'm stuck in StandardSQL with the error:
Error: division by zero
I'd like to apply something like IFERROR(x/y,null)
Is it…

Ilja
- 993
- 2
- 17
- 36
14
votes
2 answers
How can you implement test driven development with legacy code?
The situation: millions of lines of code, more than one hundred developers and frequent defects. We want to avoid repeating defects and we want to improve code design (who doesn't?).
Test Driven Development (first unit test, then code) sounds ideal:…

Reinstate Monica - Goodbye SE
- 3,528
- 5
- 41
- 64
14
votes
1 answer
Preprocessor macros as parameters to other macros
The following C++ code compiles and works as the programmer intended on GCC (4.0.4)
#define FOO(x,y,z) ((x)*(y)*(z))
#define BAR(x) FOO(x,1)
#define BAZ 3,7
int main()
{
return BAR(BAZ); /* interpreted as return ((3)*(7)*(1)); */
}
However,…

otto
- 1,138
- 6
- 14