Use the Mikado Method to do safe changes in a complex codebase - Change Messy Software Without Breaking It (understandlegacycode.com)
from HaraldvonBlauzahn@feddit.org to programming@programming.dev on 25 Feb 2026 19:20
https://feddit.org/post/26323207

#programming

threaded - newest

villainy@lemmy.world on 25 Feb 2026 22:44 next collapse

You’ve inherited a 300k lines of spaghetti code. What do you do now?

Quit.

NGL this Mikado Method sounds pretty good 😉

HaraldvonBlauzahn@feddit.org on 02 Mar 2026 05:30 collapse

You’ve inherited a 300k lines of spaghetti code. What do you do now?

Quit.

The grain of truth in this is that organizations which have accumulated a lot of technical debt tend to continue to be organizations which accumulate a lot of technical debt.

Let’s say you take a new student job as a kitchen helper in a restaurant, and on day one, you learn that people there don’t really wash the dishes - they just make them look somehow clean.

Do you walk to your boss and tell him: “Hey boss, I got an idea, we could wash our dishes, what do you think?”

It is different if you have more of a say, as in, you are the chef. You could leverage that good chefs are hard to find. You could point at customer reviews with complaints.

But as an apprentice, I would advise to look for a better kitchen. Especially since tidying up 300 k lines of spaghetti code will take many person-years.

thenextguy@lemmy.world on 26 Feb 2026 00:43 next collapse

I’m not a tdd guy, but I would reach for tests first. You don’t know the code yet. Testing is the only way to stay sane. And writing the tests if they don’t exist yet will help you learn the code.

kibiz0r@midwest.social on 26 Feb 2026 01:14 next collapse

Yes, but you do need to be careful with what level you test at. Too high level and the tests may be slow, flaky, and difficult to focus onto small details. Too low level and they may just bake-in the existing implementation.

thenextguy@lemmy.world on 26 Feb 2026 01:45 collapse

That was such a huge problem on my last job. Most of the unit tests just executed the code and didn’t really test anything and any time you changed the implementation everything broke.

Thankfully it was truly my last job. 😊

HaraldvonBlauzahn@feddit.org on 26 Feb 2026 05:55 next collapse

The thing is… to test such code, you often need to modify it first.

You see the problem?

thenextguy@lemmy.world on 26 Feb 2026 15:29 collapse

No. I don’t grant your premise.

dandi8@fedia.io on 26 Feb 2026 14:03 collapse

I think this is compatible with TDD. It's just fancy divide-and-conquer.

Redkey@programming.dev on 26 Feb 2026 04:25 collapse

The Mikado Method, eh?

(All together) Three junior devs at work are we,
Busy and harried as devs can be,
Compiler warnings flowing freely,
Three junior devs at work!

(Alice) Everything is a source of bugs! (Laughter)

(Bob) When they wrote this, were they on drugs? (Laughter)

(Carlos) Don’t touch our “World’s Best Coder” mugs! (Laughter)

(All together) Three junior devs at work!

HaraldvonBlauzahn@feddit.org on 26 Feb 2026 06:08 collapse

You have to imagine Alice, Bob, and Carlos 25 years later, working on production code that was created like this.

XKCD on this: m.xkcd.com/2730/

By the way, I am currently working on a 20 year old code base that was in production use all the years and was continuously adapted. At least the people who wrote this were (more or less) knowing what they were doing. I guess I should ask for a pay rise…