Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Advantages of OO-ish exception handling..

by premchai21 (Curate)
on Dec 22, 2001 at 09:25 UTC ( [id://133939]=note: print w/replies, xml ) Need Help??


in reply to Advantages of OO-ish exception handling..

Inheritance. You can then test for the type of exception caught using isa (or its equivalent in whichever language you're using). This way, you can partition the set of possible exceptions into useful subsets, and deal with each subset individually.

  • Comment on Re: Advantages of OO-ish exception handling..

Replies are listed 'Best First'.
Re: Re: Advantages of OO-ish exception handling..
by vladb (Vicar) on Dec 22, 2001 at 12:23 UTC
    Precisely!

    And on top of it, you can do it at verious stages of your execution (aka layers). Some errors may have to be dealt with in lower levels (nearer to, says, system 'layer') and thus not visible to upper layers that shouldn't really be concerned with certain details.

    isa() calls is certainly a great way to approach this. It is also much more clearer than dealing with static die strings ($@). Certainly, static strings, by their nature, do not allow for the complexity (i should rather say, flexibility) that OO offers.

    On the other hand, it may be more justifiable to actually not use OO-ish excpetion handling methods in simple code and therefore avoid going through the 'extra hoops' in order to yield no noticable reward.



    "There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://133939]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 07:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found