News for hackers. Stuff that matters.
Re:Ask HN: Inherited the worst code and tech team I have eve... by rowanG077 on Saturday September 17, 2022 @10:18PM (#32883749)
Huh. You are literally saying do a full rewrite. But it's also the worst idea?

Edit: A full rewrite always meant replacing every part of a system. Whether you do it gradually doesn't really matter.

Re:Ask HN: Inherited the worst code and tech team I have eve... by simonw on Saturday September 17, 2022 @11:56PM (#32884284)
"Whether you do it gradually doesn't really matter."

It absolutely DOES matter. A gradual rewrite is much more likely to work than a stop-the-press rewrite.

Re:Ask HN: Inherited the worst code and tech team I have eve... by rowanG077 on Saturday September 17, 2022 @11:57PM (#32884296)
It's still a rewrite. The crux of the statement I made.
Re:Ask HN: Inherited the worst code and tech team I have eve... by samus on Sunday September 18, 2022 @02:43AM (#32885055)
There problem with a classic full rewrite is that the existing system is thrown away immediately. All the existing features are not available in production until the rewrite adds them back in. Often incomplete, buggy, changed beyond all recognition, or a combination of all of these. That obviously sucks and is the reason the classic rewrite is rarely done. However, it is clear that something must happen.
Re:Ask HN: Inherited the worst code and tech team I have eve... by jmillikin on Sunday September 18, 2022 @04:33AM (#32885622)
"Full rewrite" is a description of the end state, not the process.

The best way to do a full rewrite is incrementally, with test support and consideration for natural separation of internal subsystems.

Re:Ask HN: Inherited the worst code and tech team I have eve... by baobabKoodaa on Sunday September 18, 2022 @09:53AM (#32887561)
The best way to do a rewrite may be incremental, but the terminology of "full rewrite" doesn't usually refer to an incremental rewrite, it refers to starting from scratch.
Re:Ask HN: Inherited the worst code and tech team I have eve... by jmillikin on Sunday September 18, 2022 @10:42AM (#32887955)
I don't think that's true -- a "full" rewrite is used in contrast to a "partial" rewrite, where only part of the system is replaced. It's called a "full" rewrite because the goal from the start is to fully replace the system with new code.

Consider that if this were not true, then there would be no way to describe an incremental full rewrite, nor any way to describe a from-scratch replacement of a subsystem.

I've written on this topic before, for example https://increment.com/software-architecture/exit-the-haunted...

Re:Ask HN: Inherited the worst code and tech team I have eve... by gamegoblin on Saturday September 17, 2022 @10:23PM (#32883792)
He’s saying to Ship of Theseus the codebase. Don’t build a new ship and then burn down the old ship. Replace the old ship piece by piece in place.
Re:Ask HN: Inherited the worst code and tech team I have eve... by lordnacho on Sunday September 18, 2022 @02:56AM (#32885129)
That only works if the new pieces correspond to old pieces. If there's no good structure to build on, the units to be replaced will constrain the architecture of the new ship.

At some point you end up trying to change a pumpkin boat into an aircraft carrier, and there's no obvious way you can do that one piece at a time.

Re:Ask HN: Inherited the worst code and tech team I have eve... by hither_shores on Sunday September 18, 2022 @05:35AM (#32885939)
> If there's no good structure to build on, the units to be replaced will constrain the architecture of the new ship.

Which is why you do it in stages: add scaffolding until local rewrites are possible, then rewrite the business logic, then tear the scaffolding down.

Re:Ask HN: Inherited the worst code and tech team I have eve... by lordnacho on Sunday September 18, 2022 @05:58AM (#32886074)
That's a good analogy actually. Scaffolding is a kind of temporary test structure that you can use to maintain function while you figure out something better.
Re:Ask HN: Inherited the worst code and tech team I have eve... by 41b696ef1113 on Sunday September 18, 2022 @04:49AM (#32885701)
Maybe there are some underlying architectural problems that need to be addressed, but it would be impossible make those changes from the current situation. It sounds like it is impossible to even know what code is live vs sitting on the server. How do you even know you have a firm grasp on the current architecture when it is unclear what code is even running the product?

A lot of low hanging fruit to be addressed that will likely lead to meaningful improvements. Once the code is in better shape and some unfortunate legacy pattern is identified, than it can be considered time to re-tool the architecture.

Re:Ask HN: Inherited the worst code and tech team I have eve... by lordnacho on Sunday September 18, 2022 @05:17AM (#32885844)
Agreed. The first thing to do is figure out WTF is going on. This is perhaps the hardest kind of thing to do as a developer.
Re:Ask HN: Inherited the worst code and tech team I have eve... by peteradio on Saturday September 17, 2022 @10:23PM (#32883786)
Full rewrite generally means stop the presses we are gonna migrate this whole thing from here to there and no new features until it's done (hint it never gets done).
Re:Ask HN: Inherited the worst code and tech team I have eve... by hamandcheese on Saturday September 17, 2022 @10:25PM (#32883803)
I’ve only ever witnessed ship-of-Theseus style migrations and those also never get done.
Re:Ask HN: Inherited the worst code and tech team I have eve... by peteradio on Saturday September 17, 2022 @10:27PM (#32883821)
Does not compute... Ship of Theseus is just regular old development of course it never gets done but new features aren't put on hold.
Re:Ask HN: Inherited the worst code and tech team I have eve... by hamandcheese on Saturday September 17, 2022 @10:37PM (#32883890)
I mean like “we want to replace X with Y”. Y incrementally starts replacing X, but 100% migration is never achieved, meaning double the API surface area exists indefinitely.

Because the migration doesn’t block new features, that means the org gets tired and reallocates the effort elsewhere before it’s ever done, with no immediate consequences. Rinse and repeat.

Re:Ask HN: Inherited the worst code and tech team I have eve... by bckr on Sunday September 18, 2022 @01:30AM (#32884672)
I think you've not witnessed Ship of Theseus, but "build Ship2 next to Ship1 and start using Ship2 while Ship1 is still being used and keep saying you're going to migrate to Ship2 eventually but meanwhile Ship1 and Ship2 diverge and now you have 2 ships".

I recently witnessed this mess and it is an enormous mess. Don't build Ship2 in the first place. Instead, replace Ship1's mast and sails, and rudder etc until you've replaced all the parts in Ship1. That's the SoT approach.

Re:Ask HN: Inherited the worst code and tech team I have eve... by hamandcheese on Sunday September 18, 2022 @02:37PM (#32890150)
Right but how do you replace the masts? Don’t you have to build mast2 and then tear down mast1 if you want to have continuous propulsion?
Re:Ask HN: Inherited the worst code and tech team I have eve... by bckr on Sunday September 18, 2022 @03:21PM (#32890598)
Yes, can you see how that's quite different from building a second ship?
Re:Ask HN: Inherited the worst code and tech team I have eve... by hamandcheese on Sunday September 18, 2022 @04:31PM (#32891221)
In my comment, X and Y are different masts, not different ships.
Re:Ask HN: Inherited the worst code and tech team I have eve... by bckr on Monday September 19, 2022 @02:39AM (#32895025)
I understand now.
Re:Ask HN: Inherited the worst code and tech team I have eve... by jmillikin on Sunday September 18, 2022 @04:35AM (#32885631)
A "full rewrite" means that after the completion of the rewrite, the old code has been fully replaced by new code.

What you're describing is a "stop-the-world" rewrite.

Re:Ask HN: Inherited the worst code and tech team I have eve... by kingofpandora on Sunday September 18, 2022 @10:36PM (#32893655)
I think you are being needlessly pedantic. Everyone understands that "full rewrite" means "restarting from scratch" in this context, especially since the poster was very clear that eventually everything will be touched.
Re:Ask HN: Inherited the worst code and tech team I have eve... by Operyl on Saturday September 17, 2022 @10:24PM (#32883801)
They’re saying to do it, eventually, incrementally and not all at once.
Re:Ask HN: Inherited the worst code and tech team I have eve... by majikandy on Sunday September 18, 2022 @06:24PM (#32892064)
And critically… never completing an incremental rewrite doesn’t matter. Everything remained working the whole time and continues to make the company money. And as a bonus, you were also able to make feature changes that the business wanted at the same time. It’s classic XP, when the money runs out, the system still works!