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
4
votes
3 answers
syncing iostream with stdio
I am trying to add iostream to the legacy code and thus want to sync those two libraries.
According to this article, I should use std::ios_base::sync_with_stdio.
Now, I wonder how it is used in practice (examples please), side-effects I should be…

vehomzzz
- 42,832
- 72
- 186
- 216
4
votes
1 answer
Can I use a *.tlb file without using Regasm to register it on the computer
We are supporting an aging VB6 system that we have written new code for in .Net, put the code into assemblies and then exported *.tlb files for use with the VB6 codebase.
My question is, on every computer I wish to run the code on, do I have to use…

JMK
- 27,273
- 52
- 163
- 280
3
votes
1 answer
How can I remove shared variables from legacy code
In the system there is a singleton for currently logged user (our own user not windows user) containing a shared instance.
In a few hundred data access class files this is used to set CreatebyID and EditbyID for each request sent to the database.…

John
- 29,788
- 18
- 89
- 130
3
votes
3 answers
Elegant ways of avoiding numerous code changes in the following legacy code
In some legacy code, there are hundreds of occurrences of the following code snippets:
myObj.ReportGenerator.Preview = reportingObj.PreviewDocument;
... whereas both the "ReportGenerator" and the "ReportingObj" are instances of a third party…

bonifaz
- 588
- 3
- 16
3
votes
1 answer
How to run legacy Mac code on a faster, remote machine?
We've inherited some legacy software that we need to run quite urgently. It was written in Lisp and we don't have the source code (developer is dead), only runs on Mac OS 9 (some bug seems to prevent it running on anything newer) and requires a…

Dan
- 1,209
- 3
- 13
- 29
3
votes
1 answer
Why render error in react v18 occures although I do not use legacy code?
Hy, guys!
I have a render error in my react v18 code like this:
Warning: react-dom.development.js:86 Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if…

DenisF
- 31
- 1
- 2
3
votes
1 answer
What are ways to mock out a struct to get a class under unit tests?
I have a class that I'm trying to get under unit tests. The class exposes a struct as a public property. The struct also has some public methods (that do much more than a method in a struct should). I can't make changes to the struct (I don't own…

Ben Joiner
- 33
- 1
- 4
3
votes
2 answers
How to use an old single-threaded C++ library in a multithreaded environment
I have an old C++ library which has been designed for use in single-threaded environmens.
The library exposes the interfaces for initialization, which change the internal data structures of the library, and usage, which only reads data and makes…

Coffee on Mars
- 988
- 6
- 21
3
votes
2 answers
When and Why would a Child class declare a static instance member of the parent class?
This is another design pattern in some legacy code that I couldn't find much about on google. In this case a child class extends its abstract parent, but then turns right around and declares a static instance of the parent:
public abstract class…

Riggy
- 1,347
- 1
- 14
- 26
3
votes
0 answers
is there compiler option that sets the warnings/errors to match those common at the time when the code was written?
Code written 20 years ago often won't compile with today's -Wall.
Is there a record of default settings for say GCC from 1997, or other years?
And I know I can turn off individual error/warnings in GCC.

novelistparty
- 394
- 2
- 16
3
votes
1 answer
How can I safely extract a function from gnarly C++ code?
Suppose I have a 5000-line-long, deeply nested function, and I want to extract a 1000-line block into a new function.
In Java and C# I can let ReSharper, IntelliJ, and Visual C# handle the analysis required to safely extract a method, no matter how…

Jay Bazuzi
- 45,157
- 15
- 111
- 168
3
votes
0 answers
2 default case in switch
I have to work on some legacy code. In a part of this code, there are two default cases in a switch:
switch (strtoupper($format)) {
case '4A0': {$format = array(4767.87,6740.79); break;}
// etc.
case 'A3': {$format =…

rap-2-h
- 30,204
- 37
- 167
- 263
3
votes
3 answers
Database Compacting and Archiving - MS Access Backend
Scenario: There is a legacy program (Not sure what language) and I have been asked to "Compact and Archive forms in the database". At the moment when the user opens the application it is taking about 2-5min to load around 27000 Records!!! My theory…

Gage
- 7,365
- 9
- 47
- 77
3
votes
1 answer
Distribution responsibilities for code of long-living large project
Suppose you are project manager of large project with a lot of code which was developed for long time. For some parts of code team have knowledge, for others - not.
It is good to distribute responsibility between team mates in some wise way.
There…

sergtk
- 10,714
- 15
- 75
- 130
3
votes
2 answers
Extension methods in C#: why does this work?
I'm a little confused as to why this doesn't give an error. I found this code deep inside of some outdated legacy software and was surprised to see it work.
public static string CleanFileName(this string fileName)
{
return CleanFileName(fileName,…

Aardvark
- 1,264
- 1
- 12
- 21