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
12
votes
11 answers
How to motivate team to work on legacy products
We are a team working on legacy code which is pretty old and written in languages of initial programming days. As the team members are trained in latest technology and are now put to work on legacy code, they are not happy. How to motivate them to…

Nayana Setty
- 1,001
- 1
- 12
- 34
11
votes
7 answers
Practical refactoring using unit tests
Having just read the first four chapters of Refactoring: Improving the Design of Existing Code, I embarked on my first refactoring and almost immediately came to a roadblock. It stems from the requirement that before you begin refactoring, you…
user16324
11
votes
5 answers
Generics in legacy code
We've got a fairly large amount of code that just made the jump to Java 5. We've been using generics in those components targeted at being released in the Java 5 version, but the remaining code is, of course, full of raw types. I've set the compiler…

morsch
- 1,136
- 1
- 8
- 11
11
votes
18 answers
When do I need to stop using design patterns?
My colleagues are going crazy because I keep on wanting to rewrite code that already works, because I would like to replace some legacy design with design patterns. Although I feel like it will help improving the existing code, I do feel like I am…

ak3nat0n
- 6,060
- 6
- 36
- 59
10
votes
6 answers
How to implement large number of complex wrappers for legacy API/framework (C++ Macros vs. C++ Templates vs. Code generator)?
We work with very old legacy system implemented in C++ with VC6 compiler. Now we are in the process of refactoring the code. We also switched to VC9 compiler.
We use an external proprietary framework, which is also legacy code and not unit testable.…

nowaq
- 2,748
- 19
- 25
10
votes
2 answers
Single Table Inheritance and 'type' value for namespaced classes
While working on Rails 2.3.18 to Rails 3.2.x migration I am facing name issue in type column
Here is the relation that is defined.
app/models/reservation.rb
class Reservation
end
class Reservation::Guest < Reservation
end
class Reservation::Event…

Amit Patel
- 15,609
- 18
- 68
- 106
9
votes
4 answers
How do you start with FxCop on legacy code?
Does anyone have any experience of introducing FxCop to legacy code? We would like to have our build fail if anyone introduces code that violates rules. But for the time being, this is impossible, as the legacy code has over 9000 violations.
The…

Peter
- 13,733
- 11
- 75
- 122
9
votes
7 answers
No require, no include, no url rewriting, yet the script is executed without being in the url
I am trying to trace the flow of execution in some legacy code. We have a report being accessed with
http://site.com/?nq=showreport&action=view
This is the puzzle:
in index.php there is no $_GET['nq'] or $_GET['action'] (and no
$_REQUEST…

Majid Fouladpour
- 29,356
- 21
- 76
- 127
9
votes
2 answers
Global.Micrsoft.VisualBasic.ApplicationsServices... is not defined error BC30002
I'm converting some old legacy VB apps from .NET framework to .NET 5, and have worked through most of the issues, however, I'm lost on these:
Error BC30002 Type 'Global.Microsoft.VisualBasic.ApplicationServices.ApplicationBase' is not…

Bill Hall
- 91
- 1
- 3
9
votes
1 answer
PHP Incorrect variable declaration
Debugging legacy code and I have a strange issue. The legacy code is being moved to PHP 7.2. I don't know which version of PHP it was originally written for but it does work in PHP 5.6.
Below is my example of the problem...
$variable =…

itsliamoco
- 1,028
- 1
- 12
- 28
9
votes
3 answers
How to make an internal Java package accessible in Eclipse?
I have a legacy Java (8) project opened in Eclipse with Java 11 (or Java 10). Eclipse is now rightly complaining about inaccessible packages. E.g. com.apple.laf.AquaComboBoxUI.
When compiling from command line I can make those packages accessible…

Michael
- 532
- 1
- 6
- 15
9
votes
3 answers
Python: Detect code which gets never executed in production
I need to do refactoring in a big legacy Python code base.
Often I think "these lines don't get executed in production any more".
But I am unsure.
There are some tests which touch these lines. But I can't tell for sure if really no usage happens in…

guettli
- 25,042
- 81
- 346
- 663
9
votes
1 answer
Is there only one unnamed namespace per compilation unit?
I have inherited a horrible bit of legacy code which includes about 1000 lines of utility class definition that needs to appear before the "real" code in a source file. To avoid clashes with other modules that might also have associated legacy…

andybuckley
- 1,114
- 2
- 11
- 24
9
votes
1 answer
Should I really massively introduce the explicit keyword?
When I used the (recently released) Cppcheck 1.69 on my code1, it showed a whole lot of messages where I expected none. Disabling noExplicitConstructor proved that all of them were of exactly this kind.
But I found that I'm not the only one with a…

Wolf
- 9,679
- 7
- 62
- 108
9
votes
1 answer
How can I mark Perl code as deprecated?
In my project I'm currently preparing a step-by-step move from legacy code to new, properly-designed and tested modules. Since not every fellow programmer follows closely what I do, I would like to emit warnings when old code is used. I would also…

Nikolai Prokoschenko
- 8,465
- 11
- 58
- 97