Page 131 -
P. 131

files and exceptions





                                                Tonight’s talk: Approaching runtime errors with extra code
                                                and exception handlers






           Extra Code:                                           Exception Handler:
           By making sure runtime errors never happen, I keep
           my code safe from tracebacks.
                                                                At the cost of added complexity….

           Complexity never hurt anyone.
                                                                 I’ll be sure to remind you of that the next time
                                                                 you’re debugging a complex piece of code at 4
                                                                 o’clock in the morning.

           I just don’t get it. You’re more than happy for your
           code to explode in your face…then you decide it’s
           probably a good idea to put out the fire?!?

                                                                Yes. I concentrate on getting my work done first and
                                                                 foremost. If bad things happen, I’m ready for them.

           But the bad things still happen to you. They never
           happen with me, because I don’t let them.
                                                                 Until something else happens that you weren’t
                                                                 expecting. Then you’re toast.
           Well…that depends. If you’re smart enough—and,
           believe me, I am—you can think up all the possible
           runtime problems and code around them.
                                                                 Sounds like a whole heap of extra work to me.

           Hard work never hurt anyone.
                                                                You did hear me earlier about debugging at 4 AM,

                                                                 right? Sometimes I think you actually enjoy writing
                                                                 code that you don’t need…
           Of course all my code is needed! How else can you
           code around all the runtime errors that are going to
           happen?
                                                                Yeah…how many?

           Um, uh…most of them, I guess.
                                                                You don’t know, do you? You’ve no idea what will
                                                                 happen when an unknown or unexpected runtime
                                                                 error occurs, do you?
           Look: just cut it out. OK?

                                                                                       you are here 4    95
   126   127   128   129   130   131   132   133   134   135   136