Live data from Hacker News

The key points of "Working Effectively with Legacy Code"

understandlegacycode.com

61–70 of 74 posts

Re: The key points of "Working Effectively with Legacy Code"

#61

Kind of depressing to read because it's so accurate, yet so likely to be ignored. I remember when Martin Fowler first published the book "Refactoring" - I was so relieved at the time because somebody with some clout that executives might actually listen to had not only identified what was wrong with software but identified a way to fix it and even gave it a name! Boy was I wrong - now you have to be careful how and w…

I like Fowlers writings, but honestly Refactoring is one of the worst tech books I have read.

Re: The key points of "Working Effectively with Legacy Code"

#63
post #4

Earlier quoted context omitted.

I think of the second half much more as reference. I can give it to a junior engineer or early mid-level and say "here is an example." It's harder if they can't read the older examples, but I can google for a more modern example as well. It gives nomenclature and examples.

> It's harder if they can't read the older examples, but I can google for a more modern example as well. It gives nomenclature and examples. Don't do that. Ostensibly you're giving these people the book so that they'll learn to deal with legacy code. Those older examples are exactly what they need to see, even if they're in a language that those devs are not using.

Junior developers in javascript codebases of 7-10 years old will not have the experience necessary in some cases. I am coaching them as a manager trying to introduce a concept, not a professor.

I may be doing a disservice to their long term development at the cost of short term gains. However, I don't think this is true. There are a lot of developers who will never work in a C, C++, C#, or Java codebase. And I try to adhere to Krashen's "comprehensible input" theory as it has a lot of application to learning the language of software development as well.

(See https://www.languagehumanities.org/what-is-the-input-hypothe... )

Re: The key points of "Working Effectively with Legacy Code"

#64
This book is extremely overrated because the whole thing can be summed up in two bullet points:

* write your new code somewhere outside the main solution and call it from the old solution

* automated tests are pretty cool and you should write these whenever possible

I found the book to be close to useless when I was working with actual legacy code. How do I write an unit test for an application that has an embedded Visual Basic script support with dozens of scripts that are thousands of lines long? The book does not answer this question at all because the author assumed I have the luxury of working with Java or an another language that supports the object-oriented paradigm and can be endlessly extended with no limitations whatsoever.

Re: The key points of "Working Effectively with Legacy Code"

#65
post #62

This book talks about unit tests, but for UI they are mostly useless. I found that for UI the most essential refactoring tools are storybook and visual diff tests.

I remember the time when we had to delete “a lot” of UI tests because the implementation and the framework deprecated and we had to move forward (usual stuff, eg vulnerabilities). Refactoring all of those tests would require a bunch of effort therefore we stopped adding new features and just waited for the last customer subscription to expire, then we moved to other more important stuff.

Re: The key points of "Working Effectively with Legacy Code"

#66

This book is extremely overrated because the whole thing can be summed up in two bullet points: * write your new code somewhere outside the main solution and call it from the old solution * automated tests are pretty cool and you should write these whenever possible I found the book to be close to useless when I was working with actual legacy code. How do I write an unit test for an application that has an embedded V…

>How do I write an unit test for an application that has an embedded Visual Basic script support with dozens of scripts that are thousands of lines long? The book does not answer this question at all because the author assumed I have the luxury of working with Java or an another language that supports the object-oriented paradigm and can be endlessly extended with no limitations whatsoever.

Why does the idea of identifying seams not apply to Visual Basic Script?

I've never worked with Visual Basic Script, but I don't see why Feathers' strategy wouldn't apply.

I agree that modernizing legacy code is easier in languages like Java, but I don't think it's strictly necessary. I've used Feathers' techniques for testing C code.

Re: The key points of "Working Effectively with Legacy Code"

#67
post #60

I've replaced a few large legacy systems over the years and I disagree with most of the points mentioned in the link. The only way guaranteed to work is to run the old system concurrently with the new system with live inputs and compare results for a trial period and fixing discrepancies as they arise. Only when there is 100% behavioral/data fidelity with the old system can a switchover to the new system occur. I'm n…

You're assuming the "legacy" system is being replaced by a new one, which isn't the scenario being described in the link or the book. They cover approaches for continuing to safely evolve the legacy (i.e. untested) system.

Rewriting the legacy system is one of the valid paths to maintain it. There can be multiple reasons to do that like operational risk which cannot be mitigated, maintenance overhead, risk related to the existing dependencies of the system.

Re: The key points of "Working Effectively with Legacy Code"

#68
post #61

Kind of depressing to read because it's so accurate, yet so likely to be ignored. I remember when Martin Fowler first published the book "Refactoring" - I was so relieved at the time because somebody with some clout that executives might actually listen to had not only identified what was wrong with software but identified a way to fix it and even gave it a name! Boy was I wrong - now you have to be careful how and w…

I like Fowlers writings, but honestly Refactoring is one of the worst tech books I have read.

Can you say on what ways? I enjoyed it but I'm always keen to revisit my opinions.

Re: The key points of "Working Effectively with Legacy Code"

#69
I think the riskiest migrations are the ones where migration is done in parallel. Internal org power struggles get leaked, whole teams are lobbying against the effort. And on top of all of that rediscovering many things all over again. That in response to cases where a company might decide that the fix too all legacy -> new system is by throwing more money at the problem.

Re: The key points of "Working Effectively with Legacy Code"

#70
This reads like a blog written by someone who sells expensive consulting for business critical issues, but not to actually solve them, but dispense Eastern Wisdom to the poor developers facing and impossible and unsavory task. This sounds like this was written by a guy who was never directly responsible for producing actually usable and productive results.

This is done so management can lay back and say they already did their due diligence, now you know how to do it, now off to the mines! And be ready by the end of next week!

First:

If your codebase doesn't come with tests you are fucked. There's no possible way you can refactor anything without angry customers calling next day you broke their use case. I worked on legacy code that did come with tests (or even better, well written docs!) And even then it was basically everyday that we broke some elaborate use case checked by the tests.

Management will never approve of a refactor, and with good reason.

> unit tests are fast and reliable

They are also often worthless, because they don't capture real world behavior. Not always but having to mock out half your codebase (including libraries you couldn't possibly know how they work, like a legacy version of Qt your app depends on). You end up with five hundred lines of mock for ten lines of test and it doesn't even give you confidence in anything. These workshy consulting ghouls often force devs to write unit tests, who full well know they're going to be absolutely worthless.

Because you have no idea how it's supposed to work.

> Don’t make your code depend on libraries’ implementation

Good advice , though isn't the definition of legacy code that its already written and after refactor it should keep working like it already did? If somebody before you pulled in a COM object from Microsoft Excel 2003, and your ERP system pivotal to your companies success relies on the exact behavior of that component, where does that leave you?

Post reply on HN