Nick Hodges should slap someone with his book and let him read the chapter about exception handling 10 times. ;)

Nick Hodges should slap someone with his book and let him read the chapter about exception handling 10 times. ;)

http://docwiki.embarcadero.com/CodeExamples/XE5/en/DirectoryOperations_(Delphi)

Comments

  1. That is..... hideous.  Exit calls?  Really?

    ReplyDelete
  2. seriously, exit() seems to be used way too often for escapes from try..end; maybe if you could declare variables in at the beginning of a new lexical-scope ala C+/C99 and it was all tight in the try..end.

    ReplyDelete
  3. LOL. I guess Nick Hodges was bot commander some time ago :)

    ReplyDelete
  4. Maybe it is some strange optimization? I just unable to find rational explanation for these Exits.

    ReplyDelete
  5. Actually the Exits are not the problem, its the except and catching all exceptions and saying 'Incorrect path'... Ya know, there can be other errors than an incorrect path.

    ReplyDelete
  6. That is at least understandable but why Exits?

    ReplyDelete
  7. True, the exception will catch any error and the programmer decided to respond with only a single error-message. Exception-Handling seems to be the lazy programmer's honey-pot, personally I think the language feature is partially to blame.

    ReplyDelete
  8. The point which many programmers seem not to understand is that exception handlers are to handle the exceptional cases, not the foreseeable errors. And when an exception handler is appropriate, the message should be clear, useful, and convey some meaning to others than simply the author of the code.

    ReplyDelete

Post a Comment