Re: do professional PHP programmers use error checking in their code?
My own feeling, obviously, is that it is better to error check
In my personal opinion and experience, if I were a project manager and
I've heard the words "php will handle errors for you, why bother?" from
any of the programmers I work with, I would fire that person on spot.
It's HORRIBLE practice and it leads to lots of crap php code out there
and also the "not serious programmer" stereotype about php developers
(enforced mostly by java and c# folks - who (you've guessed it :) handle
their errors and exceptions). So my advice is handle all the errors, USE
the exceptions as much as you can, log errors for after analysis but
don't reinvent the wheel (e.g. don't reinvent the text of DB error
messages, just handle them and give them context).
--
B.r.K.o.N.j.A = Bionic Robotic Knight Optimized for Nocturnal Judo and
Assasination
My own feeling, obviously, is that it is better to error check
everything, and to write extensive comments everywhere. I've taken over
PHP projects, started by other programmers, that had no error checking
and no comments, and such projects are always a big pain in the neck. I
lose time playing Sherlock Holmes, trying to track down where a
function's parameter first originates and why it's in use. I'd rather
have a comment on it, and error message for when the wrong thing is
passed in. Obviously this slows development. Is there any concensus
among developers about what is the best approach? I think whatever is
cheapest for the client should be considered the best approach, but it
seems to me cheapest-in-the-short-term is quite different from
cheapest-in-the-long-term.
PHP projects, started by other programmers, that had no error checking
and no comments, and such projects are always a big pain in the neck. I
lose time playing Sherlock Holmes, trying to track down where a
function's parameter first originates and why it's in use. I'd rather
have a comment on it, and error message for when the wrong thing is
passed in. Obviously this slows development. Is there any concensus
among developers about what is the best approach? I think whatever is
cheapest for the client should be considered the best approach, but it
seems to me cheapest-in-the-short-term is quite different from
cheapest-in-the-long-term.
I've heard the words "php will handle errors for you, why bother?" from
any of the programmers I work with, I would fire that person on spot.
It's HORRIBLE practice and it leads to lots of crap php code out there
and also the "not serious programmer" stereotype about php developers
(enforced mostly by java and c# folks - who (you've guessed it :) handle
their errors and exceptions). So my advice is handle all the errors, USE
the exceptions as much as you can, log errors for after analysis but
don't reinvent the wheel (e.g. don't reinvent the text of DB error
messages, just handle them and give them context).
--
B.r.K.o.N.j.A = Bionic Robotic Knight Optimized for Nocturnal Judo and
Assasination
Comment