The programmer’s dilemma?? Well, I would call it so. Not that I am jumping to the conclusion without reasoning.
Look at the scenario. The problem was simple with a too simple solution. I wanted the value of ‘x’ and I ask for an ‘x’. Either I get back the value of it or an answer ‘unknown’. The scenario is not the same any more. Why is it not the same?
Programmer now needs to handle way more than expected number of conditions. We ask for an ‘x’ and we get back the value or no value, is the routine thinking. Now added to that are few more things, which a programmers needs to exhaust while he obtains the result.
What if you are asked to wait! The value is being computed and there is a delay. Or it’s coming over the network and there is a delay. Is your code ready to wait? If yes, for how long?
What if you get blocked? And result is never returned? Neither have you got an error status nor an exception. The request is blocked and there is no permission. Are you ready to throw a suitable message? And realize that you were blocked?
What if you go dangling? And get a 404 error. What if the computation to get ‘x’ was pushed somewhere else?
What if you have got the result with some disturbance? There could be a positive or negative deviation in the result obtained. Will you ask a few more times and take an average? If yes, how many times? Is there a threshold?
The challenges are many. A programmer has to become an exhaustive web programmer! Or would there be a language which would inline the thinking towards the direction?