Live data from Hacker News

Use the Mikado Method to do safe changes in a complex codebase

understandlegacycode.com

21–30 of 88 posts

Re: Use the Mikado Method to do safe changes in a complex codebase

#21

Write tests. Most likely those 300k lines of code contain a TESST folder with 4 unit tests written by an intern who retired to become a bonsai farmer in the 1990s, and none of them pass anymore. Things become much less stressful if you have something basic telling you you're still good.

The best time to write tests was 20 years ago. The second best is now, provided you've applied to all the companies with better culture.

Re: Use the Mikado Method to do safe changes in a complex codebase

#22

This is a good method if you are stuck and you don't know what you need to do. It also helps explore a project with a specific task in mind. It is not very useful in giving you confidence your changes would not cause unexpected side effects, which is usually the main problem working with legacy code. If you want confidence when working with legacy code, your best bet is to do a strangler fig pattern - find a boundari…

Boundaries? Module? I laugh.

Re: Use the Mikado Method to do safe changes in a complex codebase

#24

This is a good method if you are stuck and you don't know what you need to do. It also helps explore a project with a specific task in mind. It is not very useful in giving you confidence your changes would not cause unexpected side effects, which is usually the main problem working with legacy code. If you want confidence when working with legacy code, your best bet is to do a strangler fig pattern - find a boundari…

Boundaries? Module? I laugh.

Then your first step is found! Make those boundaries. Isolate dcomponents so you can test them.

Re: Use the Mikado Method to do safe changes in a complex codebase

#25

This is a good method if you are stuck and you don't know what you need to do. It also helps explore a project with a specific task in mind. It is not very useful in giving you confidence your changes would not cause unexpected side effects, which is usually the main problem working with legacy code. If you want confidence when working with legacy code, your best bet is to do a strangler fig pattern - find a boundari…

Boundaries? Module? I laugh.

Replace "module" with "system" - every system has boundaries.

Re: Use the Mikado Method to do safe changes in a complex codebase

#26
post #20

Write tests. Most likely those 300k lines of code contain a TESST folder with 4 unit tests written by an intern who retired to become a bonsai farmer in the 1990s, and none of them pass anymore. Things become much less stressful if you have something basic telling you you're still good.

The problem with complex legacy codebases is that you don’t know about the myriads of edge cases the existing code is covering, and that will only be discovered in production on customer premises wreaking havoc two months after you shipped the seemingly regression-free refactor.

I agree. This is one area I'm hoping that AI tools can help with. Given a complex codebase that no one understands, the ability to have an agent review the code change is at least better than nothing at all.

Re: Use the Mikado Method to do safe changes in a complex codebase

#27
post #20

Write tests. Most likely those 300k lines of code contain a TESST folder with 4 unit tests written by an intern who retired to become a bonsai farmer in the 1990s, and none of them pass anymore. Things become much less stressful if you have something basic telling you you're still good.

The problem with complex legacy codebases is that you don’t know about the myriads of edge cases the existing code is covering, and that will only be discovered in production on customer premises wreaking havoc two months after you shipped the seemingly regression-free refactor.

[deleted]

Re: Use the Mikado Method to do safe changes in a complex codebase

#28

Earlier quoted context omitted.

Boundaries? Module? I laugh.

Replace "module" with "system" - every system has boundaries.

Some of them are notoriously spaghetti-shaped, and that’s hard to isolate and replace.

Re: Use the Mikado Method to do safe changes in a complex codebase

#29

So you do things one step at a time and timebox as you go? This method probably doesn't need its own name. In fact I think that's just what timeboxing is.

There are important additions beyond timeboxing, at least according to the post. Notably, reverting your changes if you weren't able to complete the chosen task in the time box and starting over on a chosen subset of that task. I can imagine that part has benefits, though I haven't tried it myself.

Re: Use the Mikado Method to do safe changes in a complex codebase

#30

So you do things one step at a time and timebox as you go? This method probably doesn't need its own name. In fact I think that's just what timeboxing is.

FWIW Mikado seems to be the name of that game where you pick up one stick at a time from a pile, while trying to not disturb the pile. (I forget the exact rules). So it isn’t as if somebody is trying to name this method after themselves or something, it is just an attempt at an evocative made up term. Timeboxing is also, right? I mean, timeboxing is not recognized by my spell checker (I’d agree that it is more intuit…

Mikado is the name of an opera (by Gilbert and Sullivan) in which someone is deemed to have been executed without actually having been executed. Sounds like an ideal test strategy to me: yes, all the tests were executed, just not actually run.
Post reply on HN