• Rajendra Kumar (unregistered) in reply to Anonymous
    Anonymous:
    Rajendra Kumar:
    Dear Esteemed Professional,

    I am very interesting with your beautiful code. Particularly with the CheckDateFunction. I am needful of this exact same function, except for using JSP. Could you pls post this ASAP?!?!

    thx, Rajendra Kumar Senior Software Architect Abbas, Corp.

    Honestly Rajendra, have you not finished your calendar library yet? You've been working on it since June 2010, do you need some more codez plz? You just let me know good buddy. I can see that your calendar library is going to be the awesomest!

    Thanks you very much Mr. Ymous for your gracious wishes. The reason for schedule slippage is because we outsourced some of the project to Melanesia. Unfortunately, the code was very crudely designed. You would think it the coders were part caveman or something.

  • Gary (unregistered) in reply to Quietust
    Quietust:
    Try "text/javascript". Oh, and drop the 'language="Javascript"', since that's been deprecated for well over 13 years.
    Has it been so long already? I once had to write client-side VBScript (ugh).

    If you really want to bake your noodle, write your ASP pages in JScript. Take your pick of writing the client-side code in VBScript or outputting javascript snippets via JScript. And the true hallucinogenic fun is to be had accessing VBScript collections via JScript.

    CaptainOblivious:
    I think IE still doesn't understand the application/javascript MIME type. I've always needed to use text/javascript for IE. Oh, and I did already point out that you could reference .js files.
    Of course you did, while I was writing my bad script tags.
  • shane (unregistered)

    VBScript? Bah. Real men used javascript for their server side ASP code...

  • Azarien (unregistered)

    Officially, we have a new month: Dummy. It's three-letter shortcut is, well, "Dummy".

  • airdrik (unregistered) in reply to Rajendra Kumar
    Rajendra Kumar:
    Dear Esteemed Professional,

    I am very interesting with your beautiful code. Particularly with the CheckDateFunction. I am needful of this exact same function, except for using JSP. Could you pls post this ASAP?!?!

    thx, Rajendra Kumar Senior Software Architect Abbas, Corp.

    I'll get you those codes as soon as I finish my java VB interpreter. I'm pretty close - it should only take me another 3 months plus 6 months of testing (though at this point I think I'll just scrap the testing and call it good when it works).

  • justsomedude (unregistered) in reply to steenbergh
    steenbergh:
    skington:
    I like how they generate a Date object as the first line of code - and then promptly ignore it. Or how they determinedly use Systems Hungarian Notation in a language that doesn't have types.
    The Notation serves as a reminder to self so that you know what type of value you expect to be IN the variable. I have a lot of experience in Classic ASP and I always do this. I think it's more important in a weak-typed language than in a strong-typed one.

    Aye!

  • Kyle Z. (unregistered) in reply to airdrik
    airdrik:
    Rajendra Kumar:
    Dear Esteemed Professional,

    I am very interesting with your beautiful code. Particularly with the CheckDateFunction. I am needful of this exact same function, except for using JSP. Could you pls post this ASAP?!?!

    thx, Rajendra Kumar Senior Software Architect Abbas, Corp.

    I'll get you those codes as soon as I finish my java VB interpreter. I'm pretty close - it should only take me another 3 months plus 6 months of testing (though at this point I think I'll just scrap the testing and call it good when it works).

    Simpsons already did it.

    validus comment.

  • (cs) in reply to Quietust
    Quietust:
    drop the 'language="Javascript"', since that's been deprecated for well over 13 years.
    Why is it that deprecated stuff never actually goes away?
  • 'Murruhkan (unregistered)

    TRWTF is that

    IsNumeric(strNum)
    can be replaced by using the built-in
    !isNaN(strNum)

    Captcha: facilisis - The easiest captcha around.

  • Not of this Earth (unregistered) in reply to Signature Guy

    Wow... Yet another behemothic CodeSOD... I love this site.

  • Dan (unregistered) in reply to Anonymous
    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.

    I don't see the problem. It's a perfectly crommulent word.

  • (cs) in reply to Azarien
    Azarien:
    Officially, we have a new month: Dummy. It's three-letter shortcut is, well, "Dummy".
    Maybe the original programmer was reading about introspection and thought he'd try it out.
  • Mythran (unregistered) in reply to Signature Guy
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

  • NOT the original, ORIGINAL by (unregistered) in reply to Mythran
    Mythran:
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

    I agree with you...

  • NOT the original, ORIGINAL by (unregistered) in reply to NOT the original, ORIGINAL by
    NOT the original:
    Mythran:
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

    I agree with you...

    That pop you just heard was the universe starting to emplode in on itself.

  • Kyle Z. (unregistered) in reply to NOT the original, ORIGINAL by
    NOT the original:
    Mythran:
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

    I agree with you...

    beware of black holes

  • NOT the original, ORIGINAL by (unregistered) in reply to Kyle Z.
    Kyle Z.:
    NOT the original:
    Mythran:
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

    I agree with you...

    beware of black holes

    Hey! I resent that! You can't call me a... Oh wait, you said BLACK hole... Never mind, carry on.

  • MiffTheFox (unregistered)

    At least it would be easy to move the code into a actual .js file-- just run the ASP script and save the output.

  • foo (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"?
    That's actually quite fast. When I read "ASP", I go puke, and until I've cleaned up the mess and read the other three words, it's at least 10 minutes.
  • (cs) in reply to shane
    shane:
    VBScript? Bah. Real men used javascript for their server side ASP code...
    LOL!
  • (cs) in reply to Quietust
    Quietust:
    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.

    Try "text/javascript". Oh, and drop the 'language="Javascript"', since that's been deprecated for well over 13 years.

    You're back! Missed you dude!

  • (cs) in reply to justsomedude
    justsomedude:
    steenbergh:
    skington:
    I like how they generate a Date object as the first line of code - and then promptly ignore it. Or how they determinedly use Systems Hungarian Notation in a language that doesn't have types.
    The Notation serves as a reminder to self so that you know what type of value you expect to be IN the variable. I have a lot of experience in Classic ASP and I always do this. I think it's more important in a weak-typed language than in a strong-typed one.

    Aye!

    File under: Systems Hungarian is for C

  • Lamentations (unregistered) in reply to hoodaticus
    hoodaticus:
    justsomedude:
    steenbergh:
    skington:
    I like how they generate a Date object as the first line of code - and then promptly ignore it. Or how they determinedly use Systems Hungarian Notation in a language that doesn't have types.
    The Notation serves as a reminder to self so that you know what type of value you expect to be IN the variable. I have a lot of experience in Classic ASP and I always do this. I think it's more important in a weak-typed language than in a strong-typed one.

    Aye!

    File under: Systems Hungarian is for C
    Uh, no. Not really. See comment above.

  • Ox00000000 (unregistered) in reply to Kyle Z.
    Kyle Z.:
    NOT the original:
    Mythran:
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

    I agree with you...

    beware of black holes

    HEY! I resemble that remark!

  • Luiz Felipe (unregistered) in reply to NOT the original, ORIGINAL by
    NOT the original:
    NOT the original:
    Mythran:
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

    I agree with you...

    That pop you just heard was the universe starting to emplode in on itself.

    Actually an CTC (closed timelike curve) dont cause the blow of universe.

  • (cs)

    Having spent a year (give or take) maintaining a rather large application written entirely in ASP/VBScript I can say with absolute confidence that there's nothing good, decent, or simple about VBScript. An ASP/VBScript application can't even handle basic features without installing COM objects on the server and invoking them with Server.CreateObject("COM.Name"). VBScript still gives me nightmares. That same application still exists and is still thousands of ASP/VBScript files and even after all of the work that I did to clean it up it's still a mess.

    • TRWTF is indeed VBScript.
    • TDWTF is dynamically sending JavaScript inline instead of referencing a .js file with a <script> tag with caching encouraged. If space is really a concern then you could also minify and gzip it.

    For whoever asked, ASP/VBScript does not have an include mechanism and relies on the Web server's mindless <!-- #include file="" --> directive, which will happily include a file twice, etc. If you want an include mechanism (and you do) then you have to write one yourself by manually opening the file, parsing it if need be, either Eval or Execute'ing it, and then tracking which files have been included. Yes, performance will suffer compared to the real thing, but not as much as the code quality suffers without a sensible include mechanism.

    TRTRWTF is that Fog Creek Software (of Joel Spolsky fame) developed a VBScript compiler and extended it with advantaged features (instead of porting to .NET). :-X

  • NOT the original, ORIGINAL by (unregistered) in reply to Luiz Felipe
    Luiz Felipe:
    NOT the original:
    NOT the original:
    Mythran:
    Signature Guy:
    I agree with whatever Quietust just posted above.

    I agree with whatever the next person just posted below.

    I agree with you...

    That pop you just heard was the universe starting to emplode in on itself.

    Actually an CTC (closed timelike curve) dont cause the blow of universe.

    According to theory, yes, but I collapsed the universe just next month, and came back to tell you that indeed, it does cause the universe to pull it's lower lip over it's head and swallow...

  • (cs) in reply to Kempeth
    Kempeth:
    skington:
    I like how they generate a Date object as the first line of code - and then promptly ignore it. Or how they determinedly use Systems Hungarian Notation in a language that doesn't have types.

    1: Systems Hungarian Notation = The original/good Hungarian Notation Apps Hungarian Notation = The bastardized Version that caused the bad reputation

    This is unfortunately exactly backwards.

    Apps notation (what a variable is used for) was the original.

    Systems notation (how a variable is stored, which normally is important only when one first declares it) was the degenerate version.

    2: The whole point of HN 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.
  • Snelhest (unregistered)

    It’s like a function inside a function within a taco inside a Taco Bell that's inside a KFC within a mall that's inside of your dream!

  • Darth Multiverse (unregistered) in reply to Luiz Felipe
    Luiz Felipe:
    Actually an CTC (closed timelike curve) dont cause the blow of universe.
    I have blown your universe, pray I don't blow further.
  • free-range user. (unregistered) in reply to Darth Multiverse
    Darth Multiverse:
    Luiz Felipe:
    Actually an CTC (closed timelike curve) dont cause the blow of universe.
    I have blown your universe, pray I don't blow further.

    Darth to Luiz: Is that a universe in your pocket or are you just happy to se me?

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

    Your wit is so sharp and acerbic that my eyes started watering halfway through reading your comment.

    Please comment more often in the future.

  • сергей (unregistered)

    This reminds me of a game I used to play. The developers did the game in their spare time. I often told them I could volunteer on it (mostly because the pace of development was very, very slow) and they always refused.

    Turns out the whole thing is written using ASP. It has been that way for years, and continues to be maintained that way to this day. No wonder development is so slow, they must have to put up with a lot of the code you see in this article, but deny that it is bad at all.

    The only people really playing it are the devs and friends of the devs. They have problems running it even when 30 people play at the same time, but they refuse to change from ASP.

  • сергей (unregistered) in reply to Snelhest
    Snelhest:
    It’s like a function inside a function within a taco inside a Taco Bell that's inside a KFC within a mall that's inside of your dream!
    Congratulations, you watched Inception and can make stupid dream jokes just like everyone else.
  • anon (unregistered) in reply to Friday
    Friday:
    Oh God. *Clasps hands to mouth* I'm first!

    NOT!

  • (cs) in reply to Snelhest
    Snelhest:
    It’s like a function inside a function within a taco inside a Taco Bell that's inside a KFC within a mall that's inside of your dream!
    You're waiting for a function. A function that will call itself far too many times. You know what you hope the function will return, but you can't be sure. But it doesn't matter because it'll throw an Exception!
  • (cs)

    My god it's full of... CRAP. I've been remided of the reason we're putting the crappy ASP Classic mega-app to sleep.

    It wasn't just bad ASP, it was clever ASP. Doing all kinds of clever things.

    Like using Access as a database. Like separating code into a zillion small .asp files, because they load faster.

    Not to mention that the code is so Chtulhu-esque that not only reading the code will make you insane, copying the root directory for the "code" will probably crash your PC for no apparent reason!

  • NOT the original, ORIGINAL by (unregistered) in reply to danixdefcon5
    danixdefcon5:
    My god it's full of... CRAP. I've been remided of the reason we're putting the crappy ASP Classic mega-app to sleep.

    It wasn't just bad ASP, it was clever ASP. Doing all kinds of clever things.

    Like using Access as a database. Like separating code into a zillion small .asp files, because they load faster.

    Not to mention that the code is so Chtulhu-esque that not only reading the code will make you insane, copying the root directory for the "code" will probably crash your PC for no apparent reason!

    I was in a similar situation, however I was slightly (or a lot) luckier (if that's a comulant word). I had to upgrade a class ASP app to .Net, however I still needed to occasionally dig through the mounds of HTML/VBscript. It was like going into a haunted basement for something you desperately need, like water, and running the hell out of there once you got it and trying to forget about the whole thing afterwards...

  • Cunning Linguist (unregistered) in reply to Kempeth
    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.

    For a language like C, you want it. This is because an assignment with mismatched types won't be caught by the compiler, but can be caught by the human if they check the Hungarian types.

    For a language like C++ or Java, you don't want it. This is because the compiler will catch the type mismatch. The Hungarian type is simply noise for the human to ignore. (This is also why Microsoft deprecated the use of Hungarian Notation in .NET)

    For a language like JavaScript, it's a wash. JavaScript is a dynamic language, so this kind of type-munging is almost expected. Many types are constructed (composited) at run-time, not specified fully-formed in advance like in a static language. So this kind of "type marking" is less useful than one would expect. (This is also true of Lua, Groovy, and other dynamic languages.)

  • Ben (unregistered) in reply to Lamentations

    Dynamic languages are not broken. They don't need workarounds. In fact, trying to force idioms from static languages into dynamic languages is working against yourself. It creates more work for you as the primary author, and endless headaches for those who are tasked with maintaining your poor code. For reference, please read up dynamic language "protocols," and check out the article "Python is Not Java," as well as PEP 20.

  • Ben (unregistered) in reply to Lamentations
    Lamentations:
    skington:
    I like how they generate a Date object as the first line of code - and then promptly ignore it. Or how they determinedly use Systems Hungarian Notation in a language that doesn't have types.
    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. I've encountered some Python code where everywhere a variable was referenced, the original writer added a comment to indicate how it was supposed to work. The only place he didn't put the comment it was misused, and a runtime error occurred.

    Arrgh, forgot to hit "quote."

    Dynamic languages are not broken. They don't need workarounds. In fact, trying to force idioms from static languages into dynamic languages is working against yourself. It creates more work for you as the primary author, and endless headaches for those who are tasked with maintaining your poor code. For reference, please read up dynamic language "protocols," and check out the article "Python is Not Java," as well as PEP 20.

  • McGee (unregistered) in reply to snoofle
    snoofle:
    Quietust:
    drop the 'language="Javascript"', since that's been deprecated for well over 13 years.
    Why is it that deprecated stuff never actually goes away?

    dep·re·cate    /ˈdɛprɪˌkeɪt/ Show Spelled[dep-ri-keyt] Show IPA –verb (used with object), -cat·ed, -cat·ing. 1.to express earnest disapproval of. 2.to urge reasons against; protest against (a scheme, purpose, etc.). 3.to depreciate; belittle. 4.Archaic . to pray for deliverance from.

    deprecated stuff is (by definition) still included, just no longer considered the best way to skin a cat.

    Unfortunately, because so many people are so many versions behind us cool cats with the latest versions of <insert compiler/language here>, deprecated functionality is kept for backward compatibility.

  • David Wright (unregistered)

    TRWTF is all the people beating on VB when today's abomination is written in something far worse, VBScript. Yes, they're related. But they're not the same.

  • Kuron (unregistered)

    This was obviously done for optimization to reduce the number of requests the browser needs to make.

  • (cs) in reply to McGee
    McGee:
    snoofle:
    Why is it that deprecated stuff never actually goes away?
    deprecated stuff is (by definition) still included, just no longer considered the best way...
    Indeed; typically when it is removed it is considered obsolete.

    Once during a discussion, people were talking about keeping "obsolete" methods in case anyone was using them. When asked what I thought, I suggested labeling such methods as "deprecated". Several people laughed, arguing that it means the same thing; apparently the notion that two words might have separate meanings escaped them.

    Since then I've adopted an inhospitable facade, and others are slowly learning not to ask for my opinion on these things.

  • (cs)

    Well, that sure looks like a royal pain in the ASP.

    braces self to be pelted with rotten tomatoes

  • Simon (unregistered) in reply to Captain Oblivious
    Captain Oblivious:
    BlackBart:
    If they were trying to be efficient and not send any unneeded Javascript to the browser, why did they bother adding CR-LFs to each line??
    The problem is that the "solution" does send JavaScript to the browser, and it does so every time the user goes to a page. If they simply put the JavaScript in a .js file and referenced that file in the HTML, the browser could download the JavaScript once and cache it. Or, they could write VB that would run on the server so no code would have to be downloaded to the browser. The "solution" ends up simply compounding the problem they were trying to avoid in the first place.

    Maybe, maybe not. Having everything in a cached external file reduces download time, but may actually increase page load time if you're running a bunch of initialisation code that's not being used. Embedding one or two functions per page may be more efficient than loading a hundred of them from a cache.

  • Brendan (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. I've encountered some Python code where everywhere a variable was referenced, the original writer added a comment to indicate how it was supposed to work. The only place he didn't put the comment it was misused, and a runtime error occurred.

    It seems easier to just give it a name that makes it obvious. If there's confusion about what the variable is, maybe the type checking isn't the problem?

    I use Python for a lot of code at work and at home and I only had problems with dynamic typing for a couple weeks (until I realized I was doing it wrong). At this point, types either don't matter, or they're being forced into a specific type -- casting input when I get it, using properties on classes, and using function comments and casting in functions.

    To a limited degree, Pylint will also help you find problems, like if a function doesn't exist. That sort of issue exists in all scripting languages though, and has nothing to do with dynamic typing.

  • James (unregistered) in reply to Severity One

    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.

  • (cs) in reply to BlackBart
    BlackBart:
    If they were trying to be efficient and not send any unneeded Javascript to the browser, why did they bother adding CR-LFs to each line??
    Well there's probably a hidden layer here that compresses the code before sending it out to the browser. That way the original source files remain readable.

Leave a comment on “Functionally Functional”

Log In or post as a guest

Replying to comment #:

« Return to Article