Re: MySQL class. Thoughts?

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

 



2009/1/21 Jay Moore <jaymoore@xxxxxxxxxxxx>

>
>  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.
>
> this also means you use a single return in a function ?

>
>>
>> Paul
>>
>>
> My thoughts exactly.  What do I gain by using a try/catch that I lose by
> using if/else or similar?

the power to omit it, and then change your mind  lather, and handle them.
The only problem is that php itself (nor core, nor extensions) throw
exceptions, so you can't threat errors uniformly, but you cant have a custom
error handler, and throw exceptions from there, and you can also have an
exception handler. I have used this approach in several projects, and i
admit it takes some getting used to, but it's an easy, clean, nice way to
handle exceptions / errors / conditions.

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


-- 
Torok, Alpar Istvan

[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