Friday, January 26, 2007

damn php coders

while rewriting/extending some website at work, i've found following Brilliant example of why php coders suck.

code:

Deadline days:
<select name="deadline_days">
<option value="20">20 days</option>
<option value="10">10 days</option>
<option value="5">5 days</option>
<option value="48">48 hours</option>
<option value="24">24 hours</option>
<option value="12">12 hours</option>
</select>


generated by some javascript code (we have around 150K of it in this project) and those values used all over there and in php code.

i'm coding in perl, and store this field as "20d" or "24h" in DB, so i was forced to write this:
my $days = param ('deadline_days');
if ($days == 24 || $days == 12 || $days == 48) {
$days = $days."h";
}
else {
$days = $days."d";
}
param ('deadline_days', $days);

to avoid examining and rewriting this ton of damn crap! js code.

6 comments:

Anonymous said...

don't mind on what programming language you are coding. such annoying error can appear if you are not programmer by definition

waker said...

yeah, i think you're right, though most of such code is created by this new pepsi-generation-wannabe-programmers, who are coding in php mostly.

Anonymous said...

hm, from yours comment i see that you think that i'm php programmer. so, why do you think so?

waker said...

you're wrong. why would i think so?

Anonymous said...

http://compsci.ca/blog/if-a-programming-language-was-a-boat/
I suppose you like it :)

waker said...

yeah, i've read this :) nice one