Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "#legacycode"
-
A method that contains over 9000 lines of code.....
Are there really production codebases out there with stuff like that? If yes I am scared as hell because I don't want to work with that kind of code once I graduate
Tell your stories!19 -
Looking at code in our workplace.. I realized one thing. Like Devops, legacy code is actually a mindset.
So here goes my thought:
A piece of code is not legacy because it was written ten years ago.
A piece of code is legacy because it looks like a piece of legacy code.
With the legacy code mindset, you end up writing legacy code no matter where you are, when you wrote it.
I was looking at some part of our code which we written in just the last few months, and I can’t help but think that they were legacy, so it really doesn’t matter when it was written!
It is more about how you write your code that determines whether it is legacy :)
Hopefully this was not crazily confusing anyone. Have a good day guys & gals!7 -
ever got a task to modify legacy code and when you looked at it you were like... burning it with fire is the only way!1
-
The devRant apps haven't been updated since 2020. 💀 There are 390 open issues on GitHub. 👀 What's going on? Is there an update in the making?26
-
The worst kind of legacy code is the one in which a function body run miles climbing if-else ladders until nobody knows where the sky hits the floor, and returns when nobody is looking.
The best kind of legacy code is the one which is fully commented out! -
In legacyCode, somebody mixed jQuery data-toggle with custom JS triggers that toggle the target's DOM node, and to "fix" the mess, set display: block !important.
Took me too long to remember that Firefox dev tools show JS events (while my Chrome dev tools don't - why?) now I'm on the right track towards a solution...4 -
abstract class Ich {
abstract void support(CoWorker coWorker);
abstract void programm(List<Task> tasks);
abstract void analyseCode(String code); // mostly horrible code
abstract void drinkCoffee(Mug mug);
abstract void extinguishFireAndKillBugs(String moreLegacy);
}
...
void work() {
ich.drinkCoffee();
while(isWorkingTime()) {
int rand = Random(0,100)
if(rand < 5) {
ich.myMood += ich.programm(tasksForMe);
} else if (rand >= 5 && rand < 20) {
ich.myMood -= ich.analyse(legacyCode);
} else if (rand >= 20 && rand < 40) {
ich.myMood -= ich.support(GetNextGuyToMe())
} else {
ich.extinguishFireAndKillBugs(moreLegacyCode);
}
if(myMood <= 0) {
ich.gotoHome();
}
}
}1 -
This moment when you have to read a 3k lines long Service class to plug a new process on the legacy one, and wonder if it wouldn't be just better to rewrite stuff in parallel instead of reusing and bending the old one
Everything is so tightly coupled that I would have to refacto all this and extract methods but I don't have time for that, and the chance of breaking stuff is insanely high