Re: MySQL class. Thoughts?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 21, 2009 at 02:30:00PM -0600, Jay Moore wrote:

> Good ideas guys.  The input is much appreciated.
>
> Jochem (and anyone else, I guess), as I am not 100% versed with
> Exceptions, the php5 version you suggested, are those Exceptions able to
> be handled outside the class?
>
> Do I need my try block to be within the class block, or can I have the
> try block be in my normal code where I actually instantiate the class?
>
> This:
>
> class blah
> {
> 	try { stuff } catch (exception) { more stuff }
> }
>
> $i = new blah()
>
> or can I do this:
>
> class blah
> {
> 	do some stuff (no try/catch blocks here)
> 	throw an exception
> }
>
> try
> {
>
> 	$i = new blah();
> 	more stuff
> }
> catch (exception) { even more stuff }
>

I know it's very OO-y to use exceptions, but I hate them. They're like
setjmp/longjmp calls in C, and they're a really headache to deal with.
If you don't use default or predone handlers, you have to put all kinds
of try/catch blocks around everything. They make for non-linear
execution, and I prefer my code to execute in a linear fashion.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux