Infinity Puzzle 3

Long long ago when I had freshly gotten out of college and stepped into my first job, my first boss asked me a question:
Can an error-handler contain an error handler ?
For the uninitiated, and error handler is a part of the software code which looks for errors in the rest of the code and massages them so the program keeps running with minimal losses.
Now, I do not know the answer to this question. Some programming languages allow this kind of nesting and some do not. But tell me this:
What if we had a piece of code and wrote an error-handler inside it. What if we then decided that this error-handling code itself was prone to errors and we wrote, in turn, another error-handler inside this smaller part..and so on and forth ?
How far can we go like this ? (assuming that the programming language does not offer any restrictions of its own).
Could we go on for ever ? Would we reach a stage where the error handler itself would be as small as a single statement ? Is there any guarentee that a single statement is not prone to errors ?

Advertisements

One Response to “Infinity Puzzle 3”

  1. vaithianadan Says:

    Error Handlers are supposed to catch the unexpected situation that occurs in the code, not the semantic/syntax errors u do. Having said so, You are not supposed to write logic inside error handler, instead just log saying an exception occured and get out of the program(You can have error handlers inside another one though). In general, it is a bad practice to have more than 7 looping statement, irrespective of language and its capability. It destroys readability of the code. Hope I answered your question. Am I in Java Forum?


Leave a Reply

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

%d bloggers like this: