- 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
TRWTF is trying to optimize code when you can just buy more RAM.
Admin
This reminds me of the time I discovered that you could put Javascript in an ASP page and have it run in a browser - It seems so stupid now, but at the time I thought I was some kind of programming demi-god...
Admin
Admin
I wonder whether it is sadistic or masochistic. Maybe both. (my capcha is 'odio' - es la propia palabra)
Admin
"Power troll" my arse....
(not an imperative)
Admin
But I don't want to "Power Troll" your arse . . .
Admin
Surely it's simply mans type checking. As opposed to type checking done by a machine.
Admin
That's a lot less dumb than you meant it to be.
Admin
Like I said, not an imperative
Admin
Admin
Admin
TRWTF is that ASP was a joke from MS, but people don't get it and started making pages with this shit.
How was that funny, Bill?? HOW???
Admin
I'm almost surprised to see that they did not try using this method for generating CSS as well.
Admin
Which is not to say that they didn't, merely that we haven't seen it. In fact, I'd be most surprised to find that they hadn't.
Admin
Which was your initial point, naturally. Silly me
Admin
But the idea of moving parts of the app into something less rigid than code - config, a DB - isn't stupid, or new.
Admin
Older versions of VBScript didn't, ASP did.
Admin
Admin
Admin
It's also called 'being nice to your colleagues' like leaving little visual cues for their 'developer subconscious' as to what that variable buried within several lines of code might hold.
But hey, why even try to make live a little easier?
(here come the "if people can't do a simple thing like check the type then they shouldn't be programming" BS comments sighs)
Admin
Clearly not. If someone's stupid, it's the users. Putting all that wrong data in the wrong places... Good thing about DB logs, we can trace every error they make even weeks after they do. That way, no need for no stinkin' debugger.
Admin
I could be wrong here, but if you simply do not response write that second function to include the IsNumeric() function, would it not immediatly throw an error if you did include the first function?
Seeing as how Function1 uses Function2 in its code, failure to include the 2nd function in your header would immediatly result in an syntax error?
Perhaps I am reading the TDWTF wrong here...
Admin
I don't know VB, so I don't understand this post. I'm not going to contaminate my mind trying to understand it, either.
Admin
I think you're right. So what they need is some kind of dependency injection system to make sure that someone doesn't include e.g. CheckDateFunction without IsNumeric. Here's one possibility:
Then you can just change the code for the client side to:
and it will automatically pull in the IsNumeric function as well. Thus you only need to include those functions that you actually use in the client side code rather than tracking down the dependencies for each of the functions that you need.
Admin
Admin
Laugh out loud funny, yes... But I wasn't joking...
I dumped VBScript several years before I dumped classic ASP...
Admin
I'm pretty sure I'm going to strangle somebody if their's not a new article soon.
Admin
There is an entire section of the application I'm currently working on that has the C# equivalent. 6 forms and a dozen modules combining to a few thousand lines just loaded with javascript generated from code behind. A couple of years ago, we took one look at it to make a few upgrades, and chucked the entire thing.
And then there's our in-house datagrid used on most of our 100+ screens. That's always fun to maintain....
Admin
The catch, of course, is that you just know that the next programmer to work on it is going to write
And now your Hungarian is lying to you.
Admin
Admin
Admin
Admin
I'm pretty sure you'd go to jail for that. Yew're knot sew smart, is u?
Admin
It might even get rid of some of your tension.
Admin
The reason I've been told is that it was 2000, .NET wasn't even at version 1 yet and nobody had made third party apps for it yet.
Admin
Admin
I'm glad you changed "your" to "the" penguin...
Admin
It doesn't even take the next programmer to produce a lying Magyar.
Admin
All words are made up.
The difference is some of us make up our own words and some of us rely on the corpus of words made up by our forebears.
Admin
Alex, please submit a new WTF before we are consumed by posts such as these...
captcha: duis -> and duis quickly!
Admin
He's right and your wrong. All words are made up, and you shouldn't be hanging out here all day waiting for a WTF.
Oh, and posting CAPTCHAs is stupid.
Admin
Thanks for your opinion, however this was the second time I checked all day, and what you think about posting captchas is meaningless to me and everyone else.
By the way: your != you are... Dumbass...
Admin
TRRWTF is you thinking that the problem with this code is the extra 10K memory it's going to end up using
Admin
see subject (bad brain day)
Admin
Admin
Admin
The only WTF about this is the absurd way to include the javascript; downloading one large blob of compact js file is better than downloading several js files which is better than inlining it.
But apart from being (probably needlessly homemade) and verbose, the javascript does seem to work as it should. The leap year calculation is correct. It might be very permissive in what it accepts but it does return an empty string if the date is illegal and a consistently formatted date for valid dates. Actually a homebrewed date checker that returns "29 May 2010" for the input "29 mayonayse 10", "20" is actually impressive!
I'm not trying to troll, but this code (while implemented very stupidly) is not actually wrong.
Admin
Admin
Admin
Python is pretty awesome because it includes the best of both worlds. It is a dynamic language, but also strongly typed. There is no such thing as a 'cast' in Python. An int is always an int. After using Python, coding in a dynamic language with implicit/automatic casting like PHP or Javascript is like a slap in the face. I've spent much time debugging a problem only to find out it was an incorrect type being automatically casted, where Python would have thrown an exception instead.
I really wish Javascript had a strongly-typed variant. Dynamic, strongly-typed, closures, prototype inheritance == perfect language for me.