45 points · by Tomte · 10y ago · 26 comments
Sometimes you'll come across some crazy nested conditional that seems to be checking for cases that can't even happen. It's tempting to say "this is nuts, I'll just rewrite this whole overgrown method into two lines!". Sometimes that's even a good idea. But some programmer before you thought that crazy code was worth writing, and you might want to check `git blame` and see if you can figure out why.
Example: A while back I ran across a pretty rare race condition in some pretty gnarly distributed code. But there was an obvious fix, so I opened up the file where the fix should be made and found...
...someone else already had made that fix. Except it was in a conditional block which boiled down to "if (false) {...}". The fix would never run! No matter, it would be the work of 10 seconds for me to fix the conditional and push this code to production.
But first, I checked the logs. One of my colleagues had written this code (so that the fix would run) about two years ago. And then 20 minutes later he had committed a hotfix to stop the code running. Reading between the lines, the "obvious fix" clearly broke something less obvious and even more important somewhere else in the gnarly distributed code. That "broken" conditional wasn't a bug, it was a fence, and it had been erected for a good reason. And the race condition I found was really rare, and the whole gnarly distributed code is slated to be refactored next year, so...I left it.
(Now, the lack of comments explaining all that in the code base, and the fact the broken code was still in the code base just locked behind an always false conditional...those were issues. Then again, stuff like that happens in real code bases, even if they shouldn't. If you expect live to be completely tidy and well behaved, reality is going to be really confusing sometimes.)
The Chesterton's Fence story has always bothered me. The moral puts all blame on the person challenging the fence for not coming to the same conclusions as the builder.
For the person building the fence, it's easy to assume that the purpose of your work is self-evident, but the truth is that it is hard for anyone else to put together the facts as you saw them, and it's harder still to reason the same way you did. So just thinking really hard about the reasons for the fence's existence will not necessarily lead to a correct -- or even desirable -- result. The story's moral may as well have been: "What I did is more important than what you want to do." Or: "Fear change."
I'd rather see a dual lesson drawn from the same story: "If what you are doing is important, it's just as important to make it clear why it is important."
This particularly applies in the context of software development, when a little effort to make the rationale of some code more clear can pay off over the dozens to hundreds of times the code must be read and rejustified.
Responsibility is about the manner in which decisions are made. We should always be a little cautious about change for the same reason that we look both ways before crossing the road.
* the machine that depends on the data was brought into service before you were born
* the programmer who wrote the original software in VB died of cancer--10 years ago
* the first machine operator who spec'd out the software retired--after a long and full career
But you, having been here 6 whole months, decide that it's time to move this folder because it's stupid that it's not with all of the other similar files?
Thus: Steve's Rule of Enterprise Systems: if you yourself don't fully understand why it is the way it is, don't touch it.
...too bad that it seems wrapped around (imho) making a case for bigotry against same-sex marriage (and seemingly presenting it from a Mormon perspective).
Do I agree with the idea that one should "look before you leap"? Certainly; maybe the old process had a purpose and should be kept.
But not when it is to the detriment or isolation of a particular class or group of people (especially on seemingly pure quasi-religious grounds).
(Ducking all the incoming downvotes - I'm keenly aware of how unpopular this position is, and how bigoted it seems to most folks these days - which sort of proves my point.)
The other possibility that you seem to implicitly dismiss is that the original reasoning is understood perfectly well, has been debated to death, and has been found to no longer align with what the majority of people want out of society.
Chesterton's Gate argues against removing the fence out of haste and ignorance, but not against removing it after intense debate and careful consideration.
- Lois McMaster Bujold, "A Civil Campaign"
We just happen to be living in a society that's in the middle of its way from point A to point B.
People kept trying to explain their reasoning against same-sex marriage but failed, which almost everyone sensible takes to mean that line of reasoning is now invalid. I never heard an argument against it that was even coherent, other than the pure theological command ones.
Read the article again; toward the end it discusses this. It'd be one thing if I brought it up and it wasn't talked about in the article - but it clearly is discussed...?
Other than referring to Chesterton's Fence, they don't really intersect.
http://ldsmag.com/the-parable-of-chestertons-fence/
But the primary link is to
http://abovethelaw.com/2014/01/the-fallacy-of-chestertons-fe...
Neither currently seem to require a cache link.
That's not to say I disagree with the content of the article. I think it presents a good approach to promoting improvements to processes, the key takeaways being:
1) Observe the process and try to understand all aspects of it (not just that which affects you).
2) If you still feel that it can be improved, come up with a plan to improve and implement the process in a limited scope over which you have control.
3) If successful, break down why it was successful, and evaluate whether it is suitable to be expanded to the general case.
4) Find the owner of the existing process to discuss it with them, and present your proposed improvements.
I think there's an argument to be made that you should talk to the owner of the process before you start coming up with improvements, which could save some time on understanding it. But I suppose that depends on the situation.