4 ms·
"Come and hear how we’ve built an international team of developers to tackle the problems of resurrecting a poorly-understood, gigantic code-base extensively co
by raverbashing 14y ago
"Come and hear how we’ve built an international team of developers to tackle the problems of resurrecting a poorly-understood, gigantic code-base extensively commented in German, with no unit tests, a tangled build infrastructure, and twenty-five years of un-paid technical debt."
Looks like a project I worked on. It's eerie how similar it is (and no, it was not an office app, it was something different).
At least the comments weren't in German, but there were a couple of ones in Dutch. (Not that the comments were of any help)
No unit tests: CHECK. Twenty-five year of technical debt, CHECK. And now we're supposed to make it work in a different platform
So thank you, but I don't plan on touching a monolithical piece of old C++ ever again. Not even with gloves.
- jacquesm 14y agoIt's doable. Start by adding integration tests, then (try to) identify the core of the project and isolate that in its own sub-project in the repo. Add unit tests for the functions in the core and then split the remainder into parts that are peripheral and that could be removed/disabled. (say a spellchecker). Next up re-factor the core until you're happy with the state of affairs, but keep the interface the same. If there was no interface to the rest of the code then you'll need to define one and implement that as well as changing the peripheral code to use that interface. Then look at each peripheral piece and decide if it is worth saving, needs rebuilding or refactor it as well. The basic trick is to reduce scope until a subsection of the work becomes tractable. With a really large project this is a multi-year effort with a team of seasoned programmers, it's hard and it means that while you do it there will be no honoring feature requests. You need management buy-in, patience and perseverance but that goes for any large effort. Building fresh and green stuff is obviously much more fun to do but taking an old codebase and making it nice is (to me, at least) just as rewarding.
- cpressey 14y agoI agree, it's doable. You do need to put a lot more effort into coordination between team members than usual, because it's very easy for the developers (should I say the refactorers?) to step on each others' toes.
- peteretep 14y agoAnother side of the same approach is just starting to hack bits out in to their own services. Really the key point that you identified is trying to find the internal interfaces of the code, and fracturing the monolithic codebase along those lines.
- raverbashing 14y agoIt certainly is doable In my case there were added difficulties: - The project ran on embedded hw (hence it does not have a user interface, only interface is with hw devices) - There was a lack of problem domain understanding, so it's not - like in LibreOffice case, for example, 'this is a list of paragraphs', but 'we don't know what's this piece of data' because if refers to a specific domain of knowledge Not to mention unit tests (both writing and running) are more painful in C++ than in Python for example
- jacquesm 14y agoI think acquiring domain knowledge is one of the most overlooked elements in software design. Lots of people write programs for things they essentially do not understand. This causes all kinds of misery. I'd see this being C++ over Python and embedded as advantages rather than disadvantages! Each to his own I guess :)
- kami8845 14y agoI find this argument smells of rationalisation to me: You admit yourself that building new stuff is much more fun. Say making an old codebase is "just as rewarding" but in order to actually understand all the legacy you need to put in 2x (or whatever the amount) of work that you'd need to build a new thing. Wouldn't you want to build 2 new things instead? I could never imagine someone on their own accord, going by themselves into a 30-year-old codebase and refactoring it, just to make it "look nice". On the other hand people constantly build new stuff (too much of it really). I think it would be fine to admit that working on new code is more desirable than working on old code. Sometimes the latter needs to be done, but I think most programmers are happy to avoid maintenance work when they can.
- jacquesm 14y agoBuilding something new is more fun in the beginning. Refactoring an old codebase and making it fly is rewarding when you're done. This is not about cosmetics. Both are fun, assuming you stay in long enough the first will at some point turn into the second, no matter how well your intentions were at the beginning ('this one will be different, this time I'll get it right').
- kami8845 14y agoYeah but programmers are generally not bound to a codebase for life. A friend of mine who works at Google says that he generally works on projects in the "do it new and figure out what it needs to do" phase, while there's other engineers at Google who are very good at the maintenance phase and "keeping stuff running and adding slowly to it". I think that's a very nice way of wording it, but I'd definitely want to see myself in the former group, not the latter.
- jacquesm 14y ago> Yeah but programmers are generally not bound to a codebase for life. If you're young I can see how you might have that impression. But I know quite a few programmers personally that have been working on the same codebase for more than a decade, and even a couple that have been working on the same codebase for 3 decades. The web is still young enough that most people that came into programming through building websites have no idea how long most code bases are alive. There is a neat little proverb here: programs are like children, you can start one in an evening but you'll end up supporting it for the rest of your life.
- supar 14y agoI think that this scenario routinely happens at many companies. Only you don't hear public stories about it, because in the end what happens is the same for all software: continuous transition/refactoring. I know I've been working on many projects like in these conditions, though not of that size. With more and more experience of that kind and by working on stinking code-bases, I've come to the conclusion that while in the past I could have thought that trashing the code and starting from scratch would help, now I would probably approach most problems by pushing new code in the form that I want and transition the rest as changes are required. I had projects that I did myself with great design care, but after 5-6 years due to shifting requirements also started to look like you could have done a better job by starting from scratch again. Reality is, in retrospect all code is suboptimal.