General Discussions

The Story of X

Okay. We know that we need to get better in logic. This happens in many ways.   One is to understand the complete picture of the problem we are working. Understanding the scenarios is important in the programming context. One needs to understand the type of environment we are now working in. Let us consider an example program that we want to search for a value x. Look at the scenario clearly.

x

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 are not asking the right person for the value of x?

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?

Do you see that all? There were so many questions for that one simple task.  Understanding the problem and having the bigger picture makes you think of all the conditions one needs to handle. And yes, that’s good! Well, ‘x’ does not come that easy.

Advertisements

One thought on “The Story of X

Let me Know What you Think!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s