Click here to Skip to main content
15,879,326 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: 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 
GeneralRe: Efficiency redux Pin
John Hunley18-Jul-12 9:02
John Hunley18-Jul-12 9:02 
GeneralRe: Efficiency redux Pin
dan!sh 18-Jul-12 17:14
professional dan!sh 18-Jul-12 17:14 
GeneralRe: Efficiency redux Pin
BillW3318-Jul-12 6:40
professionalBillW3318-Jul-12 6:40 
GeneralRe: Efficiency redux Pin
Andrei Straut18-Jul-12 8:08
Andrei Straut18-Jul-12 8:08 
GeneralRe: Efficiency redux PinPopular
Brady Kelly18-Jul-12 19:25
Brady Kelly18-Jul-12 19:25 
GeneralRe: Efficiency redux Pin
BillW3319-Jul-12 1:45
professionalBillW3319-Jul-12 1:45 
GeneralRe: Efficiency redux Pin
Andrei Straut19-Jul-12 3:26
Andrei Straut19-Jul-12 3:26 
GeneralRe: Efficiency redux Pin
BillW3319-Jul-12 7:16
professionalBillW3319-Jul-12 7:16 
GeneralRe: Efficiency redux Pin
Andrei Straut19-Jul-12 9:03
Andrei Straut19-Jul-12 9:03 
GeneralRe: Efficiency redux Pin
BillW3319-Jul-12 10:42
professionalBillW3319-Jul-12 10:42 
GeneralRe: Efficiency redux Pin
Andrei Straut19-Jul-12 10:43
Andrei Straut19-Jul-12 10:43 
GeneralRe: Efficiency redux Pin
BillW3319-Jul-12 10:45
professionalBillW3319-Jul-12 10:45 

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.