Live data from Hacker News

A Parable by Dijkstra (1973)

cs.utexas.edu

91–100 of 107 posts

Re: A Parable by Dijkstra (1973)

#91
post #3

For those who want to see Dijkstra's mathematics of programs in action: 1) basic (great for kids, math novices, whatever): https://www.amazon.com/gp/product/0470684534/ref=dbs_a_def_r... (ignore the two star review, this book would get 5 stars from me) 2) advanced (free, complete with videos): http://www.cs.toronto.edu/~hehner/aPToP/ 3) advanced: https://www.amazon.com/gp/product/0470848820/ref=dbs_a_def_r... 4) adva…

I learned this stuff from Roland's 'Program Construction'. Great book. Once you've been through that, then suddenly Dijkstra's writing becomes really practical.

Re: A Parable by Dijkstra (1973)

#92
post #55

This solution is wrong. Rolling stock needs maintenance, and if you keep units permanently paired you can easily run out of units. In fact there is no easy solution given realistic business constraints. You can either put toilets in every car, which has a cost because it reduces available seating. In the best case you’ll lose money because of the lost seats. In the worst case overcrowding will make the toilets ineffe…

It's a parable which means it is fiction that that ignores details to make a point. As such it does it's job quite well unless you yet to read more into it than the author intended.

To me this says that parables are fairly useless: with enough padding any trivial insight may seem wise. I can't at the moment imagine something that I would think important to communicate which would be made more clear by a parable. I would also be concerned about being patronizing. I'm sure this makes good fodder for academic quibbling, but I am beginning to doubt whether Dijkstra was more insightful than arrogant.

Re: A Parable by Dijkstra (1973)

#93
post #2

Since we're talking about Dijkstra, thought I'd bring up the letter he wrote to the University of Texas when they replaced Haskell with Java in their introductory programming course: https://chrisdone.com/posts/dijkstra-haskell-java https://www.cs.utexas.edu/users/EWD/OtherDocs/To%20the%20Bud...

I absolutely adore Djikstra's stubborn and always eloquent insistence on rigor and purity in CS education, his unabashed refusal to see even one tendril of its mathematical connections be sacrificed for mere code production efficiency. If this case isn't going to be made at the university level, then where?

I agree with you! Something I've wondered, though, is how he would propose writing a formal specification for, say, a graphical application. Does anyone know?

Re: A Parable by Dijkstra (1973)

#94
> I have told the above story to different audiences. Programmers, as a rule, are delighted by it, and managers, invariably, get more and more annoyed as the story progresses; true mathematicians, however, fail to see the point.

I see the point. In fact I'd go so far as to call myself "delighted". But I thought I was a true mathematician.

'Scuse me while I go have a little existential crisis.

Re: A Parable by Dijkstra (1973)

#96
post #71

This seems like it has potential for being the core of an interesting interview question. Maybe something along the lines of "You are hired as the Chief Shunter (lol) of a new rail company and the CEO, to cut costs, has stated that only half of all cars will have toilets. What instructions will you give the shunters? What complications could arise? What is the optimal solution and how would it impact UX?" etc. etc.

Often people is nervious at job interviews. It might not be the best place for this sort of creative problems.

Re: A Parable by Dijkstra (1973)

#97
post #66

I guess the ultimate solution assumes that all the turntables are long enough to deal with at least two-car consists? Seems strange that the company would cheap out on a little bit of porcelain in each car and then overprovision its turntables in such an extravagant way.

There is no longer a need to perform rotations on the car tuple because it can be treated as symmetrical.

Re: A Parable by Dijkstra (1973)

#98
post #26

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…

> 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 pa…

> 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.

Re: A Parable by Dijkstra (1973)

#99
post #73
post #26

Earlier quoted context omitted.

> 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 pa…

Indeed. 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. "

I 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.

Re: A Parable by Dijkstra (1973)

#100
post #64

The final paragraph is my favorite. I have a PhD in mathematics but I've since realized I'm not a mathematician, I'm more of a logician/philosopher. I find the parable very interesting, but I can totally believe a lot of real mathematicians don't. Too many mathematicians, if you crack open a random page of their work, you'll see lots of opaque integrals and calculations. None of that ever appealed to me. Even when I…

I don't think he was saying mathematicians don't find it interesting because it lacks sufficiently convoluted mathematics.

Rather a 'true mathematician' (who by definition ignores all practical considerations) would find it unsatisfactory because the problem of finding a way of allowing toilet-less carriages is solved by not allowing toilet-less carriages.

Frankly I think they should have just put the toilet in the middle of the toilet-carrying carriages, but maybe I'm weird.

Post reply on HN