Re: Mail_IMAP 2.0.0 alpha 1

From: Date: Tue, 06 Jul 2004 21:23:45 +0000
Subject: Re: Mail_IMAP 2.0.0 alpha 1
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31673@lists.php.net to get a copy of this message
On Tue, 06 Jul 2004 17:02:53 -0400, Hans_L <hans@velum.net> wrote: > Justin Patrin wrote: > >>>Yes, it does seem we are alone. I have seen maybe 2 messages in > >>>support of Errors. Everyone else says to use Exceptions for > >>>everything....even though Exceptions are *not meant for error > >>>handling*! > >>> > >> > >>What? Says who? ... that's exactly what they're designed for. > >> > > > > > > IMHO, they're not for general error handling, but for exceptional > > circumstances, which mostly halt a program. If you want to be able to > > handle errors, a return value is much more convenient and makes more > > sense than a try/catch block. It makes it obvious which call had the > > error and makes it obvious what code is run and what is not. > > Exceptions are, in my eyes, nearly as bad as gotos. It makes code > > harder to read and trace and can quite easily cause problems. > > > > Justin, I'm not sure what to say. In my applications errors are > exceptional, by definition ;) I can only assume that you have never used > exceptions. Well, regardless of how you formed that opinion it > certainly is your opinion, but in *my* opinion it runs contrary the > reason why Exception was added to the language -- certainly contrary to > the way exceptions work in any other language I know. > > A good reference (i.e. good = that I agree with ;) for how Exceptions > work and how to use them in PHP5 is George's book: Advanced PHP > Programming. It's an excellent book all around, really. > I have used Exceptions and I do agree that they make some things easier. But it makes it harder (IMHO) to deal with program errors in-code. Such as if you fail to connect to one server (say, FTP) you may want to try another before telling the user. In this way, it gies from an Error (Exception) in the code called to a warning in the code that is calling. This forces the app to use Exceptions for a kind of code flow, which is usually said to be bad. See my e-mail from earlier on for more. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

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