• (cs)

    TRWTF is trying to optimize code when you can just buy more RAM.

  • Duane (unregistered)

    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...

  • Sylver (unregistered) in reply to Power Troll
    Power Troll:
    I can't decide? TRWTF is ASP, or TRWTF is JavaScript?
    When in doubt, TRWTF is you.
  • Vlad Patryshev (unregistered)

    I wonder whether it is sadistic or masochistic. Maybe both. (my capcha is 'odio' - es la propia palabra)

  • Detritus (unregistered) in reply to Power Troll
    Power Troll:
    I can't decide? TRWTF is ASP, or TRWTF is JavaScript?

    "Power troll" my arse....

    (not an imperative)

  • Dr Unicorn (unregistered) in reply to Detritus

    But I don't want to "Power Troll" your arse . . .

  • Detritus (unregistered) in reply to Cunning Linguist
    Cunning Linguist:
    Kempeth:
    2: The whole point of Hungarian Notation was to add information on what a variable is supposed to contain when the type system cannot tell you. Which makes Javascript one of the best possible candidates for it.

    Close, but not quite. Hungarian Notation is poor man's type checking.

    Surely it's simply mans type checking. As opposed to type checking done by a machine.

  • Detritus (unregistered) in reply to James
    James:
    Why stop there? How about we replace every single piece of business logic with SQL statements in the database. Then you'd never have to build and deploy again. Just update the database.

    That's a lot less dumb than you meant it to be.

  • Detritus (unregistered) in reply to Dr Unicorn
    Dr Unicorn:
    But I don't want to "Power Troll" your arse . . .

    Like I said, not an imperative

  • itsmo (unregistered) in reply to TW
    TW:
    Wonk:
    Anonymous:
    Bob Holness:
    ASP, for all its antededents could do some OK stuff in a nicely controlled monoculture.
    You almost sounded smart for a minute, right up until you started making up words.

    Don't misunderestimate him, now.

    Oops, my bad.

    Can't you people recognize a simple typomological error when you see one?

    FTFY

  • (cs) in reply to Detritus
    Detritus:
    James:
    Why stop there? How about we replace every single piece of business logic with SQL statements in the database. Then you'd never have to build and deploy again. Just update the database.

    That's a lot less dumb than you meant it to be.

    Seriously! If that were easy and powerful enough, I wouldn't need to build business classes.

  • Kyle Z. (unregistered)

    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???

  • Anon Too (unregistered)

    I'm almost surprised to see that they did not try using this method for generating CSS as well.

  • Detritus (unregistered) in reply to Anon Too
    Anon Too:
    I'm almost surprised to see that they did not try using this method for generating CSS as well.

    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.

  • Detritus (unregistered) in reply to Detritus
    Detritus:
    Anon Too:
    I'm almost surprised to see that they did not try using this method for generating CSS as well.

    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.

    Which was your initial point, naturally. Silly me

  • Detritus (unregistered) in reply to hoodaticus
    hoodaticus:
    Detritus:
    James:
    Why stop there? How about we replace every single piece of business logic with SQL statements in the database. Then you'd never have to build and deploy again. Just update the database.

    That's a lot less dumb than you meant it to be.

    Seriously! If that were easy and powerful enough, I wouldn't need to build business classes.

    But the idea of moving parts of the app into something less rigid than code - config, a DB - isn't stupid, or new.

  • γαμμα (unregistered) in reply to Adam
    Adam:
    So does vbscript and asp not support some sort of include function?

    Older versions of VBScript didn't, ASP did.

  • γαμμα (unregistered) in reply to RootKid
    RootKid:
    Anonymous:
    Bob Holness:
    ASP, for all its antededents could do some OK stuff in a nicely controlled monoculture.
    You almost sounded smart for a minute, right up until you started making up words.
    So it took you a full minute to read the four words: "ASP, for all its"?
    Burn!
  • Burgers Anyone? (unregistered) in reply to γαμμα
    γαμμα:
    RootKid:
    Anonymous:
    Bob Holness:
    ASP, for all its antededents could do some OK stuff in a nicely controlled monoculture.
    You almost sounded smart for a minute, right up until you started making up words.
    So it took you a full minute to read the four words: "ASP, for all its"?
    Burn!
    Maybe in the eyes of an ASPie.
  • Bald Rick (unregistered) in reply to Detritus
    Detritus:
    Cunning Linguist:
    Kempeth:
    2: The whole point of Hungarian Notation was to add information on what a variable is supposed to contain when the type system cannot tell you. Which makes Javascript one of the best possible candidates for it.

    Close, but not quite. Hungarian Notation is poor man's type checking.

    Surely it's simply mans type checking. As opposed to type checking done by a machine.

    What he said.

    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)

  • (cs) in reply to Detritus
    Detritus:
    hoodaticus:
    Detritus:
    James:
    Why stop there? How about we replace every single piece of business logic with SQL statements in the database. Then you'd never have to build and deploy again. Just update the database.

    That's a lot less dumb than you meant it to be.

    Seriously! If that were easy and powerful enough, I wouldn't need to build business classes.

    But the idea of moving parts of the app into something less rigid than code - config, a DB - isn't stupid, or new.

    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.

  • JayMiller (unregistered)

    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...

  • genitus (unregistered)

    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.

  • airdrik (unregistered) in reply to JayMiller
    JayMiller:
    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...

    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:

    
    <% 
    '''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' client_functions.asp
    '''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    Function CheckDateFunction()
    ' Returns the HTML/Javascript required to produce the CheckDate() function.
     Dim strHTML
     strHTML = IsNumericFunction
     strHTML = strHTML & "function CheckDate(strDate, strCentury)" & vbCrLf
     strHTML = strHTML & "{" & vbCrLf
     strHTML = strHTML & "  var strToday = new Date(); " & vbCrLf
     strHTML = strHTML & "  var strDay = '';" & vbCrLf
     strHTML = strHTML & "  var strMonth = '';" & vbCrLf
    ...
    

    Then you can just change the code for the client side to:

    ...
    <script language="JavaScript"><!--
    
      // Get date checking functions
      <% = CheckDateFunction %>
    
    //-->
    </script>
    

    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.

  • (cs) in reply to Detritus
    Detritus:
    hoodaticus:
    Detritus:
    James:
    Why stop there? How about we replace every single piece of business logic with SQL statements in the database. Then you'd never have to build and deploy again. Just update the database.

    That's a lot less dumb than you meant it to be.

    Seriously! If that were easy and powerful enough, I wouldn't need to build business classes.

    But the idea of moving parts of the app into something less rigid than code - config, a DB - isn't stupid, or new.

    See, I wasn't actually sarcastic there. If I could build complex data and interaction models in the database, I wouldn't have to write business classes. That would save me time, time I would use merging every fugly UI we have into a sexy OOB Silverlight app.

  • shane (unregistered) in reply to hoodaticus
    hoodaticus:
    shane:
    VBScript? Bah. Real men used javascript for their server side ASP code...
    LOL!

    Laugh out loud funny, yes... But I wasn't joking...

    I dumped VBScript several years before I dumped classic ASP...

  • boog (unregistered)

    I'm pretty sure I'm going to strangle somebody if their's not a new article soon.

  • forgottenlord (unregistered)

    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....

  • Jay (unregistered) in reply to Lamentations
    Lamentations:
    Well, if you ask me, a language that doesn't have types (which is incorrect, btw) is a perfect candidate for Hungarian Notation. That would be my standard workaround for a language that that does not implicily state how a variable is supposed to be used. ...

    The catch, of course, is that you just know that the next programmer to work on it is going to write

    intYear="Monday";
    

    And now your Hungarian is lying to you.

  • Anon (unregistered) in reply to boog
    boog:
    I'm pretty sure I'm going to strangle somebody if their's not a new article soon.
    No your not, your going to let that temper of you'res calm down a bit. Their they're fake boog, think soothing thoughts.
  • (cs) in reply to Jay
    Jay:
    Lamentations:
    Well, if you ask me, a language that doesn't have types (which is incorrect, btw) is a perfect candidate for Hungarian Notation. That would be my standard workaround for a language that that does not implicily state how a variable is supposed to be used. ...

    The catch, of course, is that you just know that the next programmer to work on it is going to write

    intYear="Monday";
    

    And now your Hungarian is lying to you.

    It gets even nastier when you do an upgrade from, say, 16 to 32 bit but for API reasons you are stuck with the same parameter names you had before. Like w (WORD) as a prefix for a 32-bit parameter.

  • (cs) in reply to forgottenlord
    forgottenlord:
    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....

    Please tell me there was a reason to roll your own grid.

  • frist (unregistered) in reply to boog
    boog:
    I'm pretty sure I'm going to strangle somebody if their's not a new article soon.

    I'm pretty sure you'd go to jail for that. Yew're knot sew smart, is u?

  • (cs) in reply to boog
    boog (evil):
    I'm pretty sure I'm going to strangle somebody if their's not a new article soon.
    Calm down, my cantankerous counterfeit. You don't need an article; you can strangle the penguin without one.

    It might even get rid of some of your tension.

  • forgottenlord (unregistered) in reply to hoodaticus
    hoodaticus:
    forgottenlord:
    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....

    Please tell me there was a reason to roll your own grid.

    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.

  • boog (unregistered) in reply to boog
    boog:
    I'm pretty sure I'm going to strangle somebody if their's not a new article soon.
    I have strangled the penguin...prey I don't strangle anything else.
  • NOT the original, ORIGINAL by (unregistered) in reply to boog
    boog:
    boog:
    I'm pretty sure I'm going to strangle somebody if their's not a new article soon.
    I have strangled the penguin...prey I don't strangle anything else.

    I'm glad you changed "your" to "the" penguin...

  • Gary (unregistered) in reply to Jay
    Jay:
    Lamentations:
    Well, if you ask me, a language that doesn't have types (which is incorrect, btw) is a perfect candidate for Hungarian Notation. That would be my standard workaround for a language that that does not implicily state how a variable is supposed to be used. ...

    The catch, of course, is that you just know that the next programmer to work on it is going to write

    intYear="Monday";
    

    And now your Hungarian is lying to you.

    It doesn't even take the next programmer to produce a lying Magyar.

    var intEger = 10;
    var strIng="0,1,2,3,4,5,6,7";
    var arrRay = strIng.split(",");
    for (var i=0;i<arrRay.length;i++) {
       intEger+=arrRay[i];
    }
    
    alert(intEger);
    alert(intEger/100);
    </pre>
    

    Integer = "1001234567" Integer/100 = 10012345.67 Ugh.

    We need a new WTF already.

  • Neologist (unregistered) in reply to Anonymous

    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.

  • NOT the original, ORIGINAL by (unregistered) in reply to Neologist
    Neologist:
    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.

    Alex, please submit a new WTF before we are consumed by posts such as these...

    captcha: duis -> and duis quickly!

  • Fats Geronimo (unregistered) in reply to NOT the original, ORIGINAL by
    NOT the original:
    Neologist:
    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.

    Alex, please submit a new WTF before we are consumed by posts such as these...

    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.

  • NOT the original, ORIGINAL by (unregistered) in reply to Fats Geronimo
    Fats Geronimo:
    NOT the original:
    Neologist:
    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.

    Alex, please submit a new WTF before we are consumed by posts such as these...

    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.

    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...

  • no2trolls (unregistered) in reply to Pr0gramm3r
    Pr0gramm3r:
    TRWTF is trying to optimize code when you can just buy more RAM.

    TRRWTF is you thinking that the problem with this code is the extra 10K memory it's going to end up using

  • Bob Holness (unregistered) in reply to Anonymous

    see subject (bad brain day)

  • Sudo (unregistered) in reply to Bob Holness
    Bob Holness:
    see subject (bad brain day)
  • noland (unregistered) in reply to Gary
    Gary:
    Gary:
    I think we're missing the point. If we assume that the desired goal is a good one, there is a quite simple pattern for incorporating javascript libraries that you might recall:
    <script language="Javascript" type="text/html" src="checkDateFunction.js"></script>
    <script language="Javascript" type="text/html" src="isNumericFunction.js"></script>
    

    text/html ... duh. application/javascript of course.

    Please mind we do not know how old this code is. IE 3 didn't support the script src-attribute. So if you're going MS-style that's the way to do it! ;-) (Or why didn't they support the scr-attribute in the first place? You wouldn't need ASP and this beauty of a code - MS's contribution to ornament the world.)

  • Qvasi (unregistered)

    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.

  • Anon (unregistered) in reply to Qvasi
    Qvasi:
    I'm not trying to troll, but this code (while implemented very stupidly) is not actually wrong.
    Code doesn't have to be wrong to be a WTF. Functional does not equate to well-designed.
  • (cs) in reply to Anon
    Anon:
    Qvasi:
    I'm not trying to troll, but this code (while implemented very stupidly) is not actually wrong.
    Code doesn't have to be wrong to be a WTF. Functional does not equate to well-designed.
    The code must be worse than a mere fail to be a wtf. It must be an epic fail.
  • dude (unregistered) in reply to Ben

    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.

Leave a comment on “Functionally Functional”

Log In or post as a guest

Replying to comment #:

« Return to Article