4 ms·
When the shunting person persuaded everyone to imagine the two-car units as if they were symmetrical, the passengers still complained. Toilets can break, and wh
by jancsika 8y ago
When the shunting person persuaded everyone to imagine the two-car units as if they were symmetrical, the passengers still complained. Toilets can break, and when they did the doubly unlucky passenger would be forced to walk four car lengths to get to the nearest toilet.
Also, those helpful arrows would be guiding the passenger the wrong direction for two of those car lengths.
So we have comments that go out of sync with the running program, a spec that lies about reality, and an implementation that doesn't match the spec. Yep, that sounds like programmers to me.
Legit parable.
Edit: just realized the least lucky passenger would have to walk six car lengths. If the passenger is already at the wrong end of the "symmetrical" two-car unit with a broken toilet, the arrow will point them in the direction of the broken toilet. If the broken toilet is the last car, then they must walk back two car lengths to get where they started. Now if the next two-car unit is turned the wrong direction they must walk two more car lengths.
So add to this a spec that's difficult to reason about.
Again, legit programmer parable.
- mikorym 8y ago> the least lucky passenger would have to walk six car lengths I just want to elaborate on this to show which assumptions you are making. There are two ways to make a paired unit: --+ and -+-. In your scenario I think you assume the first. The end of the train is thus ...+----+, since you mention the second last car's orientation being reversed. The +'s represent toilets. Then, what you are saying is to consider a passenger located at the ^ symbol: ...+--^--+. In this configuration, your observation makes sense. I do think that a more practical solution is to work only with (-+,-) pairs. The symmetry that Dijkstra talks of is then that (-+,-) and (-,+-) are equivalent for the purposes of the problem. Then an end of a train would be: ...-+-+-. This is then the "extra few feet" that he talks of.
- mikorym 8y agoCorrection on the second last sentence: "...-+--+-".
- mannykannot 8y agoYes, though I think the last three feet refers to the vestibule connecting the two carriages, which a passenger in the non-toilet carriage must traverse.
- mikorym 8y agoThanks, that does make sense. So he means three extra feet of travelling that our equivalence relation with (-,+-) ~ (-+,-) ignores.
- mcguire 8y agoIndeed. Dijkstra specifies two cars joined with the toilet in the middle: "When each car with a toilet was coupled, from now until eternity, at its toileted end with a car without a toilet, from then onwards the shunting yard, instead of dealing with N directed cars of two types, could deal with N/2 identical units that, to all intents and purposes, could be regarded as symmetrical."
- jancsika 8y agoI think what bothers me about this is that it's an analogy which crosses the digital divide. On the physical "train" side of the analogy, we've got a believable scheme to save money by only having a toilet in every other car. Given the constraints, it is indeed clever to make these two-car atomic units and reimagine them as symmetrical. All the fixes in the story taken together could pale in comparison to the cost of putting a toilets all the cars. But when we cross the digital divide we get a completely different set of constraints. Even if dealing with 100 million train cars it may be cheaper to just fork the entire train yard and add a toilet object to each car.
- jancsika 8y ago> I just want to elaborate on this to show which assumptions you are making. There are two ways to make a paired unit: --+ and -+-. Why are there three characters to represent a pair? Do you mean something like this: car with toilet: [+-] car without toilet: [--] my pair: [+-][--] your pair: [-+][--] ? > This is then the "extra few feet" that he talks of. Using my notation (sorry to flip it): [-+][--][-+][--] That's four cars. If someone is sitting at the right end of car #2, they have an arrow pointing them to car #1 for the toilet. If that toilet is broken, then they must walk back through car #2 all the way to the end of car #3. But I may be misunderstanding your initial notation.
- mikorym 8y agoYour bracket notation in effect works the same as mine. The difference is that -+- could be any of [-+][--] or [--][+-] by symmetry and so leaving out brackets. In my notation "+" is a character which does not occupy space. Hence [-+][--][-+][--] is the same as -+--+-. Sorry about the error earlier: "...-+-+-" was a typo that I couldn't edit anymore.