# (c) 2005 by Lousy Coder

**URL:** <https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722>\
**Category:** The BBQ Pit\
**Created:** [September 21, 2005, 3:48pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722 "2005-09-21T15:48:41Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Crotalus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crotalus/32/41_2.png) [@Crotalus](https://boards.straightdope.com/u/Crotalus)\
**Post date:** [September 23, 2005, 12:21pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/41 "2005-09-23T12:21:10Z")

</div>

I copied that right out of a mainframe PDS, the tabs didn’t take. Looks like I need to learn a little more about vB coding. :smack:

---

<div class="post-metadata">

**Author:** ![Malacandra](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@Malacandra](https://boards.straightdope.com/u/Malacandra)\
**Post date:** [September 23, 2005, 12:30pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/42 "2005-09-23T12:30:58Z")

</div>

> [@Crotalus](#):
>
> COBOL, anyone?
> 
> IF POST-COUNT \> 2000  
> DISPLAY ‘I AGREE!!!’  
> ELSE  
> IF POST-COUNT \< 2000  
> DISPLAY ‘THIS THREAD IS STUPID!!!’  
> ELSE  
> NEXT SENTENCE  
> END-IF  
> END-IF.

Dude, ELSE NEXT SENTENCE is not standard COBOLII, and what’s wrong with EVALUATE? _And_ you don’t need a period after that END-IF. Great heavens above, they give you these explicit scope terminators and you insist on clinging to your 1960s-style punctuation characters? And what’s with these DISPLAYs? You expect someone to dig through the SYSOUT to find the message? :rolleyes:

Better (not necessarily best):

PERFORM S100-GET-PC-THRESHOLD  
EVALUATE TRUE  
WHEN W100-POSTCOUNT \< PC-THRESHOLD  
MOVE W100-DISAGREE-TEXT TO MY-OPINION  
WHEN OTHER  
MOVE W100-AGREE-TEXT TO MY-OPINION  
END-EVALUATE  
PERFORM S200-EXPRESS-OPINION

Sheesh…

---

<div class="post-metadata">

**Author:** ![Crotalus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crotalus/32/41_2.png) [@Crotalus](https://boards.straightdope.com/u/Crotalus)\
**Post date:** [September 23, 2005, 12:47pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/43 "2005-09-23T12:47:08Z")

</div>

> [@Malacandra](#):
>
> Sheesh…

Hard to believe I get paid for writing this crap, ain’t it? 😃

---

<div class="post-metadata">

**Author:** ![Borborygmi](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/borborygmi/32/217_2.png) [@Borborygmi](https://boards.straightdope.com/u/Borborygmi)\
**Post date:** [September 23, 2005, 1:07pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/44 "2005-09-23T13:07:17Z")

</div>

An amusing tangent on copyright boilerplates… a few years ago my company changed its logo. An internal pamplet was sent to every employee, stressing the importance of using the new logo, effective immediately.

The pamplet had the usual notice on the back about how the company name and logo are registered trademarks, with the usual accompanying graphics.

Including, of course, the old logo.

END tangent; posts=posts+1; run;

---

<div class="post-metadata">

**Author:** ![Malacandra](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@Malacandra](https://boards.straightdope.com/u/Malacandra)\
**Post date:** [September 23, 2005, 1:37pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/45 "2005-09-23T13:37:42Z")

</div>

> [@Crotalus](#):
>
> Hard to believe I get paid for writing this crap, ain’t it? 😃

You can’t fool all of the people all of the time, but if you can pull the wool over the right eyes twice a year, you can generally get by. 😛

---

<div class="post-metadata">

**Author:** ![Clothahump](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@Clothahump](https://boards.straightdope.com/u/Clothahump)\
**Post date:** [September 23, 2005, 1:44pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/46 "2005-09-23T13:44:48Z")

</div>

> [@tomndebb](#):
>
> Does this mean that when **cricetus** has posted 224 more times (as of the time of _this_ post, all of the “This thread is stupid!!!” posts have to be changed to “I agree!!!” posts? Veb and Giraffe aren’t going to like that extra work.

No, 225 more posts are needed.

At 224, the postcount will be exactly 2000 and the program will fall through to the end without doing anything at all.

---

<div class="post-metadata">

**Author:** ![Crotalus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crotalus/32/41_2.png) [@Crotalus](https://boards.straightdope.com/u/Crotalus)\
**Post date:** [September 23, 2005, 1:47pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/47 "2005-09-23T13:47:25Z")

</div>

> [@Malacandra](#):
>
> You can’t fool all of the people all of the time, but if you can pull the wool over the right eyes twice a year, you can generally get by. 😛

It’s working so far! 🙂

---

<div class="post-metadata">

**Author:** ![tomndebb](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@tomndebb](https://boards.straightdope.com/u/tomndebb)\
**Post date:** [September 23, 2005, 2:45pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/48 "2005-09-23T14:45:58Z")

</div>

> [@Clothahump](#):
>
> No, 225 more posts are needed.
> 
> At 224, the postcount will be exactly 2000 and the program will fall through to the end without doing anything at all.

At the time I posted, (hence the notation “as of this post”), his post count was **1,777**.

```auto

1,777
+ 224
2,001

```

I really can do math and, as a _[basso profundo] **Professional Programmer** [/basso profundo]_ I noticed (without comment) the greater than/less than logic error when I first saw it.

---

<div class="post-metadata">

**Author:** ![Crotalus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crotalus/32/41_2.png) [@Crotalus](https://boards.straightdope.com/u/Crotalus)\
**Post date:** [September 23, 2005, 4:14pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/49 "2005-09-23T16:14:00Z")

</div>

> [@tomndebb](#):
>
> as a _[basso profundo] **Professional Programmer** [/basso profundo]_ I noticed (without comment) the greater than/less than logic error when I first saw it.

But Tom, I thought we _ **Professional Programmers** _ were supposed to talk in reedy, nerdy little voices.

---

<div class="post-metadata">

**Author:** ![panamajack](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@panamajack](https://boards.straightdope.com/u/panamajack)\
**Post date:** [September 24, 2005, 12:26am UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/50 "2005-09-24T00:26:04Z")

</div>

Oh, by the way …

No fair pointing other people’s mistakes without exposing them to your own:

```auto

	movea.l OPinfo.l, a2
	move.l Pcount(a2), d1
	cmpi.l #2000, d1
	bls NoAgree
	
	movea.l ScreenBuf.l, a1
	move.b #49h, (a1)+
	move.b #20h, (a1)+
	move.b #61h, (a1)+
	move.b #67h, (a1)+
	move.b #72h, (a1)+
	move.b #65h, (a1)+
	move.b #65h, (a1)+
	move.b #21h, (a1)+
	move.b #21h, (a1)+
	move.b #21h, (a1)+
	bra.s DoNothing

NoAgree:
	beq DoNothing
	
	movea.l ScreenBuf.l, a1
	move.b #54h, (a1)+
	move.b #68h, (a1)+
	move.b #69h, (a1)+
	move.b #73h, (a1)+
	move.b #20h, (a1)+
	move.b #74h, (a1)+
	move.b #68h, (a1)+
	move.b #72h, (a1)+
	move.b #65h, (a1)+
	move.b #61h, (a1)+
	move.b #64h, (a1)+
	move.b #20h, (a1)+
	move.b #69h, (a1)+
	move.b #73h, (a1)+
	move.b #20h, (a1)+
	move.b #73h, (a1)+
	move.b #74h, (a1)+
	move.b #75h, (a1)+
	move.b #70h, (a1)+
	move.b #69h, (a1)+
	move.b #64h, (a1)+
	move.b #21h, (a1)+
	move.b #21h, (a1)+
	move.b #21h, (a1)+
	
DoNothing:
	nop

```

---

<div class="post-metadata">

**Author:** ![MysteryFellow63427](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@MysteryFellow63427](https://boards.straightdope.com/u/MysteryFellow63427)\
**Post date:** [September 24, 2005, 1:00am UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/51 "2005-09-24T01:00:06Z")

</div>

Ok, I was doing fine for a while but then y’all geeked it up too much for even me.

-neuroman, B.S.C.S.

---

<div class="post-metadata">

**Author:** ![Sam\_Stone](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sam\_Stone](https://boards.straightdope.com/u/Sam_Stone)\
**Post date:** [September 24, 2005, 5:21am UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/52 "2005-09-24T05:21:08Z")

</div>

I remember the old George Carlin saying, “Did you ever notice that when you’re on the freeway, everyone driving faster than you is an idiot, and everyone driving slower is a moron?”

There’s a corollary to programming here: Every other programmer in the world writes crap code, whereas I, in 20 years of programming, have never written a line of bad code.

I think we’ve all got code lurking around that could use a little tuning up.

Gotta agree about the copyright, anyway. It’s especially hilarious on a web page with 30 bloody lines of pedestrian Javascript.

---

<div class="post-metadata">

**Author:** ![Noone\_Special](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/noone_special/32/2863_2.png) [@Noone\_Special](https://boards.straightdope.com/u/Noone_Special)\
**Post date:** [September 24, 2005, 7:00am UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/53 "2005-09-24T07:00:04Z")

</div>

> [@Sam Stone](#):
>
> I remember the old George Carlin saying, “Did you ever notice that when you’re on the freeway, everyone driving faster than you is an idiot, and everyone driving slower is a moron?”
> 
> There’s a corollary to programming here: Every other programmer in the world writes crap code, whereas I, in 20 years of programming, have never written a line of bad code.

Actually the line I use on people when code reviewing is “if I had a dollar for every missing semi-colon I’ve ever found in somebody else’s code… but had to pay a dollar for each one somebody else found missing in mine… I don’t know whether I’d be rich or poor, but man, the turnover I’d have!” 🙂

Og this sounds horrible in English ☹ But you get the idea

---

<div class="post-metadata">

**Author:** ![Polerius](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Polerius](https://boards.straightdope.com/u/Polerius)\
**Post date:** [September 24, 2005, 11:37am UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/54 "2005-09-24T11:37:48Z")

</div>

> [@ultrafilter](#):
>
> So do it the modern way:
> 
> ```auto
> 
> printf( "%s
> ", ( postCount > 2000 ) ? "I agree!" : "This thread is stupid!" );
> 
> ```

You guys write such easy-to-read code 🙂

```auto

$_ = sub {shift()<2000 and print shift or shift and print shift;}; 
&$_($postcount,"This thread is stupid!
","I agree!
");

```

Re the OP, here’s something I sometimes find:

```auto

// The speed of the vehicle
int vehicleSpeed;

```

WTF?

---

<div class="post-metadata">

**Author:** ![coop](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@coop](https://boards.straightdope.com/u/coop)\
**Post date:** [September 24, 2005, 11:45am UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/55 "2005-09-24T11:45:26Z")

</div>

> [@Malacandra](#):
>
> Dude, ELSE NEXT SENTENCE is not standard COBOLII, and what’s wrong with EVALUATE? _And_ you don’t need a period after that END-IF. Great heavens above, they give you these explicit scope terminators and you insist on clinging to your 1960s-style punctuation characters? And what’s with these DISPLAYs? You expect someone to dig through the SYSOUT to find the message? :rolleyes:
> 
> Better (not necessarily best):
> 
> PERFORM S100-GET-PC-THRESHOLD  
> EVALUATE TRUE  
> WHEN W100-POSTCOUNT \< PC-THRESHOLD  
> MOVE W100-DISAGREE-TEXT TO MY-OPINION  
> WHEN OTHER  
> MOVE W100-AGREE-TEXT TO MY-OPINION  
> END-EVALUATE  
> PERFORM S200-EXPRESS-OPINION
> 
> Sheesh…

It’s been a VERY long time… but:

EVALUATE POST-COUNT  
WHEN \< 2000  
PERFORM W100-STUPID  
WHEN OTHER  
PERFORM W200-AGREE  
END-EVALUATE

would this be a little bit shorter??? 😃  
Yeah, you’d still have to code the relevant sections and all… but I think my lines have less characters than yours… 😉

---

<div class="post-metadata">

**Author:** ![The\_Mad\_Hermit](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@The\_Mad\_Hermit](https://boards.straightdope.com/u/The_Mad_Hermit)\
**Post date:** [September 24, 2005, 11:23pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/56 "2005-09-24T23:23:26Z")

</div>

I’d post another version, but hexadecimal on punch tape doesn’t work well these days.

---

<div class="post-metadata">

**Author:** ![RaftPeople](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@RaftPeople](https://boards.straightdope.com/u/RaftPeople)\
**Post date:** [September 25, 2005, 5:59pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/57 "2005-09-25T17:59:24Z")

</div>

Class Post …  
Class StupidPost Inherits Post …  
Class GoodPost Inherits Post …  
Class Member  
ArrayList posts …  
Class Message …

try {

If (posts.size\<2000) {  
member.posts.add(new StupidPost(currentPost));  
return Message.StupidPostMessage;

} else if (posts.size\>2000) {  
member.posts.add(new GoodPost(currentPost));  
return Message.GoodPostMessage;  
}

catch (MemberStatusException pde) {  
postConnection.close();  
return Message.MemberStatusExceptionMessage;  
}

catch (Exception e) {  
System.out.println(e);  
}

---

<div class="post-metadata">

**Author:** ![RaftPeople](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@RaftPeople](https://boards.straightdope.com/u/RaftPeople)\
**Post date:** [September 25, 2005, 6:06pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/58 "2005-09-25T18:06:24Z")

</div>

Rpg:

Count Sub 2000 Test 30 31 32  
30 Move ‘stupid’ Msg  
31 Move ‘good’ Msg

---

<div class="post-metadata">

**Author:** ![tomndebb](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@tomndebb](https://boards.straightdope.com/u/tomndebb)\
**Post date:** [September 25, 2005, 7:39pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/59 "2005-09-25T19:39:23Z")

</div>

> [@Crotalus](#):
>
> But Tom, I thought we _ **Professional Programmers** _ were supposed to talk in reedy, nerdy little voices.

That’s only for MS and Java geeks. Mainframers have to be able to cow CIOs and CEOs (and _::: gasp :::_ billing clerks), so we talk a lot more like John Wayne.

---

<div class="post-metadata">

**Author:** ![Crotalus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crotalus/32/41_2.png) [@Crotalus](https://boards.straightdope.com/u/Crotalus)\
**Post date:** [September 25, 2005, 9:52pm UTC](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722/60 "2005-09-25T21:52:03Z")

</div>

> [@tomndebb](#):
>
> That’s only for MS and Java geeks. Mainframers have to be able to cow CIOs and CEOs (and _::: gasp :::_ billing clerks), so we talk a lot more like John Wayne.

So, if they ever convert me from a mainframe dinosaur into a Java geek, my voice will change? Another reason to hang around to turn out the lights.

[Previous page](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722.md?page=2)

[Next page](https://boards.straightdope.com/t/c-2005-by-lousy-coder/322722.md?page=4)
