Quarternary Boolean



  • This is from a job I've quit many, many years ago.

    public enum OurBoolean

    {

        True,
        False,
        Unknown,
        Null

    }

    If I had had access to George Boole's coffin back then, I could have used it to generate electricity from his spinning corpse.

    It was actually named a bit differently. I've replaced the company name with "Our".

    So I asked the father of this hideous child why in the Malebolge did he code it like that. His answer was "dude, it's logic!"

    You see, in propositional logic there are those propositions which are always true (tautologies), those that are always false (contradictions), and those that may either be true or false (contingencies). The "Unknown" value in the enumeration was written so as to represent a contingency. Nevermind that everywhere in the application, this enumeration was used instead of your regular, day-to-day boolean variables. There was also a considerable amount of code to convert from the enumeration to normal booleans. The part dealing with "Unknown" was full of //TODO comments.

    As for the null value, that was put there so as "to comply with the DBMS". Which is why they made me look at this thing in the first place, they were having troubles with null values when they came from a database. I tried my best at explaining to them why a null reference and OurBoolean.Null were not the same thing. But the dev behind the monstruosity kept saying "but it's written 'null' in there, so it has to be null".



  • [quote user="Renan "C#" Sousa"]But the dev behind the monstruosity kept saying "but it's written 'null' in there, so it has to be null".[/quote]

    That's an easy one to solve. Ask him to lend you the biggest note in his wallet, promising to pay him back double within a hour. Suppose he gives you a $100 note (am I correct in understanding that the $ symbol is used for BRL?) - then get two pieces of paper, write "$100" on each one, and give them back as payment. Each says $100 just like the one he gave you, so they must be the same.

    Or, even better, give him $200 in Zimbabewan dollars.




  •  [quote user="Renan "C#" Sousa"]spinning[/quote]

    You win for a Dresden Codak reference.



  • Unfortunately, this kind of thing seems to be rather common, I've encountered ternary booleans on numerous occasions (even as front page material, back in the days: http://thedailywtf.com/Articles/True,_False,or_Yellow.aspx and http://thedailywtf.com/Articles/What_Is_Truth_0x3f.aspx). I can see the reasoning behind an "unknown" value, but the author of this seems to be pushing his luck with logic. (Makes me feel kind of good about ditching computer science for a degree in mathematics...)



  • [quote user="Renan "C#" Sousa"]

    public enum OurBoolean

    {

        True,
        False,
        Unknown,
        Null

    }

    It was actually named a bit differently. I've replaced the company name with "Our".[/quote] 

    So it's not only a Quaternary Boolean as described in the thread title, it's a Proprietary Quaternary Boolean!  No sirree, we can't have $competing_company thinking they can use Our enum values on Their own booleans!



  • [quote user="Renan "C#" Sousa"]public enum OurBoolean

    {

        True,
        False,
        Unknown,
        Null

    }

    [/quote] 

    What about "File not Found" or "Printer is on fire".

     



  • So where's the code that lets you multiply it with a vector to twist the truth?



  • @dhromed said:

     [quote user="Renan "C#" Sousa"]spinning

    You win for a Dresden Codak reference.

    [/quote]


    seconded



  •  You know what the best part of this is?

    Console.WriteLine( (OurBoolean)0 ); //outputs True

    Console.WriteLine( (OurBoolean)1 ); //outputs False


  • @Nelle said:

    @dhromed said:

     [quote user="Renan "C#" Sousa"]spinning

    You win for a Dresden Codak reference.


    seconded
    [/quote] 

     Bayesian Empirimancer is 85% confident.



  • @Paddles said:

    am I correct in understanding that the $ symbol is used for BRL?

    Yes. Either $ or R$.

    @dhromed said:

    @Nelle said:

    @dhromed said:

     [quote user="Renan "C#" Sousa"]spinning

    You win for a Dresden Codak reference.




    seconded
     

     Bayesian Empirimancer is 85% confident.

    [/quote]

    My a priori knowledge told me that.



  • @da Doctah said:

    So it's not only a Quaternary Boolean as described in the thread title, it's a Proprietary Quaternary Boolean!  No sirree, we can't have $competing_company thinking they can use Our enum values on Their own booleans! 

     

    Post of the Thread



  • [quote user="Renan "C#" Sousa"] Filed under: I use Cartesian Dualism to separate my mind from my body and deal mindless damage. [/quote]

    But they are imune to causality! You'll have to roll +20 for resistance to Euro-centrism.

    BTW: i liked the D&D one better than the AD&D 

     

     



  • @Nelle said:

    BTW: i liked the D&D one better than the AD&D 
     

    I prefer the one that's betterly drawn.



  • Obviously, you can't just rely on the language's logic processing. It won't follow the application's business rules, which apparently assume that the application is running in some sort of parallel universe where the normal laws of logic don't apply.



  • @toth said:

    Obviously, you can't just rely on the language's logic processing. It won't follow the application's business rules, which apparently assume that the application is running in some sort of parallel universe where the normal laws of logic don't apply.

    That must be the same universe that our project estimates come from. I'm pretty sure that the entirety of Oracle technical support is there too.



  • @Scarlet Manuka said:

    @toth said:
    Obviously, you can't just rely on the language's logic processing. It won't follow the application's business rules, which apparently assume that the application is running in some sort of parallel universe where the normal laws of logic don't apply.
    That must be the same universe that our project estimates come from. I'm pretty sure that the entirety of Oracle technical support is there too.
     

    I've done a few data migrations in that universe

    "These are the rules, apart from when they aren't"



  • @dhromed said:

     [quote user="Renan "C#" Sousa"]spinning

    You win for a<bstrong>n appropriate Dresden Codak reference.

    [/quote]

    FTFY.



  • @The_Assimilator said:

    @dhromed said:

     [quote user="Renan "C#" Sousa"]spinning

    You win for an appropriate Dresden Codak reference.

    FTFY.

    [/quote] 

    You are subtly mistaken: any Dresden Codak reference is like catching the Snitch.



  • @dhromed said:

    @The_Assimilator said:

    @dhromed said:

     [quote user="Renan "C#" Sousa"]spinning

    You win for an appropriate Dresden Codak reference.

    FTFY.

     

    You are subtly mistaken: any Dresden Codak reference is like catching the Snitch.

    [/quote]

    In that it causes morbs to hemorrhage?


Log in to reply