"Legacy code" is often code that you want to replace because you don't understand it. The problem is, before you can replace it, you need to understand it, and, once you understand it, replacing it is rarely the cheapest option any more.

#SoftwareEngineering

@jbqueru

Q.V.: Chesterton's gate/fence

https://fs.blog/chestertons-fence/

Chesterton’s Fence: A Lesson in Thinking

A core component of making great decisions is understanding previous decisions. If we don’t understand how we got “here,” we run the risk of making things much worse.

Farnam Street

@n_dimension @jbqueru There's an excellent bit of wisdom in “Do not remove a fence until you know why it was put up in the first place.”

It's so apt for fences, legacy code, and regulations. None of these things spring up just for fun, yet too often there is a rush to discount the blood, sweat, and tears that went into them because the problem that they're alleviating is no longer apparent.

@dotjayne @jbqueru

Kinda obliquely related.
But it's such a sweet story, and it was well conveyed by Peter Jurasik, that I retell it whenever the slightest excuse arises.

Lando Mollari, an imperial Ambassador of the ancient and failing star Centari empire in "Babylon 5", tells a parable.
Of a child princess, who saw a tiny, pretty flower spring from between the stones of the parade ground.

Fearing it would get trampled by the troops, she placed a soldier to stand guard over the flower.

Years have passed.
The flower is long gone.
The princess is long gone.
The guard still stands there, in what seems to be a random spot on this huge parade square.

You can choose to look at it as a tale of bloody mindedness.
I, like Lando, think it's a beautiful tale of how purpose and order still prevails long after the need had gone.

#babylon5

@n_dimension @dotjayne @jbqueru lovely.

Of course in IT we have a workaround as such. it's not pretty. I've generally heard it called "see who screams".

That is, in a working system, if the gate (or the guard) is of use, someone will probably notice if it is removed and tell you why it was needed; if so, you can put it back.

In my experience this works well about 70% of the time. The other 30% of the time it's a ticking timebomb…

@fishidwardrobe @dotjayne @jbqueru

Counterpoint:
I think it was Knuth who said "If houses were built the way programmers code, the first woodpecker would collapse the civilisation"

A case in point to reinforce the non-destructive approach the Chestertons Gate...

...maybe just rename to OLD_ChestertonsGate.Production 😁

@fishidwardrobe @n_dimension @dotjayne Oh, I love scream tests, and I've done quite a few for those scenarios where you're not sure yet that something can be deleted.

@jbqueru @fishidwardrobe @dotjayne

...and you get to look like a hero for "restoring" the service.
😁

@jbqueru @n_dimension @dotjayne I can never work out whether I love them or not. I've multiple times had cause to think, after the shit has hit the fan, "ohhhhh. THAT'S what that was for…"

@fishidwardrobe @n_dimension @dotjayne As a leader, I've internalized that my job mostly involves making choices between options I don't like, in situations where there's not enough information. I don't get to say that we shouldn't have ended up in such a bad situation.

A scream test is a great way to clarify how much I should dislike deleting that code, to gather information that allows me to move forward. So, I love them.

@jbqueru @fishidwardrobe @dotjayne

"Scream Tests, a more exciting alternative to boring documentation"

~ Wulfy