This blog has little bit of everything...

Saturday, October 31, 2015

The Logic Challenge For Software Engineers


What is the difference b/w being good at programming and being good at logic?

Let us examine with a great example which shows how and why logical reasoning is the most important skill a software programmer should possess.

Tom, a computer graduate from a world class Institute/ University, goes for an interview in an Indian software company.

The interviewer is James, a grubby old man. And the first question he asks Tom is, `How good are you at logic?'

`I'd give a nine or may be a ten on ten to myself,' replies Tom.

`Let me test you,' replies James. `Two men come down a Smokestackchimney. One comes with a clean face and the other comes out with a dirty face. Which one would wash his face?'

Tom stares at James. `Is that a test in Logic?' James nods.

`The one with the dirty face washes his face', Tom answers wearily.

`Wrong. The one with the clean face washes his face. Apply the simple logic. The one with the dirty face looks at the one with the clean face and thinks his face is clean. The one with the clean face looks at the one with the dirty face and thinks his face is dirty. So, the one with the clean face washes his face.'

`Hmm. I never thought of that," says Tom. `Give me another test.'

James holds up two fingers, `Two men come down a Smokestack/ chimney. One comes out with a clean face and the other comes out with a dirty face. Which one washes his face?'

`We have already established that. The one with the clean face washes his face.'

`Wrong. Each one washes one's face. Apply the simple logic. The one with the dirty face looks at the one with the clean face and thinks his face is clean. The one with the clean face looks at the one with the dirty face and thinks his face is dirty. So, the one with the clean face washes his face. When the one with the dirty face sees the one with the clean face washing his face, he also washes his face. So each one washes one's face.'

`I didn't think of that!' says Tom. `It's shocking to me that I could make an error in logic. Test me again!'

James holds up two fingers, `Two men come down a Smokestack. One comes out with a clean face and the other comes out with a dirty face. Which one washes his face?'

`Each one washes his face.'

`Wrong. Neither one washes his face. Examine the simple logic. The one with the dirty face looks at the one with the clean face and thinks his face is clean. The one with the clean face looks at the one with the dirty face and thinks his face is dirty. But when the one with clean face sees that the one with the dirty face doesn't wash his face, he also doesn't wash his face. So neither one washes his face.'

Tom is desperate. `I am qualified for this job. Please give me one more test!'

He groans when James lifts his two fingers, `Two men come down a chimney. One comes out with a clean face and the other comes out with a dirty face. Which one washes his face?'

`Neither one washes his face', Tom replies, `I have learnt this logic.'

`Wrong, again. Do you now see, Tom, why programming knowledge is insufficient for this job? Tell me, how is it possible for two men to come down the same chimney, and for one to come out with a clean face and the other with a dirty face? Don't you see the flaw in the premise?'"


Read Another Article 

How Much Do Indian Professionals Save In USA?