Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month at the Massachusetts Institute of Technology, in Building E51.

BLU Discuss list archive

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

[Discuss] php dev's code with warnings and notices

Eric Chadbourne wrote:
> The code they have...has a bunch of warnings and notices in the logs.
> I personally think this is sloppy coding.  My question is, how strong
> a stand should I take on this issue?

Part of this is going to depend on how practical it is to achieve "no
warnings" in PHP code. I don't know the answer to that. But if you are
accustom to achieving no warnings in your own PHP code, then yes, I'd
agree this is indicative of sloppy code.

Compiler/interpreter warnings can be a great tool for spotting problems.
One of the first things I do in web browsers used for development is
enable strict mode in the JS engine. I do likewise with MySQL. 'use
warnings' (or the equivalent achieved through other means) is stock
boilerplate for all Perl code I develop.

I'd never deliver Perl code that triggers warnings. But Perl also gives
you tools where you have fine gained control to override warnings in
situations where the best solution to a problem is to bend the rules a bit.

With JavaScript, that's a different matter, as not all browsers agree on
what constitutes a situation warranting a warning. And there are some
warnings, like "function doesn't always return a value" that can seem

As the senior developer, I'd definitely recommend setting the example by
delivering code free of warnings, and cleaning up the code you happen to
be touching for other purposes to eliminate warnings, but what you are
facing is a cultural problem, rather than a technical one, and that can
take time to change. If you're the only one submitting clean code, and
your coworkers aren't on board with the value in doing likewise, you may
find it to be a futile effort.


Tom Metro
The Perl Shop, Newton, MA, USA
"Predictable On-demand Perl Consulting."

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /