Reply to Re: how do professional PHP developers handle defaults for function parameters?

Your name:

Reply:


Posted by lawrence k on 07/13/07 17:17

On Jul 7, 10:12 pm, gosha bine <stereof...@gmail.com> wrote:
> pangea33 wrote:
> > There are two options here. You can create your function with a static
> > set of arguments that fails when it is called with missing parameters,
> > then counter with the retort that the dude who called it was a "bad programmer."
>
> Yes, someone who calls a function with wrong arguments is a bad (or
> simply careless) programmer.

"Bad programmer" sounds almost like a moral judgment. Which is fine,
but it wasn't what I was looking for, exactly, with my original post.
I'm looking for what is considered effective. I may have poorly
phrased my concerns. I guess what I'm looking for is other people's
opinions on whether PHP's built-in error messages are an effective way
to manage large projects. (For me, a large project is one that has 10
people working on it.) I was writing long error messages because I
thought they provided more information to my teammates. Do you feel
PHP's error messages are effective in communicating to others what
problems might arise from the code?

It seems to me that every project will have errors, and somehow those
errors must be fixed. We all hope to keep the error-fixing time to a
minimum. Does it save any time to write a lot of error messages? If I
don't write error messages, then I put the burden of finding the
problem onto programmer who has called a function with the wrong
number or type of parameters. (The "wrong type" scenario is usually
harder to debug than the "wrong number" scenario.) They can read the
documentation and perhaps figure out the problem. Has time been saved
if I invest time in writing the documentation, and they invest time
reading the documentation? I've wondered sometimes if more time would
be saved simply by writing highly detailed error messages. It isn't a
terrible way to communicate with one's teammates.



> > This is totally useless when your production sites are
> > throwing unnecessary errors.
>
> You do test your software before it goes production, don't you?

Is the argument that error messages can be done away with so long as
one has a unit test for every possible error? I've thought about this.
I'm going to try this on my next project: no error messages, just unit
tests. We'll see how that goes.

[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

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