- 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
Since the VB programmer was reading the text on forms that he had access to in VB, I'm thinking there are definate paths to finding out what the state of an operation was other than this approach.
He's in FoxPro for crying out loud... you already have an object model for getting at FoxPro data!
Admin
I think what you are saying is that this isn't so much a WTF than it is a work-around to another WTF.
In any event, if this were the case, it makes it even more dangerous because it would be coupling the code to a secondary or tertiary property of somone else's module. No reasonable developer is going to consider the color of the component to be an unchangeable contract. In other words, developers don't think, "hmm if I change the color of this label, it might break somone's code."
Admin
Yes, I realize that...
Granted, I know next to nothing about FoxPro program structure, but SaveNewClientData is modifying elements of the form, right? So it either exists in the same module, or a reference to the form was passed to it. I would bet the former. Also, SaveNewClientData is not qualified as to namespace or library/class, so I would guess it's local.
Please correct me if I'm wrong. Is everything "global" in FoxPro?
Admin
I'm confident that AmmoQ is a very competent developer. Perhaps he's playing devil's advocate. I think his point here is that sometimes, you're given a WTF, and no time to fix it so you just pile it on. I know I have done this. Sometimes it's the most reasonable approach.
Admin
By changing the background colors rapidly, we get the users to lapse into epileptic fits.. It's a million laughs, dude, ya gotta see it... Really!
OR
It's all part of our Logic Reduction Program which, by the way, is really coming along quite well.
OR
I.... Am... Job... Yes? I code you like boy howdy... Yes?
Admin
Hold on there, Mung Kee. Homeland Security is not supposed to be paying any attention to color. Are you saying they are profiling?
Admin
Everything is a WTF in FoxPro. I've never used it to progam but I've had to use FoxPro 'databases' in PowerBuilder. It's really fun because there are no uniqueness requirements at all. You can have a table with100 identical rows. It's loads of fun trying to get a datawindow or datapipeline to work properly with that kind of data.
Admin
Everyone seems to have focused on the perfectly legitimate use of color and ignored the real WTF: there is no ELSE branch.
So, sometimes the poor user will save his new client data but not see a warm & fuzzy message box! How could you people
not see this blindingly obvious error?
ok
dpm
Admin
Well, it is in the RGB color system...
Admin
Well, it is in the RGB color system...
Admin
Indeed. That still doesn't make G a primary color.
Admin
Gotcha. All WTF, all the time.
I guess even in SQL Server, if you choose not to define a PK, you can shoot yourself in the foot also.
You've made your WTF, now you lie in it.
Admin
Definitely not. That doesn't mean I haven't made WTFs, it's just nobody has ever posted them here. ;-)
I'm just guessing why someone would create such code. From a global point of view, it's a WTF, no question.
It depends on the circumstances. This code looks like legacy to me, maybe the source for "SaveNewClientData" is no longer available or it is to complicated (unreadable) to savely change anything in it. Maybe the whole program is totally opaque and the programmer who did that change - who is probably not the original programmer - wanted to keep his changes as small and local as possible. In such a case, when "SaveNewClientData" will never ever use other colors and the whole system will be dropped soon anyway, it might be the easiest and cheapest way to do it.
Right. Of course we all deeply want to do the right thing but there's a lot of WTF legacy out there that wont be any better if you break the consistent uglyness.
Admin
I was wondering when someone would point that out (and preparing to do it myself if no one else did). Not that I'm real thrilled with the color logic, but at least if you're going to do it, do it right.
Admin
One thing for sure, the developer is not color-blinded. [H]
Admin
Of course, since FoxPro databases are AFAIK dbase files. These were pre-SQL "databases" (I'm not sure if they deserve that name) where you would step through the records sequentially, each record has a given "record number" etc. Newer tools that think in terms of SQL databases have difficuties with these file-based "databases".
Admin
And we know ALL the colors in the RGB color system are primary colors. In fact, they're changing the name to the "RYB" color system.
Admin
First, any modern operating system (don't use DOS...if you really want to say DOS was a good OS, you are in serious need of therapy) REQUIRES AT LEAST 4-5 Meg of supporting files. Java (which you agree is piggish) requires 20ish. You CAN get away with crt.dll (only 186k) on Windows, but you will also be using several other OS dll files to make up for it. This is assuming you aren't using MFC.dll.
Now, you can argue that MFC is evil..I won't fight it, but if you are using C++ and NOT using it, good luck making any kind of time to market. If Time to market is not a concern to you, well, you don't really have an opinion that matters. Time to market is pretty much ALL that anyone who signs our checks really gives a damn about. If they stop signing, you will likely end up as a fry cook with those amazing social skills of yours.
Once again, I say...EVERY MODERN PROGRAMMING LANGUAGE HAS A RUNTIME. VB wasn't the first, and I agree at the time it was a good bit, but it really didn't wear that albatross solo for long (ok, actually Visual C was the first, but MS included the runtime with the OS, a promise they made to VB programmers that they never made good on, much like adding .NET runtimes to the OS).
The P-Code advantage was NOT portability. Hell, JAVA was never supposed to actually be portable. That's somehting marketing made up and the team had to make good on. P-Code existed to take little harddrive space. P-Code was a concept developed by ex-mainframe folks who thought every tiny bit of storage needed to be hoarded. It was a natural extension of dll files. Add a runtime (which is actually nothing more than a group of dll files) and your exe's are much smaller than an app that doesn't require it. That 5 meg runtime along with 6 applications takes up less space than 6 apps written in C that are 2 megs each. This was a time when harddrives were still sub-gig and businesses took storage space as a serious issue. Technology broke us out of this sink, but for the time, it WAS actually a good solution. For a GUI application, P-Code could wait just as fast as anything else for a user to click a button. Did you know Excel was once written in P-Code? It existed as P-Code (with a runtime bootstrapper) long before VB4 (VB3 was purely interpreted).
Now, that stated, I hate VB as a language. I never liked it. It WAS however, the solution to what most businesses needed. It IS the reason so many of us actually have jobs currently. It MADE the IT department in most corporations. Like it or not, it opened the door for corporate acceptance of desktop applications. C++ would have failed miserably and Delphi (the only RAD competition and actually a superior product) had Borland to mismanage and screw it up. VB is a horrible mess as a language, but it filled a void that our industry needed.
Learn to research, then form an opinion. Otherwise, your opinion means nothing. Hell, if you are going to hate something, hate it for valid reasons (like the almost but not quite OO abortion that VB was). It was a programming language. It was a successful programming language (as in, projects that were coded in it are still in use in a widespread manner). It was responsible for a lot of our peers to make a paycheck every month. How people can hate an abstract like a programming language with such furor is simply beyond me. It's not a fucking religion. Bad code was and is written in every language.
That said, I'm 39. I wish I was still a kid.
Admin
"Indeed. That still doesn't make G a primary color."
I think maybe you need to review what it means to be a primary color.
But, just for review, from yourdictionary.com:
A color belonging to any of three groups each of which is regarded as generating all colors, with the groups being:
a. Additive, physiological, or light primaries red, green, and blue. Lights of red, green, and blue wavelengths may be mixed to produce all colors.
b. Subtractive or colorant primaries magenta, yellow, and cyan. Substances that reflect light of one of these wavelengths and absorb other wavelengths may be mixed to produce all colors.
c. Psychological primaries red, yellow, green, and blue, plus the achromatic pair black and white. All colors may be subjectively conceived as mixtures of these.
(if you're wondering where "red/yellow/blue" is, it's the 2nd one (subtractive/reflective/pigment-based), corrected to the actual color values ... also, I think c is more physiological than psychological, in that it's about how the human eye identifies colors with its different receptors)
Admin
"I think this is my favorite WTF ever. I think I want to use this concept in my current code, except I program IVRs, so I'd have to use tone of voice..."
Hm. (with apologies to monty python)
Coworker 1: "I expected the voicemail menu to have an argumentative tone, and instead I got an insulting one!"
Coworker 2: "Oh, that means you entered the wrong voicemail box."
Admin
I believe the politically correct term is "African-American Logic".
Admin
Mike R:
scheky:
> Learn to research, then form an opinion. Otherwise, your opinion means nothing.
His opinion meant something to me. He supplied a context which gave it meaning: "four floppies" obviously referred to
an earlier era in which that amount far exceeded the norm for a runtime. Granted, he should have s/requres/required/
but I in turn expect you and other WTFers to read between the lines.
P.S. Your function names are too blue. STR.
ok
dpm
Admin
No, and it has been like that since it was first released. Later versions have even more non-globals.
Sincerely,
Gene Wirchenko
Admin
You were right...and I did.
I humbly stand corrected. I knew that light emitting devices used RGB, but I was unaware that these were classified as primary.
Mea culpa. My apologies.
Admin
I've been reading this blog/forum for a while now, and this is the first time I've really, really, i mean REALLY felt the urgent need to create an account and make a comment.
Why?
Because I work for a company that does this kind of thing ALL the goddamn time, and it has pissed me off from day one.
They (a specific department of the company, which is actually the main department, which I fortunately do not work for a lot of the time but which I am made to lend a helping hand once in a while) are insistant on using Borland C++ Builder for their apps, which I find to be one of the most annoying programming environments I've ever used. They are so proud and happy to be using a Rapid Application Development environment... every time I have to work on one of their applications I feel like screaming and pulling my hair out. RAD? Give me make, emacs and a command-line any day of the week. Actually for Windows-specific stuff I find VC++ way better than Builder and their kludge of a toolkit, VCL, which was very obviously not designed for use in C++ but meant for Pascal/Dephi.
Anyways, I digress.. The point is that their main application is a graphical terminal for controlling "reliable" fiber optics equipment for expensive long-distance communications links.
The hardware itself isn't so bad but the code in the PC-side software is so incredibly awful, I've always been tempted to submit half of it to this site. (The firmware isn't a hell of a lot better.)
They are constantly using edit box colors (named, appropriately, Edit1, Edit2, Edit3, whatever their actual function happens to be) to not only signify things to the user, but to affect program flow. Fortunately they use things like RED=RGB(255,0,0) .... for the most part anyway ... but it is still horrible to look at and debug.
Ah, obviously I could go on here but I would stride way off-topic...
Perhaps I'll post a specific example if I have time to go find one.
Admin
That would about be it. There are various colour receptors in the eye, ranging from those reacting most strongly to red over those that react to green (those are the most numerous and sensitive) to those that react to blue and finally violet. Colours can also result from stimulating several of these at once.
The psychological model is most closely represented by the HSV model. H for Hue is the angle in a colur wheel. S for Saturation is how, well, saturated the colour appears. Lack of S means grey. V for Value is the brightness, ranging from black to white. (Depending on the exact model.)
Admin
That would depend on version. If you are using a version from ten years ago, you might be right. For the last about ten years, just define a primary key.
Sincerely,
Gene Wirchenko
Admin
Not that I know anything, but wikipedia disagrees with you:
"The machine independence was achieved by defining a virtual machine called the p-Machine... with its own instruction set called p-Code (or pseudo-code)."
Hmm... I highly doubt that any application was written in p-Code. It may have been written in Pascal and compiled to p-Code...
sacha
Admin
FoxPro has had SQL for about fifteen years.
Sincerely,
Gene Wirchenko
Admin
GREAT post, couldn't agree more.
Admin
It is a good thing that good old Windows Update pushes that .NET framework out there. How many floppies would that be to get 'Hello World' to display in C# or VB.NET. I know we all hate those languages ...
so why really is there so much hate for VB language vs. another language?
Admin
WTF. You don't need to develop against MFC to do Windows development in a reasonable time frame. I've done plenty of Windows development using Qt and have certainly not missed the uncomfortably evil stain on my soul that forms when using MFC.
Admin
Uh, they can hate it pretty easily. Duh. Your notion of what people can hate with furor is thankfully not universal: I rather enjoy my sweet loathing of software development abstracts.
Admin
For those of you who have been saying that this is FoxPro code, this code could be Visual FoxPro code except:
2) The line continuation character in VFP is not "_"; it is ";".
3) VFP does not have "MsgBox". Its equivalent is "messagebox". VFP, like many languages, requires parens around function arguments.
4) VFP does not have "ElseIf". Use "else<new line>if" as many other languages require.
5) VFP does not have "End If". Its equivalent is "endif".
6) VFP does have a "call" statement, but it is for calling machine language routines. It is rather doubtful that such a routine would be for saving data.
The above code looks like VB.
Sincerely,
Gene Wirchenko
Admin
Doesn't/Didnt't FoxPro work on the same files like DBase, Clipper? I didn't mean to say they cannot be queried by SQL, but unlike "pure" SQL databases, the position within a file may be meaningfull in a Dbase file. For example, you can say "go to the 51st record and delete it". Of course not something you should build relations on, but sufficient for a database tool to identify exactly one row without actually knowing (or even having) a primary key. (comparable to the rowid in Oracle's database)
Admin
DOS COM files needed a bios, minimally, as well as the usual CPU microcode. But you're right that arguing about how large a program is without a well-defined definition of program is pointless.
Space. Also reduction of compiler-development effort (any standard intermediate form allows for a separation of front-end from back-end in compiler design, reducing the effort to write compilers for new machines).
Admin
For hello world, the .net compact framework should easily do, and it would easily fit on two floppies. Of course the full .net framework is larger, but that's not because of the requirements of hello word ;-)
Actually, I do have a weak spot for C#.
Admin
squirrel bait rocks
-Virgil
Admin
Scheky: maybe Mike R was exaggerating, but if Anonymous's statement had been serious (I don't think so), someone would point out that reusing variables in this simple way could only be a requirement in embedded or very memory-constrained systems, in which you could never load the big runtime required by these interpreters. We're talking about systems programmed in C or assembly.
Admin
Well, The code I sent to Alex was in fact Fox Pro, Alex may have edited it for readability. the 'End If' was an 'EndIf' when I sent it in.
Admin
<FONT face="Courier New" size=2>that can't possibly happen because the drugs are illegal.</FONT>
<FONT face="Courier New" size=2>[developer] everybody made fun of me for working in the inverted color scheme and 24-point lucidia console, and now i have my revenge! now, if you'll excuse me, i'm going to join the gnomes in air duct because they stole my air freshner.
[manager] uh...
[developer] and don't follow me down there! it's dangerous! you think it's easy to sit here day in and day out with the gnomes? the gnomes are vicious! they have the tubers!</FONT>
Admin
Yes, it does. It's a primary color in the RGB system, because in that system, every other color is composed from these three. That's precisely the definition of a "primary color".
Admin
DLLs are distinct from runtimes. A runtime can be a DLL, but not all DLLs are runtimes.
Moore's law refers to transistor densities on ICs, not hard drive capacities. It is only happy coincedince that hard drive capacities have followed a similar curve. As for it 'taking off', Moore made his prediction well before VB came out, and it was holding just fine.
If, as you say, the main reason was to reduce space, why did the requirement for the VB runtime persist right up to VB6? Why not simply compile to native code, like most languages, then have a library of standard controls etc in a DLL? The space requirements are similar, but the performance of the latter is much better.
Admin
I'm not worthy! Mind-blowingly awesome.
Admin
[developer] Because it proactively integrates our synergy paradigm to strategically leverage solutions for an increased productivity potential!
Admin
[5 coworkers simultanously] BULLSHIT!
Admin
Many programs written in VB either had to ship the runtimes with their installer (which made it a HUGE download in the days before widespread broadband) or insist the user download it separately. VC++ runtimes weren't as onerous, as they were somewhat modularized and quite a bit smaller than their VB counterparts.
The fact that you don't know this illustrates that you've haven't actually deployed shrinkwrapped software to Windows. I'll assume you meant "Perl". Apps written in each of these will usually run on a variety of different versions of their respective interpreters. You usually don't need to separately download and install three versions of runtimes to run your Java programs, you can usually get away with running one: the latest version. VB was usually highly tied to the runtime of its particular major version, which meant that you indeed needed each separate runtime. He didn't make a blanket statement. He said VB's runtime was very large and that it was the only one he knew that behaved that way. A well-considered response would have corrected this, not called names like a child.
Admin
The present tense is appropriate. Visual FoxPro is at version 9.
Basically, yes. There have been minor format changes, and Clipper did go with its own changes to the format as well..
Yes, you can go to record 51. You can also use SQL. Being able to mix record- and set-oriented commands can be very useful.
Sincerely,
Gene Wirchenko
Admin
I anonymzie code before posting. Since the language of the code was not at all a factor of the "WTF" (heck, it coulda been HTML/Javascript), I put it in something I was more familiar with (and could more easily hilight in HTML).
Admin
P-Code was supposed to be portable?!! When I disassembled the VB3 platform the 'opcodes' were actually offsets within one of the interpreter's 64kb text segments! (the last couple of x86 instructions executed for each instruction were something like "lods ax" / "jmp near ax").