Re: exceptions

From: Date: Tue, 08 Jun 2004 13:58:04 +0000
Subject: Re: exceptions
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30169@lists.php.net to get a copy of this message
Lukas Smith wrote:
Again, PEAR is not for beginners unless by beginners you mean people who are familiar with object-oriented development, templating in PHP, understand the need for db abstraction ... etc.
Thats the type of beginner I was taling about.
Then I think that type of beginner is probably very, very capable of catching exceptions.
Now the question is are the alternatives really that much uglier. I think not.
Yes, the alternatives are far uglier as they require many more constructs -- whether if/then or conditional premature function return, etc. They require many more lines of code and accomplish far less.
Hmm I think you dont understand what I meant when I said "misuse exceptions for code flow". With that I mean using exceptions as a means to jump out of a given context while passing along data where no error occured.
Right, of course they should only be used for errors .... I'm not arguing that exceptions should be used for flow control in a non-error context. I think most if not all developers will agree on that one. There are certainly some grey areas ... e.g. should a ValidationException be thrown from a validate() method? Probably not, but perhaps it does make sense to throw such an exception from a save() method. Anyway, no one ( at least not me ) is arguing for abuse of exceptions by throwing them when no error actually occurred. Hans

« previous php.pear.dev (#30169) next »