• (cs) in reply to boog
    boog:
    I've just gotten so used to it that it doesn't faze me anymore.
    Set your fazers to WTF!
    But recently, when I was tracking down a bug, found this very special code.
    I sure hope you did the right thing:
    Public Function EmailList() As Boolean
        Try
            Return True
        Catch ex As Exception
            Log.print("Oh crap - we are not running in the correct Universe\n");
            Return False
        End Try
    End Function
    I think it would be more like
    if (!True) { 
    throw new UniverseNotSupportedException(); }
  • Paul (unregistered)

    "I'm still trying to figure out how truth can fail."

    Watched any of the popular 24/7 news channels lately?

  • Jack (unregistered)

    You can't handle the truth!

  • Ken C. (unregistered) in reply to Ken B.
    Ken B.:
    Try
    [...]
    End Try
    The programmer who wrote this needs to listen to Yoda, and program in C instead. Do or do not. There is no "try".
    No 'try'? What do you mean? Of course there is a 'try'. Watch any fail compilation video and you'll see that I'm right.
  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    boog:
    Public Function EmailList() As Boolean
        Try
            Return True
        Catch ex As Exception
            Log.print("Oh crap - we are not running in the correct Universe\n");
            Return False
        End Try
    End Function
    I think it would be more like
    if (!True) { 
    throw new UniverseNotSupportedException(); }
    Ideally yes, but I'm unsure what effect that might have on calling code. Previously EmailList produced no exceptions - calling code may be unready for it to suddenly start.
  • Gordon Freeman (unregistered) in reply to boog
    boog:
    C-Octothorpe:
    boog:
    Public Function EmailList() As Boolean
        Try
            Return True
        Catch ex As Exception
            Log.print("Oh crap - we are not running in the correct Universe\n");
            Return False
        End Try
    End Function
    I think it would be more like
    if (!True) { 
    throw new UniverseNotSupportedException(); }
    Ideally yes, but I'm unsure what effect that might have on calling code. Previously EmailList produced no exceptions - calling code may be unready for it to suddenly start.

    No problem! The code is enterprisey enough so that every method in it catches all and logs the exception. It just needs to find the logger of the alternate universe (which is really the same universe with a different logic)

  • (cs)

    At first glimpes, it's a small WTF - if at all. On further reflection, this function seems to have been deprecated and its functionality removed. And, instead of spending the time going through the entire code base and refactoring every spot that touched this function, they simply made it a stub that always returns true; probably with the idea of coming back at a later date to remove the function and its references completely. Should they have removed the Try/Catch? Maybe, but it's a no-op, so it does no harm except to waste a few bytes on the disk (and somehow qualify as a front-page WTF on this site).

  • (cs)

    I hope Brenden Sharp's VB is better than his English.

  • Rawr (unregistered) in reply to ObiWayneKenobi

    I agree and disagree. I like functions that are populating objects to return a bool. However, I want my results as well. This is a pretty popular concept in C#, and it's how all 'Try' methods (TryParseInt, for example) are implemented.

    public bool PopulateObject(someObject A, out newObject)
    {
         if(A == null)
         {
             return false;
         }
         if(A.someNullableDecimal == null)
         {
             return false;
         }
         newObject = newObject(A.someNullableDecimal.Value);
         return true;
    }
    

    I like this because it's encapsulated. It's easily testable, and all the mess is "hidden". Calling your method is beautiful.

    Public newObject = null;
    Public someObject = null;
    if(PopulatetObject(someObject, out newObject) == false)
    {
        Throw new Exception('You suck');
    }
    
    //Carry on your way with beautifully populated objects.
    

    Now, if your method isn't actually doing anything that returns results, like sending a bunch of e-mails. I think simply returning a bool is perfect. What results do you want? A count? A list of recipients? I have no idea. Most people just care that it worked.

  • (cs) in reply to Ken B.
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

  • (cs)

    Hm, yes and an intern to read and type them back in to find the error.

  • (cs) in reply to Rawr
    Rawr:
    <snipped some weird "code">
    Really? Why? That's just, weird and isn't "popular" by any means.

    Also just to clarify, what you would need to do if you would actually ever WANT to do this, is to modify your method signature to pass in your object using the ref keyword, otherwise your object will still be null after the method call.

    I dunno, there are several big WTFs here and I'm beginning to think I just got trolled...

  • (cs) in reply to ObiWayneKenobi
    What really, really, really, really bugs me though is having methods that have an int/bool return value to indicate success/failure when the method is filling an object or performing an action, such as loading something from the database or, in this case, sending emails

    Exceptions are for exceptional circumstances...things that can not reasonably be predicted. If "no rows" (to use your example) is a valid business condition then it should not throw.

    Want to have some fun, work on a project (common in many industries, including financial) whhere any exception thrown (even if caught) causes the NOC to contact the on-call support person to immediately adress the issue. Specific exceptions (i.e. arguments, call stack, context) that have been previously deems "acceptable" ae stored in a DB which is checked before the alert procedure.

    You learn very quickly to make sure that the things that trigger exceptions are really exceptional.

  • The Othe Bob (unregistered) in reply to QJo
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

  • (cs)
    Public Function EmailList() As Boolean
        Try
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function
    
    Yes, I see the problem here. Although the return statement is safely protected against problems with a try...catch, what if the subroutine *call* goes wrong? Could be tricky ensuring that every call site is also wrapped in a try...catch; someone's bound to forget one somewhere.

    Clealy, what is needed is a subroutine to encapsulate the process of calling EmailList(), and then it can just be wrapped in a single try-catch block there.

  • Gordon Freeman (unregistered) in reply to dohpaz42
    dohpaz42:
    At first glimpes, it's a small WTF - if at all. On further reflection, this function seems to have been deprecated and its functionality removed. And, instead of spending the time going through the entire code base and refactoring every spot that touched this function, they simply made it a stub that always returns true; probably with the idea of coming back at a later date to remove the function and its references completely. Should they have removed the Try/Catch? Maybe, but it's a no-op, so it does no harm except to waste a few bytes on the disk (and somehow qualify as a front-page WTF on this site).

    The fact that it can be historically explained doesn't mean it's not a WTF (if I wanted to troll, I'd make a reference to imperial units here). So, it impacts code readability doesn't it? That's enough for me. It's not a rocket-destroying WTF, but we can't afford one of those everyday.

  • (cs) in reply to rd
    rd:
    How could it possibly fail? Well, I don't know... but why would the programmer have written failure handling code if it couldn't possibly fail? Answer that, Mr. Smarty Pants!
    Shop Standards
       3.1.2.1(rev)Exception handling
          All code must contain exception handling without exception
    
  • Bob (unregistered) in reply to The Othe Bob
    The Othe Bob:
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

  • (cs) in reply to Silfax
    Silfax:
    rd:
    How could it possibly fail? Well, I don't know... but why would the programmer have written failure handling code if it couldn't possibly fail? Answer that, Mr. Smarty Pants!
    Shop Standards
       3.1.2.1(rev)Exception handling
          All code must contain exception handling without exception
       3.1.2.2 Swallowing Exceptions
          Swallowing exceptions are punishable by death.
    
    FTFM
  • Anon Three (unregistered) in reply to Melnorme

    LMFTFY:

    Public Function EmailList() As Boolean
        Try
            Return True
        Catch ex As Exception
            Return False
        Finally
            Return FileNotFound
        End Try
    End Function
    
  • (cs) in reply to Bob
    Bob:
    The Othe Bob:
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

    Fuck off, Bob.

  • (cs) in reply to trtrwtf
    trtrwtf:
    Bob:
    Please *snip stupid meme*
    Fuck off, Bob.
    Thank you.
  • Tim Rowe (unregistered) in reply to Steve
    Steve:
    Anketam:
    It could fail if File Not Found or in this case Email List Not Found *nods sagely*

    I'm guessing you're being sarcastic or something, but just in case you're not - how could it possibly fail? It's an empty function, it doesn't try to load a file or an email list.

    It depends. Is this a language in which True can be redefined or in which it is not defined by default? (in C#, for example, it's 'true' -- lower case -- so IIRC True has no default meaning). If so then True might fail, in which case TRWTF is not this bit of code but the bit where 'True' is given a brain-dead meaning.

  • Gordon Freeman (unregistered) in reply to Bob
    Bob:
    The Othe Bob:
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

    I'm starting to think some guy with too much time on his hands (that does not narrow down the choice here) coded a bot which regularly scans comments and posts this shit.

    Let's have a try now: retard, the world is retard it's no trick of the screen it's hard on the mind retard, the world is retard dumb to the sight and hard on the mind in the gray of the interwebs

  • Stop! ...Zunner-Time! (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    Silfax:
    rd:
    How could it possibly fail? Well, I don't know... but why would the programmer have written failure handling code if it couldn't possibly fail? Answer that, Mr. Smarty Pants!
    Sharia Law
       3.1.2.1(rev)Erection handling
          All wives must support erection handling without exception
       3.1.2.2 Swallowing Erections
          Swallowing of erections is punishable by death.
    
    FTFM
    ITFY
  • Bob (unregistered) in reply to Gordon Freeman
    Gordon Freeman:
    Bob:
    The Othe Bob:
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

    I'm starting to think some guy with too much time on his hands (that does not narrow down the choice here) coded a bot which regularly scans comments and posts this shit.

    Let's have a try now: retard, the world is retard it's no trick of the screen it's hard on the mind retard, the world is retard dumb to the sight and hard on the mind in the gray of the interwebs

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    Silfax:
    rd:
    How could it possibly fail? Well, I don't know... but why would the programmer have written failure handling code if it couldn't possibly fail? Answer that, Mr. Smarty Pants!
    Shop Standards
       3.1.2.1(rev)Exception handling
          All code must contain exception handling without exception
       3.1.2.2 Swallowing Exceptions
          Swallowing exceptions are punishable by death.
    
    FTFM

    Aha! Easy-peasy. What you do is to make the exceptions poisonous!

    And you probably meant "is punishable by death".

  • Bob (unregistered) in reply to trtrwtf
    trtrwtf:
    Bob:
    The Othe Bob:
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.
    Fuck off, Bob.
    Screw you. I don't see this forum overflowing with references to the N-word. Why? Because simple usage shows you to be nothing more than an ignorant, insensitive, idiotic bigot.

  • The Zuneman Cumeth (unregistered) in reply to QJo
    QJo:
    C-Octothorpe:
    ...are punishable by death.
    ...you probably meant "is punishable by death".
    His grammar is deplorable. Fit for s grade-school child, it is.
  • The Zuneman Cumeth (unregistered) in reply to Bob
    Bob:
    trtrwtf:
    Fuck off, Bob.
    Screw you. I don't see this forum overflowing with references to the N-word. Why? Because simple usage shows you to be nothing more than an ignorant, insensitive, idiotic bigot.
    What, "nigger"? I like niggers. Especially with blonde chicks. Niggers have the biggest dicks. Maybe that's why they enjoy rape so much.

    Akismet, this is a perfectly legitimate comment. I don't appreciate you calling me spam!

    Akismet, how many times do I have to do this? We can't use links? Why the fuck not!?!

    Okay, I removed the porn link - happy now?

  • (cs) in reply to Bob
    Bob:
    Gordon Freeman:
    Bob:
    The Othe Bob:
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

    I'm starting to think some guy with too much time on his hands (that does not narrow down the choice here) coded a bot which regularly scans comments and posts this shit.

    Let's have a try now: retard, the world is retard it's no trick of the screen it's hard on the mind retard, the world is retard dumb to the sight and hard on the mind in the gray of the interwebs

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.
    Dear Bob,

    In case you can’t tell, this is a grown-up place. The fact that you insist on using your sensitivity clearly shows that you’re too young and too stupid to be using thedailywtf.com.

    Go away and grow up.

    Sincerely, Bert Glanstron

  • (cs) in reply to QJo
    QJo:
    C-Octothorpe:
    Swallowing exceptions are punishable by death.
    ...you probably meant "is punishable by death".
    Clearly he was talking about exceptions that swallow, and how death is a way of punishing them.

    Otherwise he'd have said "Swallowing of exceptions is punishable by death."

  • (cs) in reply to Bob
    Bob:
    Screw you. I don't see this forum overflowing with references to the N-word. Why? Because simple usage shows you to be nothing more than an ignorant, insensitive, idiotic bigot.

    And simple repetitive recycling of a tired and boring memelet shows you to be a retard. Hence, I use the word "retard". Or, if you prefer, I'll call you a moron. Or would "tedious dipshit" suit you better? Take your pick. I know I'll see you posting "I had a son who was a tedious dipshit, and I can assure you..." soon enough, in any case, because you're a tedious dipshit. And a moron. And, oh, right, a retard.

    In sum, (let's say it all together, now) fuck off, Bob.

  • Knuckle Dragon (unregistered) in reply to Lockwood
    Lockwood:
    Bob:
    Gordon Freeman:
    Bob:
    The Othe Bob:
    QJo:
    Ken B.:
    So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?

    Put it in a "while true" loop of course, and keep going round and round until it works. Don't forget to write the stack dump of why it didn't work to a log file, preferably on another machine, the one hosting the production database would be best. Then every evening at about 6:30 you get the line printers to print the file out.

    I had a retarded co-worker who would have an issue with that plan.

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

    I'm starting to think some guy with too much time on his hands (that does not narrow down the choice here) coded a bot which regularly scans comments and posts this shit.

    Let's have a try now: retard, the world is retard it's no trick of the screen it's hard on the mind retard, the world is retard dumb to the sight and hard on the mind in the gray of the interwebs

    Please show some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.
    Dear Bob,

    In case you can’t tell, this is a grown-up place. The fact that you insist on using your sensitivity clearly shows that you’re too young and too retarded to be using thedailywtf.com.

    Go away and grow up.

    Sincerely, Bert Glanstron

    FTFY. Waiting for the retarded bot...
  • The Zuneman Cumeth (unregistered) in reply to trtrwtf
    trtrwtf:
    Bob:
    Screw you. I don't see this forum overflowing with references to the N-word. Why? Because simple usage shows you to be nothing more than an ignorant, insensitive, idiotic bigot.

    And simple repetitive recycling of a tired and boring memelet shows you to be a retard. Hence, I use the word "retard". Or, if you prefer, I'll call you a moron. Or would "tedious dipshit" suit you better? Take your pick. I know I'll see you posting "I had a son who was a tedious dipshit, and I can assure you..." soon enough, in any case, because you're a tedious dipshit. And a moron. And, oh, right, a retard.

    In sum, (let's say it all together, now) fuck off, Bob.

    Even I'm getting tired of that guy.

    And even though I just though of what "dipshit" could be an amusing euphemism for, I'm not going with it because Bob already sucked all the fun out of the room.

    FACE!!! as in IN YOURS! as in I CAME!

  • Mr. T Experience (unregistered)

    O Hai guys! is there anything I can do to stir the pot a little more?

  • (cs) in reply to trtrwtf
    trtrwtf:
    Bob:
    Screw you. I don't see this forum overflowing with references to the N-word. Why? Because simple usage shows you to be nothing more than an ignorant, insensitive, idiotic bigot.

    And simple repetitive recycling of a tired and boring memelet shows you to be a retard. Hence, I use the word "retard". Or, if you prefer, I'll call you a moron. Or would "tedious dipshit" suit you better? Take your pick. I know I'll see you posting "I had a son who was a tedious dipshit, and I can assure you..." soon enough, in any case, because you're a tedious dipshit. And a moron. And, oh, right, a retard.

    In sum, (let's say it all together, now) fuck off, Bob.

    I personally find it interesting that Bob keeps refering to his son in the past tense, which implies that his son is now dead. So to show my lack of sensitivity: So Bob did your son get a Darwin Award for dieing in a 'retarded' way, and if so could you send us the link so we can laugh hysterically.

  • The Zuneman Cumeth (unregistered) in reply to Mr. T Experience
    Mr. T Experience:
    O Hai guys! is there anything I can do to stir the pot a little more?
    I don't know why guys feel the need to try that maneuver. I guess if that don't change it up, they'll think they're boring me. In-and-out is all you really need to do. Just fucking fuck me!
  • LANMind (unregistered) in reply to BTrey
    BTrey:
    Likely a stub function that was intended to be expanded later and was never completed.

    This is exactly what I think every time we see this type on non-WTFy WTF...

  • (cs) in reply to Mr. T Experience
    Mr. T Experience:
    O Hai guys! is there anything I can do to stir the pot a little more?
    No, you're a little late to the party, though you're welcome to try again tomorrow.
  • (cs) in reply to frits

    You're brillant, because I was going to post this same thing and had the foresight to look for it first.

    (Yours is much better than what I was going to write.)

  • JBKauai (unregistered)

    You can't handle the truth!

  • Ken B. (unregistered) in reply to The Zuneman Cumeth
    The Zuneman Cumeth:
    QJo:
    C-Octothorpe:
    ...are punishable by death.
    ...you probably meant "is punishable by death".
    His grammar is deplorable. Fit for s grade-school child, it is.
    It depends. Does "swallowing exceptions" mean "the act of taking exceptions and swallowing them", in which case "is" is correct? Or does it mean "those exceptions which are in the 'swallowing' category -- as opposed to 'non-swallowing exceptions' -- then "are" is correct.
  • (cs) in reply to Ken B.
    Ken B.:
    The Zuneman Cumeth:
    QJo:
    C-Octothorpe:
    ...are punishable by death.
    ...you probably meant "is punishable by death".
    His grammar is deplorable. Fit for s grade-school child, it is.
    It depends. Does "swallowing exceptions" mean "the act of taking exceptions and swallowing them", in which case "is" is correct? Or does it mean "those exceptions which are in the 'swallowing' category -- as opposed to 'non-swallowing exceptions' -- then "are" is correct.
    Let's just put this to rest: I didn't proof read.
  • Hater (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    Let's just put this to rest: I didn't swallow.

    Yeah you just suck

  • (cs) in reply to Rawr
    Rawr:
    I agree and disagree. I like functions that are populating objects to return a bool. However, I want my results as well. This is a pretty popular concept in C#, and it's how all 'Try' methods (TryParseInt, for example) are implemented.
    Public newObject = null;
    Public someObject = null;
    if(PopulatetObject(someObject, out newObject) == false)
    {
        Throw new Exception('You suck');
    }
    
    //Carry on your way with beautifully populated objects.
    
    TRWTF is programming languages that don't allow multiple return values.
  • (cs) in reply to Hater
    Hater:
    C-Octothorpe:
    Let's just put this to rest: I didn't swallow.
    Yeah you just suck
    So the best you can do is change my quote to something completely different and make a cheap joke about it?

    I was going to insult you, but it seems being you is enough of an insult.

  • (cs) in reply to PedanticCurmudgeon
    PedanticCurmudgeon:
    Rawr:
    I agree and disagree. I like functions that are populating objects to return a bool. However, I want my results as well. This is a pretty popular concept in C#, and it's how all 'Try' methods (TryParseInt, for example) are implemented.
    Public newObject = null;
    Public someObject = null;
    if(PopulatetObject(someObject, out newObject) == false)
    {
        Throw new Exception('You suck');
    }
    
    //Carry on your way with beautifully populated objects.
    
    TRWTF is programming languages that don't allow multiple return values.
    Oh man, don't spark that one up again...
  • Hortical (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    PedanticCurmudgeon:
    TRWTF is programming languages that don't allow multiple return values.
    Oh man, don't spark that one up again...
    No, let him speak. I want to hear how Haskell does it. I'm sure it's very impressive.
  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    PedanticCurmudgeon:
    Rawr:
    I agree and disagree. I like functions that are populating objects to return a bool. However, I want my results as well. This is a pretty popular concept in C#, and it's how all 'Try' methods (TryParseInt, for example) are implemented.
    Public newObject = null;
    Public someObject = null;
    if(PopulatetObject(someObject, out newObject) == false)
    {
        Throw new Exception('You suck');
    }
    
    //Carry on your way with beautifully populated objects.
    
    TRWTF is programming languages that don't allow multiple return values.
    Oh man, don't spark that one up again...
    Why not? It's not as if this thread could possibly sink any lower...

Leave a comment on “The True Alternative”

Log In or post as a guest

Replying to comment #:

« Return to Article