- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Actually, the intended word is probably 'leery' which is a synonym of 'wary'. This seems to be a common thing in these here lakes regions. But that's a mute point. Irregardless, this code would make any developer blurry-eyed.
Admin
It is actually worse than that. He used magic types. This:
Should clearly have been:
Admin
Monitor? Sissy... It's not programming unless you're loading punch cards and replacing vacuum tubes.
Admin
And everything *was* clear.
It was clear why the original programmer was no longer on the project. AND it was clear that Andy needed to get his resume in order, but FAST.
I've seen worse ... but not awake ...
Admin
Admin
This also contains the WTF of tying the name to the value.
Should be
<font size="2">const TWENTYTWO: int = 7;</font>
<font size="2">
</font>Admin
Wow, that's impressive. It makes a certain amount of sense though, given the background.
Original code written with no OS -- variables stored in fixed memory locations.
If you throw out the original code, regenerate it with a decompiler, modified the machine generated variable names to your best guess, then port it to a hardware-independent implementation so that the meaning of the fixed memory locations are lost, then I can see how that happened.
Admin
Why does it have to HURT?!
Admin
This reminds me of the code written by a co-worker. They project had been switched from VB Access to Delphi, and they'd had 3 days of Delphi training.
Obviously, none actually knew what they were doing. But this one, topped them all. He had written everything in one procedure and the list of parameters was about as large as the one in this thread. The implementation lasted for 2500 lines. Again, one procedure !!
I was fortunate enough to be working only next to their team (as opposed to "with them"), and simply be friends with some of them. They even attempted to debug the monster... I think they gave up on any hope after some eight months, and they used the code buggy as it was. That happened because the project manager didn't want to hurt the feelings of the guy who had written the beast.
Admin
The punched card reader was under the terminal, stacked with the bootstrap cards just in case the new leading-edge hard disk upgrade failed. The thing was, that the card reader had to be connected and switched on, else the IPL sequence would fail.
Bloody hard disks were more trouble than they were worth - always crashing after performing the manual head align procedure - o'scope and 1/8" allen key. Ah, memories.
Admin
Every time I read a comment like this, I remember a great article...
Read the rest. It is worth it... http://catb.org/~esr/jargon/html/story-of-mel.html
Admin
Well worth the read. Nice one.
Admin
Swhts srong wth th vrbl nms? dm_mn, evthg wth y s jst bch, bch, bch!
Admin
Some of these variables look like they would probably be fairly meaningful if you understood the original context. This is Atari code that uses a DSP to do something; I suspect that's part of why it was "hard to port" in the past.
Note also "midi_cmd". Very definitely hardware-specific. It has to do with a DSP, and some local hardware, and pulses, seconds, and milliseconds. "attfac" is probably an attrition factor.
I think it's bad, but not as bad as it looks at first blush.
Admin
You said "irregardless" on purpose didn't you. How irrespecitve.
Admin
Admin
Irrespective!
Damn. That damn captcha changed the spelling of my post!! Damn!
Admin
Blah. In the old days a ton of code used to be like this. I work with legacy stuff all the time that is almost as bad. This one is just made extra special juicy because of all the graphics data.
Admin
Admin
<font size="2">
It is clear.
Clearly a piece of shit.</font>
Admin
<font size="2">
Maybe the original developer was German.
I believe "bezogen" kinda means "applied to" in german.
So I guess that clarifies 0.0002% of it....</font>
Admin
Anyone else have a hard time reading that? Almost as painful as today's WTF.Â
Admin
Bet this post was by someone who forgot to turn on his sense of humor (or -- worse -- don't even know that Real Programmers
Don't Eat QuicheDon't Use PascalThe initial poster more than likely knew of the story of Mel since googling "Real Programmers" in google yields both Real Programmers Don't use Pascal and The Story Of Mel (much more readable than the Jargon-formatted one) as the two first results on front page.
Admin
I think you meant "Nevertheless, this programming would make any coder weary."
Admin
"My Eyes! The goggles, they do nothing!"
Admin
Actually folks, as a life long Pascal coder, I can EASILY explain this abortion.
1. The Pascal for Atari compiler market went seriously soft when no-one bothered to write one, leaving the available choices exceedingly slim. You took what you could, lived withit and coded around the bugs. I remember coding around PLENTY of compiler bugs for various pascal implemenations (including for mainframes-waterloo pascal really stunk) in the early days. Symbol length varied compiler to compiler, and Turbo Pascal 3 was RENOUNED for its long identifier lengths at 25 characters. The compiler itself required that text not exceed 1024 characters per cr/lf pair.
2. In the old days, you did not have 10mb stacks, you MIGHT have 16k. Globals were an absolute must. You just did not have the stack space otherwise. Good organization of data in the structures btw.
3. many earlier pascal compilers were single file affairs, excluding the possible support of include files. Not usually useful as they would obscure proper line numbers when reporting errors, and thus tended to be avoided. As such, you tended to bunch stuff up and group declarations by type to save space. Remember the old editors folks? It wasn't pretty, and you sure could not load a 2mb file either.
To be true, while the layout is exceedingly ugly, and the guy is plainly too lazy to use the enter key when he should (he might possibly have needed to remove them to get enough room for the full source in his editor, or the compiler itself), the code IS clear enough to someone familiar with reading pascal. He has defined 3 labels to use with gotos, which is a shame, but even I used 2 or 3 in my past before I focused harder on my flow control skills. There is a LOT of strong data typing here, admittedly confusing for a C programmer, but VERY familar to a pascal coder. Clearly the guy was working a constrained memory arena and was squeezing every byte he could get (note the lack of the packed keyword, which in theory would have improved memory usage, but was notoriously useless in older implementations, or the default in some cases making it unneeded in declarations).
This is pretty obviously a game, because it contains midi code for music. You don't see people wasting effort on that for spreadsheets and such... Stop key is esc, pause is the space bar... Based on the reference to bots, I'm guessing it is sprite based game of some sort. If I had code to go with it, I would have very little problem infering the rest. If it is not a game, then based on the midi code, perhaps a guitair tutor or the like...
I have definitely seen WORSE written code, but the layout definitely sucks, making it hard to read. I've read a LOT of pascal code, so it is second nature to me. I ported a land reservation system for the oil & gas industry from basic to pascal, and in the day and time, coding like this was just they way it worked. At least it is all top down, and that makes things a LOT easier to deal with, you always knew if you were looking for a symbol that it was declared ABOVE from where you were reading. Basic and C both lack that simplicty. Object pascal still retains that fact, but with things like Delphi doing most of the object declaration at the top of the code, with implementation to follow, it LOOKS like a 2 pass compiler (but isn't - if you write straight procedures, you find that the object declaration is just the ultimate 'forward' declaration statement)
I sure would not want to have to move it forward mind you (ok, I might, but I would wanna be WELL compensated)... Changing all those polling loops to event handlers with state transitions.. Ick.
Admin
Hear hear, a Real Programmer that is not above eating Quiche!
Admin
Wow, I hope you guys don't take this as a standard example for atari coders.
We're usually much worse ;)
George
Admin
Scary....
Even more scary is that I can tell it is a music program of some sort (references to MIDI and notes etc).
Wayne
Admin
.. no, I mean.. that's still readable.. where are the db $66 prefixes ? :)
Admin
I once saw a bug that was caused by a variable being maliciously local. It went roughly like this:
doStuffUntilTheyPressEscape()
{
char c;
do {
doStuff();
c = getButton();
} while ( c != 27 );
return 0;
}
The problem? While getButton returns a value (an int, but let that pass), it always returns NULL (not an int, but let that pass too). The code for the key that was pressed was actually returned in the global variable c. Somehow this wasn't spotted until a paying customer complained about the hang.
I think you've found my former co-worker's lost twin. I wish I'd kept a copy of that project. It could have kept this site happy for months.
Admin
I think it's more likely to be some bit of software for communicating with a particular piece of audio hardware via MIDI - the Atari ST (I assume that's what's being referred to here) was quite famous for having MIDI ports, but had no on-board MIDI-like synthesiser hardware.
The DSP is presumably contained within the external hardware, as while the Atari Falcon possessed a rather nifty Motorola DSP, code for that was generally in a ZOMGWTF multiple-columns-of-code assembler format. Plus isn't too well supported by emulators, as far as I'm aware...
Still, no excuse for such hideous code! There were perfectly good C compilers available, and unlike early PCs you had a big, contiguous block of memory to play with - no arbitrary segmentation or limits on where executable code could be...
Admin
I can't find the isTrue()'s return variable.
Admin
A very intresting way of declaring an array
bt_styl: array[false..true] of integer;
ltr: array[false..true] of char;
Now the 2 dimensional arrays
2bt_styl: array[false..true, false..true] of integer;
Admin
wait... an array from the range of false to true?
Would that include Undefined, Null, FileNotFound and/or 42?
Admin
Nah
<font style="font-family: courier new;" size="2">TWENTYTWO: int = 22;
// later
</font><font style="font-family: courier new;" size="2">TWENTYTWO:= 7;
// later still
</font><font style="font-family: courier new;" size="2"></font>
Admin
For me, the WTF could have stopped after "...porting a Pascal-based system running inside of an Atari-emulator to a more modern platform."
A more modern system like what- an Apple2c?
www.lamecode.com
Admin
Sadly I'm willing to believe that too.
Admin
Half the time I come here to read the posts my head ends up hurting.
Yet I keep coming back for more.
Why do I do this to myself ...
Admin
No. I mean what I write and I write what I mean. "Aren't those the same thing?" you ask. No. They are not.
Admin
I hope you're being sarcastic. :|
I mean, what would you gain from it ?
If you would ever need to change the size of the array, you would have to change the name of the constant too... I would rather name the constant something that looked more like "ARRAYMAX"
Then, you can change from
const ARRAYMAX: int = 7
to
const ARRAYMAX: int = 12
without the need for a global S&R
My two cents...
Admin
What's better is that it could have been simplified:
bt_styl: array[Boolean] of Integer;
ltr: array[Boolean] of Char;
Admin
This sort of thing reminds me why, in college, the computer science department forbid the Computer Science majors from taking Fortran classes.
The official policy was that you could take them, but they would not count toward your degree in any way.
The unofficial policy was that CS majors simply could not take those classes. The teachers of them would drop you from the classes if you tried.
They would teach Fortran to the engineers, but not to the Comp. Sci's. Can't have the Computer Science people's brains polluted by that garbage, now can we?
Admin
Well, may be I didn't quite catch the sarcasm in your reply.
I began coding in Basic and later in Assembler on a C64 and never produced such things. And the C64 did have no OOP, too.
Admin
That's hilarous. [8-|]
Admin
Admin
My bet is that this started life as an Assembler for Atari program, and was then ported to Pascal. (Assembler only has global variables, and generally limits identifers to very short names.) My first C program (A port of an Assembler for Z-8000 program) looked a bit like this.
Admin
Thankfully Delphi and other dialects allow typecasts.
Gotta support Textfiles: http://www.textfiles.com/humor/REAL/mel-prog.txt
Boolean is of course defined as an enumeration:
... and array declarations can use their ordinal values.
Admin
Anyone else have a hard time reading that? Almost as painful as today's WTF.Â
Switch your Browser encoding to UTF-8 and it will clear up.
Admin
Unless, of course, the compiler was buggy or not fully implemented (which happened a lot in the old days, esp. for pascal).
I suppose C programmers would also be freaked out by the somearray : array ['A'..'Z'] of somedata; too... It was always handy to have MEANIFUL indicies -> the boolean idicies is still the most useful one outside the integer set (which did NOT have to be zero based... )