Click here to Skip to main content
15,909,503 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: And this is why I hate PHP (again) Pin
fuximus2-Aug-12 18:11
fuximus2-Aug-12 18:11 
GeneralI don't got time for no stinking opera! Pin
enhzflep22-Jul-12 8:30
enhzflep22-Jul-12 8:30 
GeneralRe: I don't got time for no stinking opera! Pin
Brisingr Aerowing22-Jul-12 12:45
professionalBrisingr Aerowing22-Jul-12 12:45 
GeneralRe: I don't got time for no stinking opera! Pin
_Amy22-Jul-12 22:29
professional_Amy22-Jul-12 22:29 
GeneralRe: I don't got time for no stinking opera! Pin
enhzflep22-Jul-12 22:54
enhzflep22-Jul-12 22:54 
GeneralRe: I don't got time for no stinking opera! Pin
CDP180222-Jul-12 23:03
CDP180222-Jul-12 23:03 
GeneralRe: I don't got time for no stinking opera! Pin
enhzflep22-Jul-12 23:44
enhzflep22-Jul-12 23:44 
GeneralRe: I don't got time for no stinking opera! Pin
Jochen Arndt23-Jul-12 0:58
professionalJochen Arndt23-Jul-12 0:58 
GeneralRe: I don't got time for no stinking opera! Pin
Andrei Straut23-Jul-12 1:15
Andrei Straut23-Jul-12 1:15 
GeneralRe: I don't got time for no stinking opera! Pin
enhzflep23-Jul-12 2:12
enhzflep23-Jul-12 2:12 
GeneralRe: I don't got time for no stinking opera! Pin
Chris Maunder30-Jul-12 15:16
cofounderChris Maunder30-Jul-12 15:16 
GeneralRe: I don't got time for no stinking opera! Pin
Brisingr Aerowing30-Jul-12 15:24
professionalBrisingr Aerowing30-Jul-12 15:24 
GeneralRe: I don't got time for no stinking opera! Pin
enhzflep23-Jul-12 2:11
enhzflep23-Jul-12 2:11 
GeneralWhat condition, or lack thereof, am I even testing for again??? Pin
nedmech20-Jul-12 13:24
nedmech20-Jul-12 13:24 
GeneralRe: What condition, or lack thereof, am I even testing for again??? Pin
Brisingr Aerowing21-Jul-12 4:27
professionalBrisingr Aerowing21-Jul-12 4:27 
GeneralRe: What condition, or lack thereof, am I even testing for again??? Pin
Bernhard Hiller23-Jul-12 2:21
Bernhard Hiller23-Jul-12 2:21 
GeneralIt's duplicated, too lazy to fix. Pin
CocusArg19-Jul-12 9:15
CocusArg19-Jul-12 9:15 
GeneralRe: It's duplicated, too lazy to fix. PinPopular
Andrei Straut19-Jul-12 23:06
Andrei Straut19-Jul-12 23:06 
GeneralRe: It's duplicated, too lazy to fix. Pin
CDP180220-Jul-12 0:21
CDP180220-Jul-12 0:21 
RantRe: It's duplicated, too lazy to fix. Pin
Andrei Straut20-Jul-12 2:57
Andrei Straut20-Jul-12 2:57 
Yes, and at the same time, it makes it awwwwwwfully easy to code badly.
You can code badly in absolutely any language, but bad code written in PHP just.has.that.special.flavor.

[rant start]
Now, assume we have some code (PHP) along the lines of:
$invoice_no = 1;

//some code

//Then someone comes who does not read docs, or has no idea that invoice_no should be an int, and does something with the following effect:
$invoice_no = $invoice_no . 'INV_123#';

//Some other code
return $invoice_no;


Now, try to do this in Java for instance:
int invoice_no = 1;
invoice_no = invoice_no + "INV_123#";
return invoice_no;

The compiler would be all over the place, screaming like a newborn baby. And that's just off the top of my head.

And speaking of compiler and autocomplete, how about contructs like:
$invoice_no = 'Whatever';

//Code

return $invoiceno; //first occurrence of $invoiceno, the IDE doesn't complain about it, is undefined, but you sucker will only know at runtime, from a !!!Notice!!!


Or that you can't really enforce a type parameter on a method (of course, there's get_class, but you'll only know about it at runtime).

Or autocomplete. I'a big fan of autocomplete. Now, I've done PHP with both Eclipse and Netbeans. Try to get autocomplete for something like:
$db = DatabaseService::getInstance();
$line = $db->getPoLineById($line_id);
$product = $db->searchProduct('id', $line->getProductId()); //This is where the magic ends. No autocomplete for 'line->'


Or debugging. var_dump, really? Now, I know there's XDebug, but try using that in a 4GB PHP project (I'm talking about a Magento website). Good luck with that.
[rant end]

Now, I do believe your remark was sarcastic. For being sarcastically funny, have a 5! Laugh | :laugh:
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.

GeneralRe: It's duplicated, too lazy to fix. Pin
CDP180220-Jul-12 3:18
CDP180220-Jul-12 3:18 
GeneralRe: It's duplicated, too lazy to fix. Pin
Andrei Straut20-Jul-12 3:31
Andrei Straut20-Jul-12 3:31 
GeneralRe: It's duplicated, too lazy to fix. Pin
CDP180220-Jul-12 3:38
CDP180220-Jul-12 3:38 
GeneralEfficiency redux PinPopular
John Hunley18-Jul-12 5:51
John Hunley18-Jul-12 5:51 
JokeRe: Efficiency redux Pin
dan!sh 18-Jul-12 5:54
professional dan!sh 18-Jul-12 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.