Comment On A Smorgasbord of Classics

It's a particularly busy week for me: on top of a few looming deadlines, I'll be at Business of Software 2008 in Boston. So, I figured it'd be the perfect opportunity to revisit some classics. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: A Smorgasbord of Classics

2008-09-05 08:06 • by Anonymous (unregistered)
Fist!

Re: A Smorgasbord of Classics

2008-09-05 08:08 • by Anonymous (unregistered)
Secodn!

Re: A Smorgasbord of Classics

2008-09-05 08:11 • by anoncow (unregistered)
Turd!

Re: A Smorgasbord of Classics

2008-09-05 08:11 • by Fiona (unregistered)
Thrd!

Re: A Smorgasbord of Classics

2008-09-05 08:11 • by Fiona (unregistered)
HUUUUUUUUURF

Re: A Smorgasbord of Classics

2008-09-05 08:20 • by A Nonny Mouse
If .Fields("CUST_NUM") = "7742" Then
dtmOrderPlaced = dtmOrderPlaced
End If

looks to me like someone needed a breakpoint while debuggering

Re: A Smorgasbord of Classics

2008-09-05 08:22 • by jimlangrunner
25th! (space)

No, I didn't count. Had the computer do it for me.

WTF?

Re: A Smorgasbord of Classics

2008-09-05 08:24 • by Jithu2k1
215961 in reply to 215959
A Nonny Mouse:
If .Fields("CUST_NUM") = "7742" Then
dtmOrderPlaced = dtmOrderPlaced
End If

looks to me like someone needed a breakpoint while debuggering


looks to me like someone had no clue what he was doing!!!

Re: A Smorgasbord of Classics

2008-09-05 08:31 • by A Nonny Mouse
215963 in reply to 215960
jimlangrunner:
25th! (space)

No, I didn't count. Had the computer do it for me.

WTF?

"twenty" is obviously base 12.5

Re: A Smorgasbord of Classics

2008-09-05 08:33 • by snoofle
alex:
#define false 1

#define true 0

Brought to you by the same folks who came up with FileNotFound?

Re: A Smorgasbord of Classics

2008-09-05 08:35 • by jimlangrunner
215965 in reply to 215961
Jithu2k1:
A Nonny Mouse:
If .Fields("CUST_NUM") = "7742" Then
dtmOrderPlaced = dtmOrderPlaced
End If

looks to me like someone needed a breakpoint while debuggering


looks to me like someone had no clue what he was doing!!!


Bah. for breakpoints, i=i has always struck me as easy. but then, so am I.

Re: A Smorgasbord of Classics

2008-09-05 08:36 • by Customer Service (unregistered)
Customer requirement one: The date must appear in columns 1 thru 10.

Customer requirement two: The product description (45 characters) must be right justified to column 80.

Customer requirement three: There must be twenty spaces between the date and the product description.

Solution:
private final static String twentyspaces = "                         ";

The customer is always right!

Re: A Smorgasbord of Classics

2008-09-05 08:37 • by some coder (unregistered)
I found this in some production code:

int iChkShut; // variables MUST be initialized, not sure whyFunny enough, the parameter iChkShut is used (uninitialized) for comparisment a couple of rows later.


Holy bejesus that's funny

Re: A Smorgasbord of Classics

2008-09-05 08:55 • by Stephen Bayer (unregistered)
215968 in reply to 215963
A Nonny Mouse:
jimlangrunner:
25th! (space)

No, I didn't count. Had the computer do it for me.

WTF?

"twenty" is obviously base 12.5


I was under the impression that bases needed to be whole numbers over 1.. ie. base 2, base 3, base 4, base 5, ... ok.. this could go on for a while.. i think there are a lot more whole numbers over 1. I used to use random bases when doing my fourth grade math homework, then argue with the teacher about the validity of my answers, calling her an idiot for not agreeing with me that 8 + 5 = 11

Re: A Smorgasbord of Classics

2008-09-05 08:57 • by andem (unregistered)
if((0 == DblSpread) || (0 == DblSpread))


This comparison order is actually an old trick to avoid unintentional assignment in if() clause from the days when IDEs/compilers didn't warn about those. Constant = Variable assignment resulted in compiler error and saved some debugging time.

Re: A Smorgasbord of Classics

2008-09-05 09:00 • by MiffTheFox
215971 in reply to 215968

I was under the impression that bases needed to be whole numbers over 1.. ie. base 2, base 3, base 4, base 5, ... ok.. this could go on for a while.. i think there are a lot more whole numbers over 1. I used to use random bases when doing my fourth grade math homework, then argue with the teacher about the validity of my answers, calling her an idiot for not agreeing with me that 8 + 5 = 11


Okay, thanks for sharing with us what a base is... The point of the joke is that the twentyspaces variable is actually 25 spaces. 20 in "base 12.15" here is equal to 25 base 10.

If anything, you're the idiot for assuming base 12 on a fourth-grade level problem.

Re: A Smorgasbord of Classics

2008-09-05 09:05 • by NiceWTF (unregistered)
215972 in reply to 215964
snoofle:
alex:
#define false 1

#define true 0

Brought to you by the same folks who came up with FileNotFound?


Brought to you by strcmp() and friends, more likely.

Re: A Smorgasbord of Classics

2008-09-05 09:15 • by Mark! (unregistered)

lSend = IIf(lSend = True, True, False)


As far is I know VB6, lSend doesn't have to be a boolean, ie it can be a Variant. So it could contain other values then true or false. For example, null when read from a db.

This is an ok trick to get a true/false only (boolean)

Re: A Smorgasbord of Classics

2008-09-05 09:15 • by Dan (unregistered)
if(isGoodComment || !isGoodComment)
{
postComment();
}

Re: A Smorgasbord of Classics

2008-09-05 09:16 • by KenW
215977 in reply to 215968
Stephen Bayer:
I was under the impression that bases needed to be whole numbers over 1.


I was under the impression that everyone who reads here has at least enough intelligence and sense of humor to recognize a joke and therefore not feel the need to correct it. Apparently, I was wrong.

Thanks for correcting my misunderstanding.

Re: A Smorgasbord of Classics

2008-09-05 09:17 • by KenW
215978 in reply to 215969
andem:
if((0 == DblSpread) || (0 == DblSpread))


This comparison order is actually an old trick to avoid unintentional assignment in if() clause from the days when IDEs/compilers didn't warn about those. Constant = Variable assignment resulted in compiler error and saved some debugging time.


Wow. You'd be really smart if:

a) You didn't state the obvious.

b) You realized that the actual WTF wasn't the constant/variable order, but the fact that the same identical comparison was made twice using an OR.

Thanks for playing, though.

Re: A Smorgasbord of Classics

2008-09-05 09:18 • by Andy Goth
alex:
#define false 1

#define true 0
#define ZERO -1
Remember that? I took a second look at the code, and it turns out I was wrong. Here's how it actually reads:
#define NEGATIVE_ONE 0

Re: A Smorgasbord of Classics

2008-09-05 09:18 • by Niels (unregistered)
    lSend = IIf(lSend = True, True, False)

Obviously because there are other values than True and False. (FileNotFound etc.)

In a real language I'd just have done lSend = !!lSend; for it, concise way to force a value to boolean.

Re: A Smorgasbord of Classics

2008-09-05 09:20 • by Thief^
215981 in reply to 215959
A Nonny Mouse:
If .Fields("CUST_NUM") = "7742" Then
dtmOrderPlaced = dtmOrderPlaced
End If

looks to me like someone needed a breakpoint while debuggering

A conditional breakpoint, in a debugger that doesn't support them.

Re: A Smorgasbord of Classics

2008-09-05 09:20 • by Thief^
215982 in reply to 215969
andem:
if((0 == DblSpread) || (0 == DblSpread))


This comparison order is actually an old trick to avoid unintentional assignment in if() clause from the days when IDEs/compilers didn't warn about those. Constant = Variable assignment resulted in compiler error and saved some debugging time.

That's not the wtf, the wtf is that it's exactly the same comparison twice.

Re: A Smorgasbord of Classics

2008-09-05 09:20 • by jcoehoorn
215983 in reply to 215955
If .Fields("CUST_NUM") = "7742" Then
dtmOrderPlaced = dtmOrderPlaced
End If


If you do a lot of batch processing, it's only a matter of time until you write one like this. You'll get an error about 3/4 way through a large dataset and want to step through the code to find it, and so you write a no-op snippet like that so you can set a break point when it reaches the record that's causing the problem. But that could should never make it to production.

Re: A Smorgasbord of Classics

2008-09-05 09:25 • by --- (unregistered)
215984 in reply to 215981
Thief^:
A Nonny Mouse:
If .Fields("CUST_NUM") = "7742" Then
dtmOrderPlaced = dtmOrderPlaced
End If

looks to me like someone needed a breakpoint while debuggering

A conditional breakpoint, in a debugger that doesn't support them.


Yeah I've done that. I think conditional breakpoints were there, but made everything run so slowly it was basically unusable (it was on a PS2 compiler I think).

Re: A Smorgasbord of Classics

2008-09-05 09:25 • by n0t 1337 h4xx0r (unregistered)
#define false 1
#define true 0

I've seen such a construction hidden deep inside some header... There was a comment: "Happy debugging, d*ckhead!";

Re: A Smorgasbord of Classics

2008-09-05 09:30 • by blah (unregistered)
comparisment?

Re: A Smorgasbord of Classics

2008-09-05 09:35 • by Steve Boyko (unregistered)
If (Mid(CStr(cppObject.GetValue()), 1, 1) = "-") Then ...

Silly old bear, the programmer should have used Left rather than Mid. Saves a few keystrokes. ;)

Re: A Smorgasbord of Classics

2008-09-05 09:36 • by Hope that helps (unregistered)
215988 in reply to 215986
blah:
comparisment?

Comparisment is used to avoid embarrison.

Re: A Smorgasbord of Classics

2008-09-05 09:36 • by J. Palmer (unregistered)
It wasn't a bug after all...

Re: A Smorgasbord of Classics

2008-09-05 09:39 • by Andy Goth
215991 in reply to 215968
Stephen Bayer:
I was under the impression that bases needed to be whole numbers over 1.
A number base (a.k.a. radix) does not need to be a whole number; that just makes it easier to work with. The Unix DC program (or at least the dc.sed version) supports fractional input and output radixes, via the 'i' and 'o' commands. Type 12.5;i;20;p; (replacing ; with newlines), and it'll print 25. Take the input number 20, expand it to 2*(12.5**1)+0*(12.5**0), and you get 25. If dc has a fractional output base, it's forced to spell out each "digit" as a decimal number, separating the "digits" with spaces. For example, 3.4;o;20;p; yields 1 1.6 3.0, since 1*(3.4**2)+1.6*(3.4**1)+3*(3.4**0) = 20.

Re: A Smorgasbord of Classics

2008-09-05 09:40 • by WhiskeyJack
Ah, someone beat me to it. Comparisment is a word now?

Re: A Smorgasbord of Classics

2008-09-05 09:44 • by Someone You Know
215993 in reply to 215992
WhiskeyJack:
Ah, someone beat me to it. Comparisment is a word now?


And a perfectly cromulent one at that.

Re: A Smorgasbord of Classics

2008-09-05 09:45 • by Somer Himpson (unregistered)
if (connected || !connected)
{
return file_not_found;
}

Re: A Smorgasbord of Classics

2008-09-05 09:45 • by Hope that helps (unregistered)
215995 in reply to 215992
WhiskeyJack:
Ah, someone beat me to it. Comparisment is a word now?
http://www.comparisment.com/ is a registered domain, so the word must be in some dictionary somewhere!

Re: A Smorgasbord of Classics

2008-09-05 09:48 • by diaphanein (unregistered)
** the following code is neither recyclable or reusable
** but rather highly radioactive toxic sludge
** liable to give you hemmorragic brain damage and anal leakage of the mouth

Re: A Smorgasbord of Classics

2008-09-05 09:50 • by diaphanein (unregistered)
** the following code is neither recyclable or reusable
** but rather highly radioactive toxic sludge
** liable to give you hemmorragic brain damage and anal leakage of the mouth

Re: A Smorgasbord of Classics

2008-09-05 09:50 • by diaphanein (unregistered)
** the following code is neither recyclable or reusable
** but rather highly radioactive toxic sludge
** liable to give you hemmorragic brain damage and anal leakage of the mouth

Re: A Smorgasbord of Classics

2008-09-05 09:50 • by Vechni
215999 in reply to 215995
lol, web squatters.

Re: A Smorgasbord of Classics

2008-09-05 09:52 • by Satanicpuppy
216001 in reply to 215995
Some of the conditional stuff I can see; you write it, you change it, you write it, you change it, you write it and FINALLY the data matches what it's supposed to and you don't recheck.

The "20 spaces" I understand as well, though you should never ever ever do that. On old COBOL systems you have a lot of "Fixed Width" flat table databases, and huge chunks of spaces are actually really necessary for running through those, though I'm sure everyone here understands that you should never use more than 1 space at a time to avoid counting errors, and indeed, that more than 1 space isn't useful except in really ugly constructions like:

$line = $valueA.twentySpaces.$valueC.$twentyTwospaces.$valueC;

Re: A Smorgasbord of Classics

2008-09-05 09:55 • by Paul Carpenter (unregistered)
#define false 1
#define true 0

The source for the game Power Sports Soccer had something similar, along with

#define BEGIN {
#define END }
#define FOR for
#define IF if
#define THEN {
#define ELSE } else {
#define ENDIF }

There was an include file with about 30 more nuggets like that in it...

Re: A Smorgasbord of Classics

2008-09-05 09:59 • by Kuba (unregistered)
216005 in reply to 215959
A Nonny Mouse:
If .Fields("CUST_NUM") = "7742" Then
dtmOrderPlaced = dtmOrderPlaced
End If
looks to me like someone needed a breakpoint while debuggering
That's why I have always been at loss why some standard C header is not forced to include something to the effect of
#define NOP() asm("nop");
I have a header in my library of "useful stuff" that does include this. It is quite cross-platform, too!

Cheers, Kuba

Re: A Smorgasbord of Classics

2008-09-05 10:21 • by Kevin (unregistered)
The company that I work for has an internal application for product / stock management written in VBScript... And, as you can see here, they have great security.


If Len(Trim(fParentFrames2.sGetSecurityRights())) > 0 Then

or

'*** 2004-06-17 - Jdepo - Security
iResults = 1


They also have great version control, including inline changelogs!

'Commented by NMURUG (Cognizant) to fix the defect# 842 on 25 Jul 2007 - Start Change
'btnMyInfo.value = "My Info"
'Commented by NMURUG (Cognizant) to fix the defect# 842 on 25 Jul 2007 - End Change

Re: A Smorgasbord of Classics

2008-09-05 10:21 • by Ale (unregistered)
if (connected || !connected)
{
//ED: Snip
}

He just doesn't want the code to run if connected = FileNotFound

Re: A Smorgasbord of Classics

2008-09-05 10:33 • by rosko (unregistered)
216018 in reply to 215975
Mark!:

lSend = IIf(lSend = True, True, False)

As far is I know VB6, lSend doesn't have to be a boolean, ie it can be a Variant. So it could contain other values then true or false. For example, null when read from a db.

This is an ok trick to get a true/false only (boolean)

Or you could just use CBool(lSend)

Re: A Smorgasbord of Classics

2008-09-05 10:42 • by HeavyBoy (unregistered)
javascript:alert(" ".length);

Re: A Smorgasbord of Classics

2008-09-05 10:48 • by moz (unregistered)
216023 in reply to 215991
Andy Goth:
If dc has a fractional output base, it's forced to spell out each "digit" as a decimal number, separating the "digits" with spaces. For example, 3.4;o;20;p; yields 1 1.6 3.0, since 1*(3.4**2)+1.6*(3.4**1)+3*(3.4**0) = 20.
I wonder why it chooses to print that "number", rather than 121.2.

Re: A Smorgasbord of Classics

2008-09-05 10:49 • by Steve (unregistered)
Regarding the final item, a number of years ago I had a discussion over a few Tsing Taos with some VMS weenies (er, hackers) about the proper values for true and false. Their contention was that since in VMS a return value of zero indicates success and any other value returned indicates failure of a function or operation, it makes sense that 1 (or any nonzero value) should be interpreted as false and only 0 be interpreted as true.

They considered the C language's use of 0 as a false value to be a significant wart on the language.

I can say that after many Tsing Taos and several servings of Kung Pao Death I was inclined to agree.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment