Hi,
On Sep 16, 4:08 pm, Cliff Black <[email protected]> wrote:
> Catching of errors and dealing to them is critical to developing any 
> application.

Perhaps we're talking about different things here. Consider that we're
implementing the backed for a bunch of embedded devices. These devices
send GET requests to the server. Over time the firmware on the devices
has evolved and now more information is passed through the URL. The
newer devices have firmware which supports retry (but is optional) and
the older devices know nothing about how to request retry (and
couldn't deal with the result if they could).

This simple bit of code does everything we want, and behaves exactly
as we want.  There's no error here that we aren't checking (even
though we've suppressed a notice), and our code will always do exactly
what's expected.  It's simple and clean:

if ( @$_GET['retry'] ) {
     ...
}

It's important to understand that the purpose of notices is to
indicate the potential for error or problem, it's not an error.  We
should turn them on, but also feel free to suppress them when the
messages won't tell us anything useful.  If we have to gratuitously
code around them, then something is very, very wrong.

Best practice in PHP should not be to introduce a branch (even if it's
in the form of a ternary operator) just to deal with a notice we don't
care about. Exceptions were not developed because the best programming
solution is to pollute code by testing everything, everywhere. Using
this construct in this situation adds nothing except complexity.


> Being lazy and ignoring the issue is not the answer.

I certainly work long hours striving to be lazy because i'm an
engineer!
 
http://www.associatedcontent.com/article/711177/are_smart_people_lazy.html?cat=7

-Craig

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to