|
I'm pretty sure mine is the worst...
|
|
|
|
|
My recent was some RPG code that did ROUGHLY this:
MINS = 'XX' of minutes
IF (MINS='09' OR MINS='19' OR MINS='29'.. OR MINS='59' or MINS='99') THEN ...
When I questioned this, I was told that they discovered sometimes it returns 99.
To which I laughed. I suggested:
MIN = 'X' of minutes (last digit)
IF (MIN='9') THEN ...
...
For the record, they pushed back and the code was not fixed!
Fast forward a couple of years. They are no longer in business!
|
|
|
|
|
Well, I guess it could be worse... what if the "wait" had been left out? I dread to think what the load on the machine's CPU would've been like...
|
|
|
|
|
...although, thinking about it, arguably the worst code in the world came about as a result of an undocumented instruction in the 80286 which Intel originally included for testing.
The way the instruction worked, you filled up an area in page 0 of memory with all the values you wanted all the registers in the chip to have (including instruction pointer, stack pointer, flags, etc.) and whether you wanted to run in real mode (640K) or extended mode (all the memory available) and where in the larger memory map you wanted your 640K to be... and so on - and then you could execute the instruction and the chip would cold-start in that state.
The worst code in the world that I'm talking about, then, was the first version of OS/2, written for that chip, which allowed you to have one - and only one - DOS window running at any time. And - yes - IBM made that work by hooking onto Interrupt 8 (the hardware timer) and cold-starting the 80286 eighteen times a second, flipping between real mode and extended mode each time around. Horrible. Amazingly, it actually worked... I shudder to think what the chipset around the chip was thinking at the time, but there it is.
|
|
|
|
|
|
No, the worst code in the world is Programming Horror.
From the original Micro Lab Data Factory database program written in Applesoft Basic.
We had this nailed to the wall as a warning to others.
Psychosis at 10
Film at 11
Those who do not remember the past, are doomed to repeat it.
Those who do not remember the past, cannot build upon it.
|
|
|
|
|
"If you can understand this code you're fired!"
So wrong on so many levels!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
All code used to be written like that. That's a relatively understandable example.
|
|
|
|
|
so sweet!
The programm can read the current time but cannot calculate time till 2am!
|
|
|
|
|
A long time ago i was known to use something like
whilst (1==1)
{
}
then i learned to use
whilst (true)
{
}
Happy days
|
|
|
|
|
that just made me laugh out loud
|
|
|
|
|
So, I have to help rewriting our customer website, which involves getting my hands dirty on JavaScript. No script bashing here, the right tool for the right job and all.
Deciding to involve the Revealing Module Pattern for my multi viewmodel per page scripting, I tried writing something like this:
$(document).ready
(
function()
{
tmg.model1 = (function()
{
var name = ko.observable("Model 1");
return
{
name: name
};
})();
$("[tmg_ns='vm1']").each(
function()
{
var domNode = $(this)[0];
ko.applyBindings(tmg.model1, domNode);
}
);
}
);
It didn't work...
Debugging revealed that the name property was undefined .
After several hours and a lot of , I found the 'error'; When returning a JavaScript object, the curly brace must be on the same line as the return statement!!!
Yes, 3 exclamation marks, see what you made me do JS?, and oh, I want my hours back.
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
The real wtf is Javascript's optional semi colons, which is what's happening there. Using something like JSLint would have told you this:
{
name: name
};
was unreachable code. But yeah, JS definitely has some... interesting pieces.
|
|
|
|
|
Heh, thanks. Allthough it's an interesting project, I just don't think I will learn to love JS.
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
Ah! The old semicolon-less syntax designed to help ex VB programmers. The newline after return marks the end of the return statement and the following braced bit is ignored. It is not true that the { has to be on the same line. A better format is
var result = { name: name };
return result;
or, much easier, discard the function completely and just write
tmg.model1 = { name: ko.observable("Model 1") };
|
|
|
|
|
Thanks for clearing that up. Didn't make JS look any better to me though
Weird architecture that, just because there is a structure doesn't mean that it's actually helpfull. I'm sure there is a special part of Hell reserved for script designers putting subtle twists to a product.
I will certainly go for your first suggestion, the second wouldn't conform to the Revealing Module Pattern (or should that have been in all caps?).
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
jan larsen wrote: I'm sure there is a special part of Hell reserved for script designers putting subtle twists to a product.
Well, in Mr. Eich's defense, he did only have 10 days to design the language.
|
|
|
|
|
That's probably part of the reason why Allman style is not very popular in JS. And I agree: The optional semicolon is just terrible.
|
|
|
|
|
|
|
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Kitty at my foot and I waAAAant to touch it...
|
|
|
|
|
|
Kitty at my foot and I waAAAant to touch it...
|
|
|
|