Re: exceptions
| From: | Lukas Smith | Date: | Tue, 08 Jun 2004 13:38:51 +0000 |
| Subject: | Re: exceptions | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30167@lists.php.net to get a copy of this message | ||
Hans Lellelid wrote:
Thats the type of beginner I was taling about.PEAR does aim to provide solutions to a wide audience, including beginners. We define how we want to code, but we have no mission to define how other people have to code. This is not in the spirit of a library. That is not to say that we should try to set good standards that other people may choose to adopt.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.
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. regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07Err, well this is indeed philosophical, but its hard to make a case that goto style programming is easy to follow. I have yet to see an example where you can't break out of the context in a clearer manner. Actually I was sitting in a session grom george in Amsterdam and I had a hard time following a code example. Turns out he was using an exception for code flow. Very nasty imho.Yes, I guess it's philosophical. Exceptions are certainly different than return-value based errors, but just because you don't feel comfortable following code that uses exceptions doesn't mean that PEAR classes should avoid them. Again, documentating exceptions in the API might help ...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.