Linux.com

Garbage. Disappointing garbage.

Posted by: Anonymous Coward on January 25, 2007 07:37 AM
God. I've had enough of hard-coded echo/print statements, lack of templating, and all that to last me a lifetime. I used to code that way, and it bit me in the *** too many times.

The first thing I do when I see a PHP article nowadays is look for that. If I find it, I gather that the writer probably doesn't know what he's talking about and skip the article. Everyone's a PHP expert nowadays. And everyone does it wrong.

And hmm...going back and looking at his is_numeric() check proves that my initial instinct was right. Read the f***ing manual. <a href="http://php.net/is_numeric" title="php.net">http://php.net/is_numeric</a php.net> The is_numeric() function allows all kinds of crazy inputs, including floating point values. BAD! Why not just use intval() on the "querystring" epoch value? The result is always an integer -- 0 on bad input. Instead this code bails out of the entire webpage with an exit() call. Yeah. I really want my calendar component silently ending the page instead of gracefully recovering or invoking some kind of error handling or error message.

Yes, I know that it's easy enough to retro-fit in some kind of templating system, but why should I have to? I can write a better calendar that serves my exact needs in less time than it would take to do so and fix any limitations/bugs that get in my way.

It's especially shocking that an ASP.NET programmer would write garbage like this, when ASP.NET itself is heavily based around objects and templating, with huge obvious benefits such as<nobr> <wbr></nobr>...code reusability. Yes, the very reusability the author is trying to tout as a reason to use this garbage calendar component. Hmm. I'd love to see the author put 5 copies of this calendars into one page. Lots of copy and paste and find and replace, I'm feeling. As much as I think objects are overused and (wrongly) considered to be the answer to everything, the ugly guts of this are just screaming and begging to be encapsulated into an object, or even just a few really-well-thought-out functions.

Disappointing.

#

Return to A DIY calendar control in PHP