Questions tagged [legacy-code]
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.
79 questions
2
votes
5
answers
607
views
Is Exception caught in the Service class a matter of preference?
In a Java EE legacy project, almost all the DAO and Service classes are written in a a way that DAO level does not catch any exception and instead the service classes catch(Exeption e) in all of their ...
5
votes
2
answers
2k
views
C#: Refactoring an oversized try/catch/finally
Recently I've come to discover that I've inherited one of the internal auxilliary programs used. I've made a few minor fixes and features to improve it in the past, but now I've been given a major ...
9
votes
4
answers
4k
views
How to analyze and understand the use/application of a "class" in a colossal million-line legacy code base?
I am working on a huge code base (more than a million lines of code with a sophisticated architecture) written in C++ over the span of a couple of decades. The task on which I'm working at this point ...
2
votes
1
answer
341
views
Wrapping a legacy C++ codebase with a C API
I have inherited a large C++ codebase implementing various Windows desktop applications, services and libraries using Windows MFC. There are no automated tests. We need to decouple the UI and retain a ...
3
votes
3
answers
514
views
Is there merit to keeping packages/dependencies in a legacy project up to date?
I have been assigned a ticket to update all node packages and dependencies in a react project to the latest possible version without breaking the application monolith as it is now; no further ...
-2
votes
3
answers
176
views
How to determine if a module within an application is worth refactoring or rewriting?
We all know Joel Spolsky's famous article to never rewrite working code.
How about if we don't consider overall program but a module within? Module can be e.g.:
payment handling microservice in e-...
0
votes
2
answers
1k
views
Good design for a class with multiple methods to test but one public method
I've been trying to refactor some existing code which is in essence a giant nested procedural call inside what should otherwise be an object oriented architecture. The entry point to the relevant code ...
0
votes
1
answer
119
views
How to document attributes from legacy application
I have to replace an old application (Database, C++ UI) which is mainly for data administration, with on a new application (Same Database, Spring-Boot, Angular).
We want to document how the ...
1
vote
0
answers
140
views
How to handle the co-exist phase of Strangler pattern gracefully
We are consolidating a number of disparate monoliths, redesigning and implementing a greenfield suite of microservices and micro-frontends. The stack is all new, the design is all new - it couldn't ...
99
votes
9
answers
19k
views
Is it the correct practice to keep more than 10 years old spaghetti legacy code untouched without refactoring at all in big product development?
I have been in two software product houses for three years in a row.
The first is a small company maintaining a fairly small management system with a monolithic legacy code base (almost twenty years). ...
2
votes
2
answers
988
views
Migrating legacy code with singletons to Dependency injection
I'm working on a larger, older project. Our code is littered with classical singletons, i.e. classes like
public class ABCService {
private static final instance = new ABCService();
public ...
-1
votes
1
answer
709
views
How to create input data for unit tests for an API client?
I am building the initial set of unit tests for my team's legacy API client system. We have been writing integration tests, but have no unit tests.
It's a Sinatra server that accepts requests from our ...
1
vote
3
answers
472
views
Refactor unit tests?
When we work with legacy code and need to do changes, we first write tests on the current behavior. That way we can implement new changes with confidence. We can even refactor the code.
Legacy code is ...
-3
votes
1
answer
483
views
How to deal with code impossible to change [duplicate]
This question maybe borderline with the workplace. Also I apologize if it sounds more like a rant than anything.
We have a legacy code base (million of line of code). No evolution is ever possible, ...
-1
votes
2
answers
221
views
Won't a characterization/regression test fail when a bug is fixed?
Let's assume that you are trying to refactor a legacy code to make it easier to understand and more testable, how can you do that?
In the book "Working with Legacy Code", a characterization/...
0
votes
2
answers
134
views
Should I refactor this class to use a Factory?
Given the following class in a Legacy code base without any UT's.
So any refactoring done should be done on the smallest possible scale, just in order to be able to write UT's.
public class Person
{
...
-3
votes
1
answer
98
views
Best Practices for Building An API and SDK for a Legacy Application
I have been given a task to take on a legacy application (which has a very poor API in terms of user experience, is undocumented largely, and performs slowly) and build a new API and SDK to improve ...
4
votes
4
answers
1k
views
What is a good way to support multiple units (metric and imperial) for a legacy system which supports one only
I have a huge GIS related project with multiple parts which was originally developed for metric usage (meters).
Now I need to make a comprehensive audit of the system to come up with a plan to let it ...
3
votes
3
answers
143
views
Should new fields and operation of logical entity be in one single class even the existing class has thousands of existing lines
In a legacy Java project, when adding a new feature - an existing email field can be editable or not editable on base of its parent system, a developer added a new feature by adding a new class, which ...
12
votes
6
answers
4k
views
Is lack of functional requirements agile?
Nowadays everybody wants to be agile. In every team I worked with, the shape of agile was different. Some things are common - like daily stand-ups or planning, but other parts vary significantly.
In ...
8
votes
3
answers
3k
views
How do I write unit tests for legacy code (that I don't understand)?
Forward
I've read a lot of things before asking this question, including many relevant
questions right here on SE:
(Software Engineering SE) Writing tests for code whose purpose I don't understand
(...
0
votes
2
answers
124
views
Tool or strategy to remember code structure and where I left [duplicate]
I am working on multiple projects as a developer and second line support, It happens that I fix a bug on one project, test and deploy the change then leave the project for months and return back for ...
-2
votes
1
answer
265
views
Documenting business logics of legacy application having no unit test
I have joined a team in company and this team owns few services, which are used widely by many other user facing internal/external UI apps and other internal apis.
My manager gave me rough idea that ...
3
votes
1
answer
387
views
How do I migrate part of a business process to DDD? [closed]
I am quite new to DDD, but I am currently working on a system which has a payroll element to it. I have a requirement to send payslips to an external system when they are created. Currently the ...
2
votes
0
answers
238
views
How to annotate a codebase as you're learning it? [duplicate]
When I first a codebase, I frequently take notes about it, as this SO answer suggests.
If some code chunk is small enough, I copy-paste to Word, print it out, and make hand-written annotation. If the ...
3
votes
2
answers
277
views
Variable renaming throughout solution will produce lots of noise in git blame. What to do?
I inherited 1 million lines of C++ legacy code. Throughout the code variables like bCPCHAR bPCHAR, bCPDOUBLE and bPINT are used. They are defined like this:
bCPCHAR: const char *
bPCHAR: char *
...
11
votes
7
answers
4k
views
How to deal with a large codebase with no requirements and the responsible person leaving the company soon [duplicate]
i am faced with the following scenario and i wonder if you guys have some tips for me on how to approach this.
One of my colleagues is going to leave the company in a few month and i am ordered to ...
0
votes
1
answer
199
views
How to prepare test case for System Migration of legacy system while existing functionality is unclear?
I am migrating a legacy system from Oracle Form to Web Application. The migration is conducted with code study and interview.
As the requirement is to migrate the existing system to Web application ...
5
votes
2
answers
1k
views
How to approach this legacy Java project? [duplicate]
Edit: Assume that I will stay on this project until "the end".
The Problem
I'm currently working on a legacy interesting Java project(s). A full rewrite is currently out of the question, as I am ...
0
votes
3
answers
322
views
Follow Up: Legacy code maintenance and moving forward (implementing previous answers)
Overview
This is a follow up to my previous question that was flagged as a duplicate, and I do not know what would work better as the title.
Here is a link to the previous question:
Legacy code: ...
1
vote
3
answers
1k
views
Legacy code: what to do in regards to maintenance and moving forward? [duplicate]
I am currently working on an application with legacy code that was built using proof of concepts (POCs). These POCs became the finished production-ready code, there were no tests, and the classes have ...
2
votes
2
answers
141
views
Make sense out of automatic information gathered from legacy system
I have a legacy system I need to plan a migration for. It's mainly developed in Ingres+4GL (an old Ingres based form system).
I have the following information:
Data Structures (data base relations ...
5
votes
8
answers
9k
views
Refactoring for loop (clean code aspect)
I have to refactor a "for" loop which iterates over an array and does two independent things with the array element. For example:
doThisOrOtherStuff(array) {
for(int i=0; i<array.length; i++) {
...
4
votes
2
answers
3k
views
How to approach the understanding, documentation and validation of legacy code [duplicate]
I've been tasked with studying a Python code, which runs on an orchestrator, which schedule the launch of the code in correspondence of some events. The code imports some modules, and it's basically ...
2
votes
1
answer
185
views
Gap between Code base and Production application
Background
I joined a company as a solutions architect less than a year ago, with a main task of consolidating, and modernizing legacy code resulting from 90+ company acquisitions over the past 20+ ...
3
votes
4
answers
1k
views
Unit testing Systems with Logic Tightly Coupled with Data
I understand there are many questions in this site revolving around the same concept, but I could not get a precise answer for my case.
Problem
I am handling an ERP System, with code base in both:
...
7
votes
4
answers
4k
views
What is the antonym to “legacy code”? [closed]
I am writing a software documentation and I need a antonym to "legacy code". Is there any established word for the antonym to "legacy code"? I'll need this antonym to describe that code which was ...
-1
votes
2
answers
177
views
What changes are needed to run a 32 bit software on a 64 bit system? [closed]
If I have software written in C for 32 bit system, what changes do I need to make in it to run it on a 64 bit system?
0
votes
1
answer
390
views
Apply latest methods and practices in highly sophisticated legacy application
Currently I am working on a health related application which was being developed for 5 years and lot of developers have contributed in it.
The application is quite complex and highly used by lot of ...
4
votes
3
answers
15k
views
Factory method for objects with multiple complex constructors
I'm refactoring a legacy codebase.
I have 4 very similar objects that I decided would be a good target for becoming polymorphic, so I moved all the common code to a base class and added an interface.
...
4
votes
2
answers
192
views
Is there a methodology for switching large code base to be interfaced-based instead of direct class access?
Our organization codebase is used by various teams.
Over the years, the code has evolved and grown without much usage of interfaces.
We would like to change that, to reduce chance of breaking changes.
...
0
votes
3
answers
506
views
Bug Fixing Code With No Tests
I am regularly given code with bugs in it and told to fix the bugs without introducing any more. My approach is usually as follows:
Identify the bug's issue, e.g. method is returning an empty list ...
89
votes
10
answers
11k
views
Estimating time costs in legacy codebase
Recently I started working on a project where a very old monolithic application is being migrated into microservice-based architecture.
The legacy codebase is very messy ('spaghetti code') and often ...
28
votes
8
answers
5k
views
How to argue against lowering quality standards for legacy codebase? [closed]
We have here a large legacy code base with bad code you can't imagine.
We defined now some quality standards and want to get those fulfilled in either completely new codebase, but also if you touch ...
4
votes
2
answers
324
views
How do I know when to refactor global database query calls, and when to leave them alone?
I have the following global statement calls sprinkled throughout my PHP legacy codebase:
$jobnumber = db_quick($sql);
db_query($sql);
That is, those function calls have been initialized in the ...
0
votes
1
answer
695
views
How to go about upgrading spaghetti code? Is it worth it? [duplicate]
I'm working on medium sized ASP.NET MVC 4 web app, that is about 2.5 years old. Around 25-30k lines of code. The project has never followed any of the good .NET design practices. It is a very tightly ...
3
votes
1
answer
282
views
Doesn't Jmockit make a lot of techniques mentioned in "Working Effectively with Legacy Code" redundant?
I'm currently reading "Working Effectively with Legacy Code" by Michael Feathers.
So far, a lot of techniques the book mentions, start with a problem similar to:
"it's really difficult / it would ...
6
votes
3
answers
705
views
How do you deal with legacy data integrity issues when rewriting software?
I am working on a project which is a rewrite of an existing legacy software. The legacy software primarily consists of CRUD operations (create, read, update, delete) on an SQL database.
Despite the ...
23
votes
8
answers
3k
views
How to deal with tremendous number of failing tests? [closed]
I'm working in the development of an old project written in Java. We have more than 10 million LOC and, even worse, more than 4000 functional tests.
The tests, scheduled by Hudson, are failing like ...
5
votes
2
answers
180
views
When designing a replacement application, how can I compare its performance to the original, if there are no existing statistics?
I don't believe there are any performance statistics kept for the application I'm being asked to replace, and don't want to ask the individuals doing the work to manually record things like how long ...