- 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
Morale of the day: becareful what you wish for.
Being tasked with a complete rewrite is a good thing ONLY IFF you have requirements or specifications beyond "it should work just like the current app".
Admin
I have iterated your methods pray I don't iterate them any further.
Admin
"ARE YOU SURE AFT CARGO COMPARTMENT IS EMPTY!!!!"
What is your question!!!!!!!
Admin
Nice.. VB6 in aircraft software. Maybe, hopefully, it's simulator software.
(Assuming the Dash 8 involved is in fact the de Havilland Dash 8 (see http://en.wikipedia.org/wiki/Bombardier_Dash_8))
Admin
ONLY IFF = ONLY (IF AND ONLY IF).
Happy to help. My fees are reasonable. Let's go to the ATM machine, punch in your PIN number, and withdraw a shiny quarter.
Admin
I particularly like all of the empty Else End If blocks.
'Cuz, you can't write an If without and Else.... That'd be crazy.
Admin
I have failed to frist your post. Pray I don't fail to frist it any further.
Admin
I am flying on a Dash-8 tomorrow. Ugh.
Admin
I'd be very careful. This seems to be a ground-based tool that manages airplane load and weight distribution. Probably it does other things, too, but Dash 8 is a plane made by Bombardier, PAX are passengers, etc. Maybe the submitter just doesn't have a clue, but the logic for this application is pretty much given by the manufacturer and airline operation manuals. I don't know this particular application, and I have nothing to do with airline industry, but I presume if I could figure it out in one minute, the submitter better ask themselves "should I be doing the job"?
Yes, the application is a WTF, because many such frontline apps are on life support since day one, and all fixes/modifications are done with flames under your feet, and the industry is chronically short of money, yada yada.
But methinks TDWTF is that the submitter seems somehow confused -- he shouldn't be.
Admin
Ok, I think we've found the root cause for these: http://en.wikipedia.org/wiki/Bombardier_Dash_8#Incidents_and_accidents
Admin
Fixed?
Admin
Me too, but I don't think we are that lucky. As the code presented apparently are concerned with bagage load in a Dash 8. Considering the elefantine slow development in the air industry, I would not be surprised to see our national carrier (SAS) use WB6 or something similar in use today....
Yazeran.
Plan: To go to Mars one day with a hammer (And NOT on a Dash-8 :-))
Admin
This must be the US localization as more than half of rules are about being overweight.
Admin
You made me giggle with that addition to your signature :)
Admin
I think I could have quite happily lived the rest of my life without seeing JOptionPane and vbOKOnly in the same line of code. Thanks for ruining that for me.
Admin
If this is truly a rewrite, the butt-ugly implementation doesn't matter, else. Design the new application in a way that makes sense from the original requirements. If the original requirements can't be found or don't exist, derive a new set from the way the old application is used, else.
Admin
Response = 6
Admin
Admin
Admin
Wow, that's pretty bad code. It would be worth a million to rewrite it. Intro was exciting -- someone could make a movie about this. They could call it Brewster's Millions.
Admin
Hey it works. Don't mess with it. Rewriting SOUNDS good, but the code has years of undocumented business rules in it that you'll never figure out.
Admin
"frame500 = 1" and "frame500 = 2". Pretty sure you didn't mean to assign a value here.
Admin
NOT VB6 - it is VBA. The line
DoCmd.OpenReport stDocName, acPreview
is specific to MS Access.
Admin
Umm.. Where is the WTF? Badly written, perhaps... Lacking easy maintainability, sure... But a WTF? Not really. I've seen worse, daily.. for most of my career. If the function was being recursively called with a static integer and a case statement to decide which if statement to check.. now that would be a WTF.
Now that would be a WTF. Excuse any syntactical errors, I haven't written any VB in a looooong time.
-Yard
Admin
Pssh. Whippersnappers. When your idea of ancient doesn't involve having to read tech manuals and language references written on dead tree media, I don't have any sympathy.
VB6 sucks, but VB6 and MSSQL2k is nothing compared to working with crap like COBOL or RPG, working on legacy databases (Turbo Image, anyone?)
Admin
Oh. In that case, isn't there a wizard you can use to refactor it?
Admin
Bad VBA code... what a surprise!
I am continually amazed that people really just throw together shitty code without any idea of what it does or how it can be improved. Even when I was actively doing programming I had some dozen programming blogs and websites that I visited regularly, and I had subscriptions to magazines and video sites where I could hone my skills and become a better developer.
Yet, almost everything that comes here is tossed together by some twit who has no idea what they're doing, and probably learned by picking up a SAMS "Teach Yourself VBA in 24 Hours" book, and never once thought "Hmm there might be a better way to do this" or "Maybe I should use descriptive names instead of the defaults". What the hell goes through the minds of these people? Are they just ignorant?
Admin
Admin
It's scheduling/manifest software, not flight applications. This would never pass V&V. Besides, DASH-8s don't have compartmentalized mass sensors.
Admin
Agreed, planned to say the same thing. This is ugly as hell and it certainly shows that the devloper wasn't your best and brightest, but it isn't really a WTF.
On that note, VB has a bad wrap less becuase of the language, and more because of its accesibility. People who don't know much about good practices or developing for maintainability are more commonly using VB, but that doesn't mean the language itself is a WTF or that good code can't be written with it. Same goes for MS Access, used right, and within the limits of what it is designed for, it's a decent little app for small scall and quick turnarounds; the problem isn't the platform, it's the accessibility to poor developers.
Admin
Admin
Admin
Admin
Admin
Who doesn't like having to rewrite code to reproduce the same buggy or just-plain-wrong behavior as the original?
Hmm. Turns out it wasn't that funny after all.
Admin
Can I call you Al?
Admin
Sure, and I can call you Betty.
Admin
I have refactored the code...pray that it works.
Admin
EXACTLY. A rewrite should only look at requirements, not the hideous old implementation. Throw that code into a vault and only take it out if you install the rewrite and they go "heyyy it doesn't work like it used to". Then you go "well, why did you give me invalid requirements?". Only THEN do you take out the old program and try to see how it behaved, add those to the requirements, and then lock it in a dark place again.
Admin
And that is TRWTF. The programmers who write these books are ultimately responsible for about 90% of all WTFs for convincing people who have no business programming anything more advanced than a VCR that they too could be leet coders, and in just 1 day!
Admin
Apparently all you have to do is write an app that ejects the CD tray.
Admin
I don't find that stuff amusing anymore...
Admin
The real WTF is the angels in the architecture. What were they thinking? Everyone knows that leads to an endless loop...
Admin
What's that?
Admin
The very fact that the submitter has to rewrite the app implies that it wasn't done right the first time. Even so, in such projects, the original code may end up being the only semi-reliable documentation you have.
Admin
Wrong, wrong, wrong, wrong, and wrong.
A few years back, a JoelOnSoftware column made a pretty good (but imperfect) case for never doing a rewrite at all. The basic premise was that as you are spending a huge amount of time and money on the rewrite, you are also reintroducing bugs that your organization already spent time and money diagnosing and correcting. He figures you're throwing out years of accumulated knowledge, and history provides plenty of support for that point.
The flaw in the argument is that you don't HAVE TO throw out the knowledge encoded in the old implementation, if you use the legacy code as a de facto repository of requirements and specifications. If you insist on ignoring the old code, then Joel is right. Relying on requirements will fail for two main reasons.
First, you don't have good requirements. If there was an original requirement document, you're lucky. If it were maintained in parallel to the code, that would be miraculous. If you try to get new requirements from scratch, a million things that are taken for granted in the legacy app won't be mentioned; you will go from a mature but ugly product to a pretty-looking v1.0 that frustrates your staff and angers your customers.
Second, many of the bugs you're going to reintroduce are technical issues that won't show up in the requirements. Those bugs showed up in the first implementation because they're common mistakes; you're going to make some of them too, unless you're being reminded not to because you're looking at the steps the maintenance teams have taken to correct them.
Of course, since you're probably porting to a different language or environment, some of the technical bugs in the legacy system may not apply to the new system. (For example, a C-to-Java port won't reintroduce a lot of memory leaks.) And on the other hand, the new environment will offer the opportunity to make new mistakes that the legacy system never faced. To that degree, Joel has a point; but at least those will be new bugs (not reintroduced ones) which might get you some political wiggle room.
The point is, if you're going to write that much new code, you need to do everything you can to ensure you're covering the bases, and that means you'd better make sure you understand what the legacy system does (not just what somenoe says it's "supposed to" do).
Admin
I definitely agree. There are things in there that really should be enums (does VB even have an enum, though? You could at least use constants to make things clearer) but the logic doesn't seem that bad. It's testing that the loading of the airplane is valid.
Why? They are looking at CARGO weight.
Admin
Bravo. Anyone who imagines that using new or original requirements to rewrite a legacy app is the 'right' way to do it, is just asking for trouble. That kind of thinking will turn what can normally be done with a reasonable amount of confidence and grace, into a stupendous cluster-f*ck.
I mean, sure.. It'd be nice to stick it to the business users and say "well, your requirements are plain wrong, that's why it doesn't work the way you expect" but really.. who are you doing any good for in that case? You're expanding the project life cycle indefinitely. If you're a responsible and well-adjusted person you work with the business to recreate the requirements from the original code as you go, not try to 'stick it to em'.
Let's all try to be human beings here, not jackals.
-Yard
Admin
Spinning in infinity.
Admin
All business rules are documented as VBA-code.