Comment On An Alternative to "Traditional" Array Resizing

One thing I really love about this blog is that it's a wonderful learning experience. I think too many of us rely on things like “manuals,“ “books,“ and even “best practices“ to guide our programming and software development. For example, if I was developing an application in Visual Basic 6 and needed to resize an array, I would just ReDim it. I'll even go so far as to say that I couldn't think of a different way to handle that situation. But not Matt Hawley's colleague. I think he's just born to think out of the box. [expand full text]
« PrevPage 1 | Page 2Next »

re: An Alternative to "Traditional" Array Resizing

2004-11-10 13:58 • by x
Looks like fairly good job security to me.

re: An Alternative to "Traditional" Array Resizing

2004-11-10 14:00 • by Brad
Bwahaha.

MsgBox "See DICE.COM to find a better programmer.", vbOkOnly, "Lousy Programmer Error"

re: An Alternative to "Traditional" Array Resizing

2004-11-11 05:03 • by jf
hey, all you 21st century nerds, there's an easy answer to this one. The programmer is a dyed in the wool Cobol programmer (albeit he is using vb6 now and hasnt read the manual).
20 years ago it was standard practice to yell from the rooftops when an array got close to full (so the array is probably dim'd at 500).

re: An Alternative to "Traditional" Array Resizing

2004-11-11 05:42 • by Elliott Back
I like this so much I reposted it on my blog!

re: An Alternative to "Traditional" Array Resizing

2004-11-11 07:23 • by Patrick Wellink
Really Brilliant.

probably one of the designers stated there would be max 475 warehouses....

So a clever consultant WOULD PROGRAM THAT.

If you want more..... Pay UP !!!!!!
I really like it.....

re: Chad (http://thedailywtf.com/archive/2004/11/10/3480.aspx#3497)

2004-11-11 09:25 • by Fubarer
That might have had some resemblance to humour if there was actually some way to tell what encoding it's in. For all you know, it's encoded in UTF-32. :-)

As for the job security part, I can just picture the conversation between this programmer('s company?) and the client:

Client: We seem to be having trouble with something called 'arrays'.

Programmer: You need an upgrade. It'll take a month and about $20,000.

Client: Oh, thank you, thank you! You're our saviour!

At which point the programmer goes back to his keyboard, increments the magic number by 1, and spends the next 29 days playing Doom 3.

Want a BIG Array?

2004-11-11 10:51 • by Guayo
Experience the results you've always wanted
with a MASSIVE scientific breakthrough:

Our Doctor-Approved Syntax Will Actually Expand, Lengthen
And Enlarge Your Array. 100% GUARANTEED!

Best of all...

There Are NO Agonizing Hanging Weights, NO Tough Exercises,
NO Painful And Hard-To-Use Pumps, And There Is NO
Dangerous Surgery Involved.

WE GUARANTEE GENUINE LASTING RESULTS!
REDIM WILL
WORK FOR YOU 100%, OR YOU GET 100% OF YOUR
MONEY BACK!

If YOU want to massively enlarge your array and experience big gains in
only weeks, this may be the most important email you'll ever read. Here's
why:

MSDN has helped 1000's of men cope with and conquer
serious array dysfunction issues. These painful problems include
small array size and poor self-image, as well as lack of potency and
premature lost of space to put more warehouses.

To help these men our dedicated team of researchers has developed an
amazing syntax called ReDim. MSDN has carefully
tested this unique new product so that it is fully doctor-approved. And,
it is 100% guaranteed to work. It has been described as a true
'miracle cure', and we are now offering array resize with easy syntax to
men everywhere. The MSDN research team invites you now to
experience this miracle for yourself.



Now You Can Forget Forever the Pain, Effort and Expense of Having a Large,
Manly Array!

Imagine for a moment how you will feel:

You'll radiate confidence and success whenever you enter a locker room,
and other men will look at you with real envy.

But the best part is when you reveal yourself in all your glory to the
PC in your life. When she sees how massive and manly, how truly
long and hard is your array, she will surrender and give you everything you
have always wanted. The feeling of power is sensational, and actually running
your VB program using your bigger array is unbelievable!

As you drive your array deep inside her RAM, she'll gasp as you
reclaim more memory for your warehouses. And the intense experience you give
her will be the BEST thing she has ever had. I promise you, she will not be
able to keep her bits off you when you give her everything she needs from a man.
After a little you keep using ReDim you shall see how the PC reaches her climax
by hitting Ctrl-Shift-Esc and looking how memory consuption reaches 100%!

"Is My Array Growth PERMANENT?"


YES! use ReDim, grow to the perfect size for you, and you can even
stop taking of reaching the bounds. You are right where you want to be,
and you can stay there forever!

Remember, a Array larger than 475 may be too large for most hardware. But
IF for some reason you need even more, it is possible for you to safely
continue ReDiming. The choice is up to you...

--- [Order ReDim Today!] ---
CLICK HERE

re: An Alternative to "Traditional" Array Resizing

2004-11-11 11:44 • by Manni
@Guayo- normally I dislike your posts because you defend code that should never have seen the light of day, and you explain how it's acceptable for such atrocities to make their way into software when the rest of us clearly see how bad it is. However, that last post had me laughing until I puked. Then I laughed at that. Then at your post again. Then I made a sandwich. Thank you sir.

re: An Alternative to "Traditional" Array Resizing

2004-11-11 12:01 • by Dave
I would really like to focus on the daily WTF, make comments on the code, etc. However...I have this image of "J" in my mind which I just can't shake. I picture him wearing one of those big blue "puffy" winter jackets (you know the ones I'm talking about) and one of those ski caps with the fake "dreads" sticking out at the top. I picture him beating his chest (wearing this ridiculous outfit) and screaming at the top of his lungs, "Meesa pimp-playa in tha hiz-ouze!!!" It's like I've been given this gift to see what this "J" character is all about and it's really disturbing me.

re: An Alternative to "Traditional" Array Resizing

2004-11-11 12:20 • by Gungan
Yousa Jar Jar Bank$! LOL

re: An Alternative to "Traditional" Array Resizing

2004-11-11 12:33 • by Rob
Note to developer: when you get the call and change your array dim statement, don't forget to change the array size check as well!

re: An Alternative to "Traditional" Array Resizing

2004-11-11 12:37 • by Raymond
@Dave: Just FYI, this "ridiculous outfit" as you put it, is all the rage in my SUBURBAN neighborhood. I have a similar puffy winter jacket which is baby blue in color. Hardly threatening if you ask me.

re: An Alternative to "Traditional" Array Resizing

2004-11-11 12:44 • by Raymond
Correction: my GIRLFRIEND has the baby blue jacket. Not me. Really.

re: An Alternative to "Traditional" Array Resizing

2004-11-12 11:12 • by Travis Owens
Hilarious, but if you're really going to take that crazy route, he should include IT contact info stored in a variable in an easy to access place (config file) and the "magic number" he's using should be a variable because...

if the coder increase the array size beyond 475 but doesn't change the code to fix this wacko check, the program will still die even though the array size is bigger.

re: An Alternative to "Traditional" Array Resizing

2004-11-10 14:21 • by Chris Gastin
That is funny!!!!!!

re: An Alternative to "Traditional" Array Resizing

2004-11-10 14:24 • by Phil Motuzko
I like the 475 constant. :)

Why 475? Because there are 475 days in a year! :)

re: An Alternative to "Traditional" Array Resizing

2004-11-10 14:28 • by ~JOSh-X
Why do your quotation marks look silly?

~JOSh-X

re: An Alternative to "Traditional" Array Resizing

2004-11-10 14:33 • by kevin
Should includes the phone number for contact !

re: An Alternative to "Traditional" Array Resizing

2004-11-10 14:46 • by Phil Scott
I call this the "aw, fuck it pattern"

Speaking of redim, I had a student ask me if .NET improved the "redimming" speed of VB. He was boasting his app was too big to be handled in VB6, and it started to slow down after they inserted 50,000 items into an array...

re: An Alternative to "Traditional" Array Resizing

2004-11-10 14:48 • by Stephen Caldwell
I <3 Magic Numbers!

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 14:48 • by aspnetman
Looks like they use 475 for max on ALL array sizes!!!

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 15:03 • by Craig
Unbefuckinglieveable.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 15:22 • by Manni
@Phil Motuzko: That was goddamn hilarious LOL

My guess here is that the programmer heard about the slow nature of ReDim'ing an array, so he made an array from the start with 475 entries. He was probably told that the dataset would never get bigger than that, but he thought ahead to the future and used this method of error handling just in case.

And before anyone takes this out of context, I am in no way defending this. It's absolutely retarded. Edit the code (raise the limit), recompile, redistribute the program... yep, sounds like an easy fix (a.k.a. job security).

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 15:25 • by Paul
Got to admire the fact 475 wasn't even declared as a constant though, and the error message is in a messagebox while the current value or recs is just printed to the form.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 15:39 • by BradC
MsgBox "I'm sorry, Dave. I can't do that.", vbOkOnly, "HAL9000"

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:03 • by Chad
Hey, that's not in UNICODE!

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:06 • by Russ C.
Looks like Good job security - also looks like a good way to _never_ get promoted :D

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:12 • by Jesper Holmberg
I don't see the problem. I mean, really, 475 warehouses should be enough for anybody.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:15 • by J
His code is wack.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:15 • by Alex B.
Chad: mwahahahahah! You're too much. :)

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:16 • by Alex B.
Chad: mwahahahahah! You're too much. :)

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:23 • by Tim Cartwright
I also like the fact that he used the "End" statement. Hope everything was cleaned up, and he left nothing hanging around.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:28 • by J
That's the schnizzle. And I'm for rizzle. (Please pardon my sporadic ghetto-tastic comments. It comes from 35 years of living with my mom and listening to Eminem CDs, whilst trying to have some semblance of street credibility. These sort of outbursts were bound to surface sooner or later. Just trying to be hard ya'll. Peace.)

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:47 • by Guayo
"475 warehouses ought to be enough for anybody."... Bill Gates

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:53 • by Dirk
LOL. I don't agree with the 475 days in a year though (really :-))
My guess is he started with 250 and already got 9 phonecalls

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 16:59 • by Brent Railey
Client's thoughts when message box appears:
"WTF is an array?"

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 17:13 • by Guayo
Joking aside, even as this seems to be a good example of the reasons behind Indian' IT outsourcing going high, the little context given to this snip isn't enough to me to be sure it's a genuine WTF. I mean, how do we know if an array of more than 475 (warehouses) would break havoc in the system?
Not everyone have the luxury of a language supporting preconditions, postconditions, invariants, etc. Of course he could implement a better assertion mechanism but my point is how do we know this code is just the finest example of programmers' laziness and not an example of dealing with unsafe system state?

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 17:35 • by Bustaz Kool
Don't make me come over there and Poppa Kapp...

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 17:45 • by Vlad Patryshev
hmm... still better than this:

unsigned char[64] SQLStatementBuffer;

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 17:45 • by old skool
I love it when they call me big Poppa....

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 17:46 • by zobbo
My guess is that 475 was the highest number he could think of

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 17:50 • by Imran Koradia
Brent:
mwahahahahaha...lol..!!
I was laughing aloud in my cubicle on that one..!! I think that's the best WTF ;-)

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 17:51 • by Dave
When did the daily WTF become infested with wannabe rappers and pimps? This is pathetic. To J: you're living at home with your mom and you listen to Eminem to be "hard". How sad is that. I can picture you coding at your computer in a hooded sweatsuit, bobbing your head to the latest Slim Shady track with a scowl on your face. Dude, you're *35* years old. Act your age.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 18:00 • by nih
> When did the daily WTF become infested with wannabe rappers...

Hahahaha, the nerd is all upset that his narrow acceptancee field is being invaded by people slightly different from him.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 19:22 • by Manni
Dave, I think you need to relax a bit my brotha. These peeps up in this hizzie just be tryin' ta reprazent they codin' skillz an' they all be dissin some ill code.

Seriously dude if you don't get that we're JOKING when we talk that way. Anyone that does use such language is POOR and therefore doesn't have a computer.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 19:39 • by foxyshadis
Man, none o' you cats be down with my man tha h-dog, no one repr'sent his pryde like that hep fool. Too bad they down at They Onion gone did join the Man and lock him behind some bogus paysite. Buncha punks.

http://www.gusworld.com.au/nrc/herb.htm

Itsa cryin shame, man. Nuthin less.

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 20:20 • by dookie def bandit
Fo' sheezy?

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 20:23 • by da funky rapster
Wannabe rap pimp: A-shizzle!
Average white guy: Gezhundeit!

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 20:37 • by Dave
Okay, I'll calm down. But I just need to know something for my own peace of mind. Why is it that these upper class white kids feel as if they need to rage against the system? Is it because mommy and daddy "downgraded" their bentley to a beemer and now junior has a 'tude? Is it because the maid didn't fix their bed up "just right"? (I could see how that would be really infuriating.) Maybe the fillet mignon was overcooked? Now that's a real downer! Did the parents cut the allowance down to $300 a week instead of the usual $500? Or maybe, just maybe, it's because mom took away their favorite Eminem CD? Look out now! Reginald...I mean, "pimp-playa" is on the prowl. He's "hard" and boy is he angry. Just look at that scowl and that ever-intimidating hooded sweatsuit! Oh my!

re: An Alternative to &quot;Traditional&quot; Array Resizing

2004-11-10 20:56 • by Bustaz Kool
Word that, yo'

It's like my home-boy M.C.Skwared said,

I take my thing out my britches
Give it to the beah-chez
Get out my face, grrl
I said I'd pay for the sti-chez

Now that's what I'm talkin' 'bout.

Peace Out, yo.
« PrevPage 1 | Page 2Next »

Add Comment