- 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
Aww, poor Reggie :(
It would have been a better idea to move the error-handling code into some common library/module though, innit? Manual search-and-replace can't be good.
Admin
I love the name. I wonder how many will "Get it"
Admin
And this, friends, is why we have code reviews... (at the very least, on a sample of the changed programs).
Admin
Admin
Regular expressions? A cutting edgy technology in the Cobol days?
Admin
Admin
I'm guessing the WTF is the fact that they didn't use an automated process for this, or the fact that they didn't have code reviews. Unless I'm missing details, seems like some grepping would work wonders for this problem.
Reggie really can't be blamed for this one because he didn't claim to be a programmer.
Admin
you are either sarcastic or naive.
reggie x preston = regular expression
Admin
So is the name an ironic description of his abilities, or was there never any contractor and the name is a metaphor for how the problem was actually solved?
Admin
Not a WTF. Oversights happen. "To err is human", yadda yadda.
FYI: A regex probably would have messed up even worse since you cannot be absolutely certain that there's no false positives in all that code.
Know whaddimean, vern?
Admin
Y'know, it didn't actually 'click' with me until I read your comment and I realized there was something there to 'get'. Then as soon as I realized it I was rolling on the floor.
Admin
Agreed. Regular expressions are awesome, but with a large set of files (20k) it's almost a guarantee that there will be cases which simply don't match the pattern, unless everything was copied and pasted.
Admin
Yawn...
Admin
Heh. Nice one, Alex. I caught the word play second time I saw that. ("Hey, doesn't that sound like...")
Admin
Code review? Come on, that still gets you the problem with that Mumps WTF where they store all the code in a global. The guy who said it was the way to go is the guy reviewing your code.
Admin
I assumed that Reggie X. Preston was an allegorical figure representing a regex. I guess everyone else here being programmers assume the literal meaning of everything.
Admin
If it was a regex, then why did it take months to do the work?
I assumed that the name is the authors "clever" hint that he thinks the person was entirely unnecessary and the job should have been done by a regex instead, which I've already said is somewhat foolhardy.
Admin
I used to work on that kind of system.
Kids these days have it easy. Kids these days can just use a quick Perl script to hack up all those batch files. Heck, the kids are probably using code libraries and subroutines so the error-handling code is all in one place. But even when there's no Perl and people aren't using subroutines, on modern systems you can just write a simple program to do the work, then run the program.
Imagine the horror if you're working on a system where "the set of files you can read and modify with a program that you wrote" and "the set of files that can be executed as batch files" are disjoint. A lot of pre-Unix systems have this "feature," which pretty much means you have to work for the computer vendor to write any kind of compiler for the machine.
My solution to this problem involved driving the system's text editor from macros running in a terminal program on a PC.
I've since been told that this is cheating--I was supposed to bribe the tape operators to accidentally mislabel a "programs" tape "data", then bribe them twice more to load the data onto a "data" volume and then some time later back up the "data" volume and restore it as a "programs" volume.
It turns out that three rounds of beers each time this is required was actually cheaper than the per-character charges for interactive access my department was paying for the terminal macros (at $0.80/kilobyte even $8 beers are cheap). Oops. Live and learn...
Admin
I had a different problem - how to make them STOP running a program when a problem appeared. The solution was simple - open the executable as a data file and rewrite the first record with an error message. The executable refused to run and I knew who caused the problem.
The trick worked great in Decsystem-10 Cobol, but Vax Cobol is just too well protected for this to work today. Hence the comments in front of everything.
Admin
I miss Jim Varney. He had a lot of talent in spite of that Ernest P. Worrell routine.
Admin
I think the work RegX had to do is less of a WTF than the fact that their batch code was so crappy. Let's just auto-abend everything so the workers can keep working. Why not make the code work right in the first place? RegX is just a band-aid to the real WTF
Admin
If you assume that "Reggie X. Preston" stands for "regex", I find that other comment much more disturbing... How he was called in to write a spec...
Admin
Please can I have a sample of your magic code that can automatically fix problems outside of the programs control so it never needs to abort?
Thanks in advance.
Admin
Interesting, but my take is that still using a pre-Unix system in 2007 is a WTF. As painful as people claim porting is, it's always better than that never-ending pain. (At least port to a modern OS if you have too much code to switch languages.) I sure hope this article is from some retiring programmer's memoirs of the glory days...
Admin
It's even better than that:
reggie x preston = Regular expression: Presto.
Admin
COBOL is still in wide use for business applications, which is a WTF in itself.
Admin
Think about it: Management makes decision:
Programmer allows batch to tie up the system until something is done by the programmer Programmer starts getting calls at 2am Programmer 'fixes' program by restarting it 'automagically' Programmer can sleep at nightWhile at first it would appear that the 'fix' was great, it would seem to me that the "countless" phone calls described in the WTF would indicate that the issue was with the programs themselves rather than the users' issues.
Contrary to what we'd like, we exist for our users.
We, as programmers, are lazy - so we do things like prevent users from typing stupid things into our programs. Why?
To keep the system from breaking? maybe To avoid handling support calls? Absolutely
Admin
Interesting. Recently I started learning COBOL in preparation for a potential conversion/rewrite side project. Coming from a strong C background, the verbosity is a bit much. If I were a programmer back in the glory days of COBOL I surely would have been a serial killer.
Admin
Now I wish you hand't explained (don't feel bad, I never really wanted to know in the first place). As I don't speak with a lisp, I also failed to "get it".
Admin
I thought the point was that the person behaved LIKE a regular expression, thus his name stemmed from this similarity. However, as said, using a regular expression would be fool-hardy. And indeed, here are the consequences.
Admin
Yeah, and this is what I meant to quote, not simply reply to.
Admin
Admin
If you hire a competent person for this, he'll get bored after first 100 fixed programs. Incompetents (like our dear regexp, who didn't understand the code he was fixing) slog through, as they find it a challenge. Of course, the quality suffers without supervision.
Nowadays, though, a competent person would whip out a script to do the job after getting bored.
Admin
And this, friends, is why we must be very careful when using Regular Expressions.
Admin
At the risk of being one of those boring commenters who states the bleeding obvious wrt the "right way", the obvious solution is: 1/ Use a script + regexes to bulk-modify the code automatically, and THEN 2/ Use a difference tool to manually verify the before-and-after states of the files, at least to a reasonable comfort point.
Admin
To everyone who said: There might be false positives with a RegEx sounds like someone who doesn't drive because some people speed. If every batch file uses this old system, then you 1.) Make a back up of all the files. 2.) automate the change 3.) review the changed portions; files that had no change should be checked as well as a quick review of each piece changed. 3.) Test a random sample of the files if they are too numerous and time constraints prevent testing all of them. Following these steps, you would still be done before the contractor who was apparently hired for three times as long as he was needed gets through changing them all by hand, and you don't have to worry about typos or other human error (such as "That doesn't look right, I might as well fix that while I'm here..."). Of course, if you have as many programmers as the story makes it sound like, and who are all very annoyed by all these calls, you could have all of them fix the files for which they're responsible.
Admin
I disagree. NOT using regular expressions to modify many thousands of lines of code that are supposed to be the same is foolhardy.
On the other hand, there are a couple of things that a more seasoned programmer might have done to prevent problems:
a) Write the regexp very carefully. Seems obvious, but I know several people who just dash them off. It's amazing how many problems you can prevent by reading what you just wrote.
b) TEST the regexp! Use 'grep' to try out your regexp on all this code and have it dump the matching lines to a file. Then LOOK at the file and see if you see anything odd. Even with all that stuff scrolling past, the oddballs ought to jump out.
But come ON, man. The fact that a regexp MIGHT come up with false positives means that instead of 20,000 lines of code to review, you have 2,000. And the original post says they did the intelligent thing: They wrote a new regexp to deal with that too.
Computers are machines. They are meant to do work for us. If there is a tedious, repetitive task, the computer should do it, if at all possible. We're programmers because it's our job to figure out how to do that best. Just because it isn't likely that we'll be wildly successful on the FIRST TRY doesn't mean we shouldn't try at all.
--J
Admin
Admin
I just want to know where he got a wooden table big enough for 20,000 files.
...And the resolution would be rubbish on even a top of the line camera.
And, even if he had managed all of that, the resulting print out would never fit in the fax machine.
This is not a real wtf.
Admin
Admin
The correct way is to fix the first 100 programs to find out how long it should take you to change a program, write a script that makes it look like you are taking the same time as if you were doing it manually and then sit back and play quake for 3 months.
Admin
[quote user="Justin"][quote user="standgale"] But come ON, man. The fact that a regexp MIGHT come up with false positives means that instead of 20,000 lines of code to review, you have 2,000.
--J[/quote]
The problem is not with the false positives - those you can indeed review.
What will you do to review the false negatives?
Admin
[quote user="japh"][quote user="Justin"][quote user="standgale"] But come ON, man. The fact that a regexp MIGHT come up with false positives means that instead of 20,000 lines of code to review, you have 2,000.
--J[/quote]
The problem is not with the false positives - those you can indeed review.
What will you do to review the false negatives?[/quote]
To say nothing of the false FILE_NOT_FOUNDs!
Admin
Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems.
Admin
Was his real name "sed" or "perl" or "awk" or...?
Admin
what about regexp replacements?
Admin
This is cobol. I believe it is space sensitive along with verbose among other annoying characteristics. The chance of a regexp having an "oops" editing cobol is a lot lower than for something like "C". Seems like the Burroughs mainframe I was a sysop for a long time ago didn't have regexps.
Admin
and this is why the cool frameworks built on the principle of MVC steal the limelight.. ok.. not exactly mvc in this case.. but u get my point..
Admin
Just got to read this. From a German perspective, the ABENDMOD is a funny concept. The article starts with calling people at night and "Abend" is the evening in German, so it looks like "The poor dude who's got the graveyard shift babysitting the system".