Reply to Re: do professional PHP programmers use error checking in their code?

Your name:

Reply:


Posted by Andrew Poelstra on 09/02/06 04:54

"lawrence k" <lkrubner@geocities.com> writes:

> I've made it habit to check all returns in my code, and usually, on
> most projects, I'll have an error function that reports error messages
> to some central location. I recently worked on a project where someone
> suggested to me I was spending too much time writing error messages,
> and that I was therefore missing the benefit of using a scripting
> language. The idea, apparently, is that the PHP interpreter writes all
> the error messages that are needed, and that I shouldn't write such
> code myself. I was given the impression that if I needed extensive
> error checking, or strict typing, then I should use a real language,
> like Java, but if I'm going to use a scripting language like PHP or
> Ruby, then I should leave errors to the interpreter, since the whole
> point of using scripting languages is speed of development. Has anyone
> else heard this argument, and do you agree with it? I'm wondering how
> other PHP programmers handle error messages. Check everything or leave
> it to the PHP interpreter to tell you when there is an error?
>
> Which of these two functions is better, the one with error checking or
> the one without?
>

The one with error checking.

/Always/ check for errors and print a meaningful message. The interpreter
can't do that for you, no matter how impressive it is.

/Always/ comment your code, and for large projects, keep your design
documents around (you do make design documents, right?). It'll save
time and money in the long run.

And by long run, I mean more than two weeks after the code is finished.

--
Andrew Poelstra <http://www.wpsoftware.net/projects>
To reach me by email, use `apoelstra' at the above domain.
"Do BOTH ends of the cable need to be plugged in?" -Anon.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация