Comment On Fred Blogs' MegaQuit()

A few years ago, Gregory was about to start development on a quoting system, when the client pulled-out all of a sudden. “We appreciate all the work you put in so far,” they told him, “but your overall estimate was just too much; we were able to find someone else who could develop this for less than a third of your cost.” [expand full text]
« PrevPage 1 | Page 2Next »

Re: Fred Blogs' MegaQuit()

2010-04-05 09:06 • by Keloran (unregistered)
FrErr(comment + "frist");

Re: Fred Blogs' MegaQuit()

2010-04-05 09:10 • by frits
Doesn't all VBA code look like this?

HoldIt() does have one mistake. Fred forgot to put a DoEvents in the loop.

Re: Fred Blogs' MegaQuit()

2010-04-05 09:22 • by highphilosopher (unregistered)
So I have to say that you should expect nothing less that high quality WTF's coming out of an Access Database. It's the breeding ground where they usually start.

Re: Fred Blogs' MegaQuit()

2010-04-05 09:24 • by dpm
Well, now I'm finally motivated. I've been meaning to write some kind of function that would, I dunno, maybe "sleep" for a given amount of time or something without sucking up CPU . . . but I'm such a slacker that I've been sitting on my butt instead. Today I will write it! I can already imagine every VB programmer in the world singing my praises.

Re: Fred Blogs' MegaQuit()

2010-04-05 09:31 • by justsomedude (unregistered)
304574 in reply to 304572
highphilosopher:
So I have to say that you should expect nothing less that high quality WTF's coming out of an Access Database. It's the breeding ground where they usually start.



The problem isn't that access is horrible, it's great for what it's designed for - and the same applies to VBA. I've built surdy stuff in it when things had to be both simple and fastly done, stuff that ran fine for many years, met the need, and was liked by the end users.

It's not the platform itself, that it's *so* accessible, you get a lot of crap built by people that shouldn't be developing in the first place.

Re: Fred Blogs' MegaQuit()

2010-04-05 09:31 • by Ben L. (unregistered)
I'm broken. I Don't know what happened (I wasn't running at the time),
but I called: my mom and bang! The duff code came back with
0: Success. Sorry.

Re: Fred Blogs' MegaQuit()

2010-04-05 09:35 • by Fred (unregistered)
Sorry, just couldn't HoldIt longish enough

Re: Fred Blogs' MegaQuit()

2010-04-05 09:39 • by Patrick (unregistered)
You have to at least give credit to Fred for trying out some AI in the error handling. Too bad he basically made an artificial retard...

Re: Fred Blogs' MegaQuit()

2010-04-05 09:44 • by The MAZZTer
Fred forgot to declare Count Static, so count will never be more than 1 (VB will initialize it to 0 every time it enters the function since when it leaves it goes out of scope because it's not Static).

Re: Fred Blogs' MegaQuit()

2010-04-05 09:45 • by anony mouse (unregistered)
As the family unpaid computer support guy, I wish more software had a "Have you tried restarting?" built-in suggestion.

Re: Fred Blogs' MegaQuit()

2010-04-05 09:48 • by Nibh (unregistered)
304580 in reply to 304569
I don't see the WTF. These are EXCELLENT error messages from a usability standpoint. They'd take me from pissed off to laughing in three seconds flat. Really, what other purpose does an error message serve to an end user?

Re: Fred Blogs' MegaQuit()

2010-04-05 09:53 • by filo (unregistered)
HoldIt is a pseudo random infinite loop generator, nice!

Re: Fred Blogs' MegaQuit()

2010-04-05 09:59 • by BBT (unregistered)
So, for HoldIt...
If you call it in the 59th second of the minute, it's guaranteed to infinitely loop. If you call it with "longish" >= 59, it is guaranteed to infinitely loop. If you call it with "longish" greater than or equal to 59 minus the current second, it will infinitely loop.

That's one brillant function.

Re: Fred Blogs' MegaQuit()

2010-04-05 10:02 • by SuperAnalyst
1. The MegaQuit() looks a little messy. I'd personally rewrite before it saw a Production db.

2. That FrErr() looked fine unil I saw the Count variable. (Where did that come from?)

3. The Sleep() is something I did myself when I was first learning the basics. I dropped it about 5 seconds after running it for the first time.

Overall, for a first draft, this code looks acceptable. But to send it out to end users? Did Fred Blogs have something issue with the company? His father-in-law perhaps?

Re: Fred Blogs' MegaQuit()

2010-04-05 10:07 • by Timothy Baldridge (unregistered)
Sorry, I tried to enter the Captcha, but the duff came back with "wrong word".

Re: Fred Blogs' MegaQuit()

2010-04-05 10:09 • by Alargule (unregistered)
Gregory.

Re: Fred Blogs' MegaQuit()

2010-04-05 10:19 • by Ramses So let it be written so let it be done (unregistered)
I think all error msgs so say:

"The application crashed and it's your fault."

"Reboot your PC."

There would then also be an animated GIF of Bart Simpson benind over and mooning the user.

Re: Fred Blogs' MegaQuit()

2010-04-05 10:20 • by Ramses So let it be written so let it be done (unregistered)
304587 in reply to 304586
Ramses So let it be written so let it be done:
I think all error msgs should say:

"The application crashed and it's your fault."

"Reboot your PC."

There would then also be an animated GIF of Bart Simpson bending over and mooning the user.



Sheesh, I type very goodly...

Re: Fred Blogs' MegaQuit()

2010-04-05 10:22 • by MadX (unregistered)
Someone should try to put that WTF to music. Opera, maybe?

Re: Fred Blogs' MegaQuit()

2010-04-05 10:31 • by Bubba (unregistered)
A bit of .Net would fix that right up.

Re: Fred Blogs' MegaQuit()

2010-04-05 10:46 • by Paula (unregistered)
MsgBox("Brillant")

Re: Fred Blogs' MegaQuit()

2010-04-05 10:47 • by NH (unregistered)
VB (or whatever derivative) and Access is a breeding ground for a whole bunch of WTF:s.

The least that would happen would have been when an upgrade had occurred rendering the code obsolete.

Re: Fred Blogs' MegaQuit()

2010-04-05 11:21 • by Bob (unregistered)
304595 in reply to 304590
I bet it took you 3 months to come up with that answer.

Re: Fred Blogs' MegaQuit()

2010-04-05 11:21 • by justsomedude (unregistered)
304596 in reply to 304590
Paula:
PaulaBlog = MsgBox("Brillant",vbYesNo + vbInformation,"Witty")


FTFY

Re: Fred Blogs' MegaQuit()

2010-04-05 11:22 • by Bob (unregistered)
304597 in reply to 304590
Paula:
MsgBox("Brillant")

Helps if I quote it.

Re: Fred Blogs' MegaQuit()

2010-04-05 11:24 • by @Deprecated (unregistered)
If only my father in law ran a business that I could bilk for piles of money, while getting a monkey to write the code... Then I could sit back and read slashdot all day!

Re: Fred Blogs' MegaQuit()

2010-04-05 11:31 • by DuffMan (unregistered)
Ramses So let it be written so let it be done:
There would then also be an animated GIF of Bart Simpson benind over and mooning the user.

With an error message like "The duff code came back with...", I was thinking more Duff Man than bart...

"Duffman is thrusting in the direction of the error! Oh Yeah!"

Re: Fred Blogs' MegaQuit()

2010-04-05 12:22 • by somedude
this.message = Paula

Re: Fred Blogs' MegaQuit()

2010-04-05 12:24 • by Wyrd (unregistered)
Ok.

I get that FrErr() is wonky looking, and it falsely assumes it can rely on Count to hold its previous value the next time its called. Additionally, I'm not sure why a calling count of five was chosen as the magic number that make it switch to the Else clause.

Also, other people pointed out that HoldIt() acts as a "semi-random infinite loop generator", and even if it were coded properly, it probably shouldn't exist.

But what precisely is wrong with MegaQuit() beyond its goofiness? There's probably something glaringly horribly wrong with it, but I'm not sure what? Where's the wtf? Please assist. See, one day, I might *be* the FredBlogs guy and I'd really rather not be, so I need to understand his folly. TIA

--
Furry cows moo and decompress.

Re: Fred Blogs' MegaQuit()

2010-04-05 12:29 • by Anon (unregistered)
I think it's brilliant that pause pauses not just Fred's database, but also the entire PC by pinning the CPU.

If only he had foreseen multi-core PCs and figured out a way to pin all of the processors. Oh well, a craplet developer can dream....

Re: Fred Blogs' MegaQuit()

2010-04-05 12:36 • by Ross (unregistered)
MegaQuit isn't so bad. Here's two things I can find wrong, but they're not really WTFs.

First, MegaQuit does two things when it should only do one. One is that it closes all forms; the other is that it asks whether it should quit access, and does so if confirmed. These should be two separate functions.

The second thing is related. If you're going to quit, why bother closing forms first? And if you do need to close forms before quitting, shouldn't you get confirmation before you start closing them?

Re: Fred Blogs' MegaQuit()

2010-04-05 12:37 • by Christopher (unregistered)
I'm not at all familiar with VBA... can someone elaborate on what the code does?

Re: Fred Blogs' MegaQuit()

2010-04-05 12:41 • by csm (unregistered)
304605 in reply to 304599
this actually made me laugh out loud. high-larious.

Re: Fred Blogs' MegaQuit()

2010-04-05 12:41 • by csm (unregistered)
304606 in reply to 304599
DuffMan:
Ramses So let it be written so let it be done:
There would then also be an animated GIF of Bart Simpson benind over and mooning the user.

With an error message like "The duff code came back with...", I was thinking more Duff Man than bart...

"Duffman is thrusting in the direction of the error! Oh Yeah!"


ugh...forgot to quote. THIS made me laugh out loud...

Re: Fred Blogs' MegaQuit()

2010-04-05 12:47 • by London Contractor (unregistered)
304607 in reply to 304603
Ross:
MegaQuit isn't so bad. Here's two things I can find wrong, but they're not really WTFs.

First, MegaQuit does two things when it should only do one. One is that it closes all forms; the other is that it asks whether it should quit access, and does so if confirmed. These should be two separate functions.

The second thing is related. If you're going to quit, why bother closing forms first? And if you do need to close forms before quitting, shouldn't you get confirmation before you start closing them?


I think in Access you need to manually close all the forms before you can quit - also they could be bound to the database, so you'd need to save any changes as well.

All the code sucks. Awful.

Re: Fred Blogs' MegaQuit()

2010-04-05 12:49 • by Anon (unregistered)
Anybody writing code like this should be introduced to the MegaFire() function.

Re: Fred Blogs' MegaQuit()

2010-04-05 12:55 • by frits
304609 in reply to 304608
Anon:
Anybody writing code like this should be introduced to the MegaFire() function.


Nah, he's the VP’s son-in-law. He'll probably use this assignment as a stepping stone to the MegaManager object.

Re: Fred Blogs' MegaQuit()

2010-04-05 12:55 • by YourNameHere
304610 in reply to 304603
Ross:
MegaQuit isn't so bad. Here's two things I can find wrong, but they're not really WTFs.

First, MegaQuit does two things when it should only do one. One is that it closes all forms; the other is that it asks whether it should quit access, and does so if confirmed. These should be two separate functions.

The second thing is related. If you're going to quit, why bother closing forms first? And if you do need to close forms before quitting, shouldn't you get confirmation before you start closing them?

It's been a long time (thankfully) since I've done VBA in Access but wouldn't this:

DoCmd.OpenForm "Start_up"

cause the app to reinitialized running all the Form_Load events rather than just not exiting?

Re: Fred Blogs' MegaQuit()

2010-04-05 13:16 • by Hatterson (unregistered)
Actually the HoldIt function seems to do exactly what it implies, both by name and comment aside from the obvious error or infinitely looping whenever it's called with longish > 59-current second

It pauses the application (or freezes it, whichever you prefer). I would also describe it as a Hold as it effectively prevents anything else from happening until it's done.

It's certainly not a sleep function, but who would want a sleep function that has a duration with a granularity of a second anyway?

Clearly this is one of the best ways to make sure nothing else happens in your program until you've made frozen everything up for a while.

Re: Fred Blogs' MegaQuit()

2010-04-05 13:24 • by Sponjk (unregistered)
How, roughly, do you tell "Good" VB from "Bad" VB?

Re: Fred Blogs' MegaQuit()

2010-04-05 13:27 • by ParkinT
If NOT HoldIt() Then PantsWet(true)

Re: Fred Blogs' MegaQuit()

2010-04-05 13:45 • by Rob (unregistered)
Fred must be quite confused. He can't even give himself a type.

Re: Fred Blogs' MegaQuit()

2010-04-05 13:48 • by Mcoder
304615 in reply to 304612
Sponjk:
How, roughly, do you tell "Good" VB from "Bad" VB?


Well, I guess if it is VB, then it is "Bad" VB. But I may be biased from a sample size of little less than a hundred applications, writen by nearly two hundred people (some that also write on other languages) I've seen on my life. Any sample size is too small to prove an absolute...

The funny thing is that some of those people that code on more than one language write good code on the other languages.

Re: Fred Blogs' MegaQuit()

2010-04-05 13:56 • by VictorSierraGolf (unregistered)
304616 in reply to 304612
Sponjk:
How, roughly, do you tell "Good" VB from "Bad" VB?


Uh... WTFs per minute, maybe?

Re: Fred Blogs' MegaQuit()

2010-04-05 14:01 • by S. Palin (unregistered)
304617 in reply to 304577
Now lets not go insulting all those who are mentally challenged. They are much smarter than that error handling.

Patrick:
You have to at least give credit to Fred for trying out some AI in the error handling. Too bad he basically made an artificial retard...

Re: Fred Blogs' MegaQuit()

2010-04-05 14:02 • by rfoxmich (unregistered)
304618 in reply to 304616
WTF/KLOC is the standard measure. Problem is that number is usually >> 1

Re: Fred Blogs' MegaQuit()

2010-04-05 14:12 • by frits
304620 in reply to 304618
rfoxmich:
WTF/KLOC is the standard measure. Problem is that number is usually >> 1


1 WTF per 1000 lines of code isn't bad at all. That's got me beat.

Re: Fred Blogs' MegaQuit()

2010-04-05 14:22 • by Tim E Kaard (unregistered)
304621 in reply to 304612
Sponjk:
How, roughly, do you tell "Good" VB from "Bad" VB?
Easy. "Bad" VB typically uses a random sample of bytes from the ASCII character set. "Good" VB uses only whitespace.

Re: Fred Blogs' MegaQuit()

2010-04-05 14:32 • by Fred Blogs (unregistered)
304622 in reply to 304602
Anon:
I think it's brilliant that pause pauses not just Fred's database, but also the entire PC by pinning the CPU.

If only he had foreseen multi-core PCs and figured out a way to pin all of the processors. Oh well, a craplet developer can dream....

I think it is quite unfair of you guys to pick on my code when all you have is a few excerpts, and only one side of the story.

Let's just say we don't hire the brightest users at my father-in-law's company. He's widely known as a tightwad and won't hire anyone for more than minimum wage. Then he forbids outside food and drink, and puts in his own vending machines with $2.00 sodas and $7.50 sandwiches. So ultimately the only people who will work here are those who can't do any math. Hell, they can barely count. And read? Forgetaboudit.

Hence my challenge. When an error message occurs they just ignore it. So I was asked to make them more amusing. No effect. They skip right by them. Finally, old skinflint himself told me -- not asked -- to lock up their computer after every error so they can't do anything else until they read the frickin screen already goddammit!

Re: Fred Blogs' MegaQuit()

2010-04-05 14:36 • by Hexadecima (unregistered)
304623 in reply to 304582
BBT:
So, for HoldIt...
If you call it in the 59th second of the minute, it's guaranteed to infinitely loop. If you call it with "longish" >= 59, it is guaranteed to infinitely loop. If you call it with "longish" greater than or equal to 59 minus the current second, it will infinitely loop.

That's one brillant function.


ACTUALLY, HoldIt() would only loop for a minute, not infinitely. Seriously you guys. Seriously.
« PrevPage 1 | Page 2Next »

Add Comment