| « Prev | Page 1 | Next » |
|
AHH! I'm blind! Let me start by asking: why is each of those scalar variables taking an array slice as a value? Actually, I think I'll end with that too. I keep scrolling up out of fascination, but I'm afraid if I do it again I'll be scarred for life. |
|
Finally, hard evidence that you can be at two different places (states) at one time.
|
|
I ...............can't...................see.......................why
|
|
I don't see any WTF here.
The data from the states array/scalar was probably unreliable, and the only way to ensure absolutely that the correct states were printed out was to type them in by hand for each option box. |
|
Shouldn't all the
be $statename = $data[n]; [^o)] |
Re: Now *That* is a Way to do States
2005-01-31 12:35
•
by
KoFFiE
|
I think it's a tcl application, and as far as I remember, arrays are indicated with an @... |
|
It looks like a lame attempt at Perl to me, but I don't know what tcl
looks like. In Perl, arrays are referred to with @ prefix, but only for the entire array. Element references use the $ (scalar) prefix. |
This is perl and the person who wrote it used @data[0] instead of $data[0]. It only throws a warning, but still runs. And, no, the application did NOT have a database behind it. --Kurt |
Yes, you're right. This code happens to work in this situation, but it is wrong. The former is a an array slice of length 1, the latter is an array element. Arrays provide a list context, and elements provide a scalar context. Since Perl is context sensitive, you can get different results depending on which context you provide. This is explained in the Perl FAQ, part 4, section Arrays. |
|
How do people get away with writing crap like this? I'm beginning to believe I've met trained cockroaches that can code better than some of these examples. Of course, I've seen my fair share of "programmers" like this in the real world, somehow they retain their jobs, while the ones that actually wrote decent code get laid off. Maybe it's PHB syndrome... Maybe it's the high corporate execs looking at the staff list going.. "This one is making 54% more than his peers, he needs to go. Send him the axe" ... |
|
FWIW, this looks very little like Tcl. You can tell Tcl code because it looks like this:
set var "value" for { set i 1 } { i < 100 } { incr i } { puts "i = $i" } Also, Tcl's syntax is extremely basic which makes it so that you can't format brackets the way you want to; for example, you can't say for { set i 1 } { i < 100 } { incr i } { puts "i = $i" } because that would make the puts block evaluate separately from the for command. (And not surrounding it by brackets would be right out!) Basically, in a for loop, if statement, etc., the subordinate pieces of code are passed in as parameters to the for/if/etc. functions. It's a fascinating language from the design and theory standpoint (it's basically LISP with variable side-effects and a sequence operator, and writing a Tcl parser/interpreter is extremely simple), though not very useful for real-world apps programming. Personally, I only use Tcl when I need to write a quick script which does more numerical processing than is convenient in bash. But this is all besides the point. My eyeballs nearly exploded when I looked at today's WTF. I seriously hope that whatever "programmer" wrote that used copy-paste. |
|
I just love how people try to jump in and justify code, no matter how bad it is. You can't justify this one folks, the code is just plain stupid. |
|
My fingers fall off just from looking at it.
Man, am I glad that Austria only has 9 counties. |
|
Argh! What about Puerto Rico? What about Guam or American
Samoa? What about (horrors) an actual foreign country? |
|
What aggravates me is that I have spent most of my career fixing shtuff like this while the knuckle-head that wrote it is creating new shtuff for me to fix.
|
|
So is this code at least used in situations where you don't want all of
the states? Please say that there is at least some point to this code. |
|
WTF? Why does a blog software search smileys inside of <PRE>-Tags?
|
Yes. This code was used to generate forms for a website and each form had different states that it applied for. For example, the website may sell a product, but only to particular states. For another website, run by the same software, they may sell a product to a different set of states. Because of the nature of the beast (US laws and regulations pertaining to the product / services these websites offer), these sites would never do business outside of the 50 states or Washington D.C. So it doesn't have to account for any territories / protectorates / foreign countries / etc. --Kurt |
|
|
|
the redundancy ... hurts me poor brain. Clueless perl, wrong on so many levels that I don't want to even start.
I'm part of the company interview process, and we get perl fragments every now and then from potential employees. You can guess what sort of stuff I have to wade. This, is however, even worse than the typical stuff.[*-)] |
|
The true WTF is reading the posts from people saying "This code isn't that bad..."
|
|
Wow! You have to be a special kind of stupid to write something like that. Skip. |
|
I don't see any wtf here. It's beautiful clean code, and much similiar to the
code i usually write. Futhermore it's easy to understand and does excatly what it should. |
|
When you have a loop with a known number of iterations, it's faster to
expand it, since you don't have to do the checking for the loop condition each time (this is called "loop unrolling"). So this is much more efficient. |
|
So tell me, what is the limit of loop unrolls? When will you stop unrolling loops? At 100? At 1000?
|
|
I'm getting RSI (or whatever it is called these days) just by looking at this code. My pooooooor hands [:(] Drak |
|
Usually the compiler in use decides when to do loop optimizations. Size vs speed is one factor which needs to be considered... But there are two special cases:
|
No! No no no no no no no! Now crawl back under the rock before I smack you! Code like this is simply too horrible to be justified in any way. Leave loop-unrolling to the compiler. |
|
yes, in this case loop-unrolling truely is irrelevant.
(but it should not allways be left to the compiler (unless the compiler has a way to specify which loops should be unrolled) - on critical algorithms or old computers loop unrolling will roxX0rz.) |
|
Well at least there in alphabetical order, you've got to give the guy credit for that. I'd love to see the code from this guy when he is capturing someones title though! |
That was a joke, right? Please? |
|
Are you guys hiring? [:)]
|
|
Did the author of this code work for Anderson/Accenture consulting? I've only seen perl that bad in one place... and it was written by someone from Accenture. Ok, so the company that the app is written for can only sell in the 50 states... what if texas is divided into it's 5 proposed states? |
|
Hey everybody! I'm here to justify this code! Here goes...wait a sec...WHAT WAS I THINKING?!? [:$] |
|
I think we're all missing the point here. The guy who wrote this code is probably making 120K/yr. at some Fortune 500 company. Management probably hangs on his ever word and suggestion. And he continues writing the same sort of code... Dude, that hurts. |
Nah, it was either my boss or another developer who doesn't work here anymore. It wasn't a highly paid consultant, it was someone who was a great programmer -- of DOS apps -- and who shouldn't be writing perl. --Kurt |
No No No, If its all right with you guys Stateside, please keep such programmers, and the systems they spawn to yourself..... |
|
I don't know what you guys are talking about. This is the first time I've ever actually been able to read Perl.
|
|
I'd hate to see you architect a large building, much less a dynamic Web site.
|
|
Yeah, exactly. It's clean and elegant code.
You people are probably just jelus because you cant write so beutiful code. |
|
And you're probably just jelious for your beautiful spelling mistakes. But never mind.[8-|] |
Brace yourself, Romania actually has 42 (count'em) counties. And I've seen just this kind of crap in a FoxPro application, which, actually and by definition, *was* backed by a database (however primitive). The guy who wrote it seemed overly concerned about fitting the county-related code in a single file. Maybe it's the same thing here. As for Perl, when I first tried it and decided it was too much for my poor little human brain, I just gave up on in and went for PHP. WTF, is that such a hard thing to do? |
|
I do hope whoever wrote that was doing their first day on the job.
|
Re: Now *That* is a Way to do States
2008-04-09 13:42
•
by
M4
(unregistered)
|
I do hope whoever wrote that was doing their LAST day on the job. |
Re: Now *That* is a Way to do States
2009-09-14 05:20
•
by
Anthony Gatlin
(unregistered)
|
|
As untalented as this developer is, there are organizations where he could still be their best. Note to developer: The State of Texas is hiring.
|
|
I'm no native of the USA, but do I count 51 states? (Indices 4 through 54.)
|
Re: Now *That* is a Way to do States
2012-03-22 16:38
•
by
tharpa
|
The District of Columbia is not a state, but it is considered as a state for many purposes. (Writing this from DC.) |
| « Prev | Page 1 | Next » |