• (cs) in reply to Sum Fag
    Sum Fag:
    Anonymous:
    Isn't the definition of boolean 2 values?


    No. http://en.wikipedia.org/wiki/Boolean_algebra

    From the Wikipedia page you supplied:
    "... and <font size="5">two</font> elements 0 (logical FALSE) and 1 (logical TRUE), such that..."
    From the dictionary:
    "Of or relating to a data type or variable in a programming language that can have <font size="5">one of two </font>values, true or false."

    Sum Fag:
    Anonymous:
    Well... Databases never had boolean values (because of null), so perhaps there is an explanation for the 2nd enum...


    Neither has C (C++ has, though. C# probably, too).

    Wow, wrong again.
    In ANSI-C, the truth test of the constructs if, while & for all require an implicit boolean type - this is specifically the reason it was promoted to an explicit type in C++.  Booleans in C are either zero (false) or non-zero (true).
  • (cs) in reply to Loren Pechtel
    Loren Pechtel:


    Figuring out gender can be quite a puzzle.

    I'm *VERY* used to being thought female--the male version of my name is so uncommon that people think it's a variant spelling on the female version.
    <font size="5">N</font>ot in Canada.   Up here, Lorne is very common name.  eg. Lorne Green, Lorne Michaels (of SNL).  Loren is pronounced the same as Lorne, in one syllable. not two.
  • Nick (unregistered) in reply to AndyW
    Anonymous:
    Isn't the definition of boolean 2 values?  I don't want to imagine the innards where you can have conditions that arent true or false


    I take it you never studied mathematics.  There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).
  • Bored (unregistered)

    God, this is the worst WTF ever.

    He probably just left off the FlagsAttribute. As another poster mentioned, maybe it's passed in to a reporting component to specify criteria - who knows? We don't.

    And yeah he implemented his tristate concept poorly. Wow.

    This is not a WTF, it's just shit code. And before people say 'Oh, but you haven't seen the rest of the system', if this is the best that Alex thought fit to post why do you assume the rest is worse?

    You guys should get out more - I see more developers coding at this standard than I see doing a reasonable job. It's what creates high paying work for the rest of us[:D]

  • Nugget (unregistered)

    It's a heisenbool!

  • (cs) in reply to Nick
    Anonymous:
    Anonymous:
    Isn't the definition of boolean 2 values?  I don't want to imagine the innards where you can have conditions that arent true or false


    I take it you never studied mathematics.  There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).


    You're so smrt.
  • (cs) in reply to JohnO
    JohnO:

    Anonymous:
    Anonymous:
    I guess this has to do with teh appearance of the 1 and 0.  One of them is obviously more of a phalic symbole then the other.  Of course this could be the root cuase of many fallicies.


    So... 0 is obviously male then? Looks like a piece of anatomy and 1 looks obviously female.

    Or did you mean the other way? I can guess both ways, they're equally likely.

    Lol, are you from Earth?  0 is a hole and 1 is a rod.  Perhaps the rest of us are missing some clever, different way of looking at it?



    You have to imagine looking at them (the anatomical couterparts) head on (ahem...)

    As for the bit mask business, maybe that was his original intention and it just didn't work out, or maybe he likes powers of 2. Maybe (as other posters have suggested) it is possible to have seemingly disparate order statuses. Does it really matter what the enum values are? What comments would we get if they were primary numbers?

    Sincerely,

    Mr. Mo

  • Julian (unregistered)

    Nice... it's just a little bit-shifting left during order-processing to get the order to transition states! :-)

    • Julian
  • (cs) in reply to Nick

    As opposed to the countable infinite number of something(s?). Particularly nice translated to Dutch (infinite~="uncountable").

    Somewhat Sincerely,

    Mr. Mo (now heading to refill his drink again)

    (what old code of mine can I drag out to submit? Anyone got the source to Timex/Sinclair basic?)

  • (cs) in reply to Nick
    Anonymous:
    Anonymous:
    Isn't the definition of boolean 2 values?  I don't want to imagine the innards where you can have conditions that arent true or false


    I take it you never studied mathematics.  There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).


    Imagine this was actually quoted in the post above. Assuming there is something to be seen here, that is.
  • (cs) in reply to Grovesy
    Grovesy:

    <font face="Arial" size="2">And yes, SQL is dumb, confused and general not up to the job, and certainly not something I would choose as a ‘Higher authority’
    </font>



    That doesn't mean the relational model is dumb. Codd defined the relational model, not SQL. It's not his fault that the language came out like this.

  • (cs) in reply to Mr. Mo

    Mr. Mo:
    As opposed to the countable infinite number of something(s?). Particularly nice translated to Dutch (infinite~="uncountable").

    Somewhat Sincerely,

    Mr. Mo (now heading to refill his drink again)

    (what old code of mine can I drag out to submit? Anyone got the source to Timex/Sinclair basic?)

    Yes, there is a difference between countable and uncountable infinite numbers.

    Countable infinates is a set like 0, 1, 2, 3, ... all the way to infinity.

    Uncountable infinites is a set like all of the floating point numbers between 0 and 1.

     

  • Yo (unregistered)

    The name of the third value (NOT_TRUE_OR_FALSE ) should be TRULSE (TRUefaLSE) - it means that value can be TRUE or FALSE or both :)

  • Moobar (unregistered) in reply to pmagill

    There really is no WTF at all for that first enumeration.  People who say "he should've used a 'flag' naming convention' are just crackpots.  There is no flag naming convention, look at the Windows SDK or the Linux sources and flags are often just given standalone names within an enum.

    Anonymous:

    The other Enum is a bit more flaky.  I consider this a true WTF also for the following reasons:

    This is defined as a bit flag enum.  Essentially each value is equal to one bit in the binary list of bits.  This should be used only when the different states are NOT mutually exclusive as using a bit flagged enumerator ...


    Flags do NOT have to be mutually exclusive.  Clearly this person has never worked on real software that uses bitvectors.It would be highly inconvenient if every mutually exclusive condition had to be placed into a new type and have it's own variable. 

    A simple example would be wanting to mask a bit that is applied to several other mutually exclusive flags, in whcih case you have a whole enumeration of exclusive bits with a single shared flag that can be toggled for any of them.

    Look at the Linux headers, there are piles of enumerated flags that are mutually exclusive to each other. 
  • Nick (unregistered) in reply to Mr. Mo
    Mr. Mo:
    As opposed to the countable infinite number of something(s?).


    Yes, as opposed to countably infinite sets such as the sets of all natural numbers or all integers.
  • (cs) in reply to Prefect
    Prefect:

    Mr. Mo:
    As opposed to the countable infinite number of something(s?). Particularly nice translated to Dutch (infinite~="uncountable").

    Somewhat Sincerely,

    Mr. Mo (now heading to refill his drink again)

    (what old code of mine can I drag out to submit? Anyone got the source to Timex/Sinclair basic?)

    Yes, there is a difference between countable and uncountable infinite numbers.

    Countable infinates is a set like 0, 1, 2, 3, ... all the way to infinity.

    Uncountable infinites is a set like all of the floating point numbers between 0 and 1.

     



    OK, please count all positive integers (I just cut your workload in half- or did I?) and get back to me with the result. Simply saying "infinity" doesn't count!

    Still think it's countable? Just because you can list a bunch of them in sequence doesn't mean you can actually count all of them.

    Yes, I do understand the concept of varying degrees of infinity (as much as it can be humanly understood anyway) but I wouldn't use "countable" as an attribute for any of them.
  • (cs) in reply to Mr. Mo
    Mr. Mo:
    Prefect:

    Mr. Mo:
    As opposed to the countable infinite number of something(s?). Particularly nice translated to Dutch (infinite~="uncountable").

    Somewhat Sincerely,

    Mr. Mo (now heading to refill his drink again)

    (what old code of mine can I drag out to submit? Anyone got the source to Timex/Sinclair basic?)

    Yes, there is a difference between countable and uncountable infinite numbers.

    Countable infinates is a set like 0, 1, 2, 3, ... all the way to infinity.

    Uncountable infinites is a set like all of the floating point numbers between 0 and 1.

     



    OK, please count all positive integers (I just cut your workload in half- or did I?) and get back to me with the result. Simply saying "infinity" doesn't count!

    Still think it's countable? Just because you can list a bunch of them in sequence doesn't mean you can actually count all of them.

    Yes, I do understand the concept of varying degrees of infinity (as much as it can be humanly understood anyway) but I wouldn't use "countable" as an attribute for any of them.


    Ok, so I missed the #define countable sequenceable at the beginning of the math course.

    Here's the original quote:

    There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).

    Please prove that there are an uncountable infinite number of them- or is this one of the uncountable ones?
  • Derek (unregistered) in reply to Mr. Mo

    I think the thing he was getting at is that there's a very simple formula for counting all positive integers.  The sequence is very simple and very well defined.  On the other hand, there is no such simple formula for counting all real numbers between 0 and 1.

    If you want to get into what's countable and what's uncountable, have a blast:
    http://en.wikipedia.org/wiki/Countable

  • Nick (unregistered) in reply to Mr. Mo
    Mr. Mo:
    Prefect:

    Mr. Mo:
    As opposed to the countable infinite number of something(s?). Particularly nice translated to Dutch (infinite~="uncountable").

    Somewhat Sincerely,

    Mr. Mo (now heading to refill his drink again)

    (what old code of mine can I drag out to submit? Anyone got the source to Timex/Sinclair basic?)

    Yes, there is a difference between countable and uncountable infinite numbers.

    Countable infinates is a set like 0, 1, 2, 3, ... all the way to infinity.

    Uncountable infinites is a set like all of the floating point numbers between 0 and 1.

     



    OK, please count all positive integers (I just cut your workload in half- or did I?) and get back to me with the result. Simply saying "infinity" doesn't count!


    By definition, a set is countable iff it has the same cardinality as the set of natural numbers.  The mapping f(x)=2x+1 if x >= 0, -2x if x < 0, is a bijection from the integers to the natural numbers, thus they have the same cardinality, and the integers are countable.  QED

    Mr. Mo:

    Still think it's countable? Just because you can list a bunch of them in sequence doesn't mean you can actually count all of them.


    Actually that is the very definition of the mathematical concept of 'countable'.

    Mr. Mo:

    Yes, I do understand the concept of varying degrees of infinity (as much as it can be humanly understood anyway) but I wouldn't use "countable" as an attribute for any of them.


    Unfortunately for you, you cannot just define your own language and expect everyone else to follow it.  'Countable' is a well defined and accepted mathematical term.  If you don't like it, dispute it with the academic journals, but please do not claim others are misusing the terminology.
  • Nick (unregistered) in reply to Mr. Mo
    Mr. Mo:
    Mr. Mo:
    Prefect:

    Mr. Mo:
    As opposed to the countable infinite number of something(s?). Particularly nice translated to Dutch (infinite~="uncountable").

    Somewhat Sincerely,

    Mr. Mo (now heading to refill his drink again)

    (what old code of mine can I drag out to submit? Anyone got the source to Timex/Sinclair basic?)

    Yes, there is a difference between countable and uncountable infinite numbers.

    Countable infinates is a set like 0, 1, 2, 3, ... all the way to infinity.

    Uncountable infinites is a set like all of the floating point numbers between 0 and 1.

     



    OK, please count all positive integers (I just cut your workload in half- or did I?) and get back to me with the result. Simply saying "infinity" doesn't count!

    Still think it's countable? Just because you can list a bunch of them in sequence doesn't mean you can actually count all of them.

    Yes, I do understand the concept of varying degrees of infinity (as much as it can be humanly understood anyway) but I wouldn't use "countable" as an attribute for any of them.


    Ok, so I missed the #define countable sequenceable at the beginning of the math course.

    Here's the original quote:

    There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).

    Please prove that there are an uncountable infinite number of them- or is this one of the uncountable ones?


    I believe Kurt Godel already did so, but if you want an abridged version...
    There is a countable set of mathematical proofs.  There is an uncountable set of truths in mathematics.  Therefore there is going to be an uncountable set of truths that do not have a corresponding proof.
  • josh (unregistered) in reply to Nick
    Anonymous:
    I take it you never studied mathematics.  There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).


    Or take Haskell, where there is a value "bottom" that is a value in every type.  So there are three values for Bool: True, False, and bottom.

    Think of it this way: Suppose you have a function bool f(void);  When you call f(), one of three things can happen.  It could return true, it could return false, or it could not return.  Bottom is the value of this third possibility.
  • Matt (unregistered)

    This is the stupidest WTF I have ever seen here, but of course, people still find it necessary to jump on the complain bandwagon, because, yeah, that's what people do here; despite the fact that most of you are high school students who haven't created a bigger project than that home page back in junior high.

    As for OrderStatus, it's painfully obvious that the numbers as such are chosen to be able to work as bit indices. I'm sure there's an integer called status for every order. A perhaps minor WTF is doing pointless space-savings instead of just using additional columns in the presumed database backend. Some of the available status options might seem a little off, such as UnRejected (which I assume means that an order was rejected, but then accepted again) and some might even be partially redundant, but since they were probably added iteratively during the project's development, no big suprise here.

    As for the BOOL, getting stuck on the name of the enum or arguing that mathematically boolean algebra only has two states is really stretching it. It's quite obvious that this is the code presentation of different states given by the underlaying storage mechanism. My first guess would be the availability of a boolean datatype in the used database where one can store three values: false, true and null.

  • (cs) in reply to Nick
    Anonymous:
    Mr. Mo:
    Mr. Mo:
    Prefect:

    Mr. Mo:
    As opposed to the countable infinite number of something(s?). Particularly nice translated to Dutch (infinite~="uncountable").

    Somewhat Sincerely,

    Mr. Mo (now heading to refill his drink again)

    (what old code of mine can I drag out to submit? Anyone got the source to Timex/Sinclair basic?)

    Yes, there is a difference between countable and uncountable infinite numbers.

    Countable infinates is a set like 0, 1, 2, 3, ... all the way to infinity.

    Uncountable infinites is a set like all of the floating point numbers between 0 and 1.

     



    OK, please count all positive integers (I just cut your workload in half- or did I?) and get back to me with the result. Simply saying "infinity" doesn't count!

    Still think it's countable? Just because you can list a bunch of them in sequence doesn't mean you can actually count all of them.

    Yes, I do understand the concept of varying degrees of infinity (as much as it can be humanly understood anyway) but I wouldn't use "countable" as an attribute for any of them.


    Ok, so I missed the #define countable sequenceable at the beginning of the math course.

    Here's the original quote:

    There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).

    Please prove that there are an uncountable infinite number of them- or is this one of the uncountable ones?


    I believe Kurt Godel already did so, but if you want an abridged version...
    There is a countable set of mathematical proofs.  There is an uncountable set of truths in mathematics.  Therefore there is going to be an uncountable set of truths that do not have a corresponding proof.


    I stand humbled before the collective mathematical/google genius of the forum. Please accept my apologies for interpreting "countable" to mean "able to be counted". I guess I did miss out on a few things in those engineering versions of my mathematics courses.

    But, the number of truths that do not have proofs is not the same thing as the number of mathematical statements that cannot be proven to be true or false.  I can personally make many mathematical statements that can be proven to be false.
  • tobi (unregistered) in reply to Sum Fag

    Anonymous:
    Anonymous:
    Isn't the definition of boolean 2 values?


    No. http://en.wikipedia.org/wiki/Boolean_algebra

     

    did you read the article before posting the url?

    "A Boolean algebra ... two elements 0 (logical FALSE) and 1 (logical TRUE) ..."

    or did i miss the irony in your posting?

  • tobi (unregistered) in reply to Nick

    Anonymous:
    Anonymous:
    Isn't the definition of boolean 2 values?  I don't want to imagine the innards where you can have conditions that arent true or false


    I take it you never studied mathematics.  There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).

    that simply means that a mathematical statement can't be described by a boolean value but not that a boolean must have three states.

  • Anonymous (unregistered) in reply to Roger
    Anonymous:

    Especially wonderful is that TRUE is the first value listed, so it has a value of 0.  FALSE has a value of 1.

    That is completely besides the point as you compare:
    BOOL value = BOOL.True
    if(value == BOOL.True)

    and most certainly not:
    BOOL value = BOOL.True
    if(value == 1)

    Now that would be a WTF by itself.

  • (cs) in reply to B&#246;&#246;l
    Anonymous:

     Shouldn't it be

    NOT_TRUE_OR_NOT_FALSE



    nope... not (true or false) is only true if the value isn't true, but isn't false either.
    not(true) or not(false) is false in that case, and is true in case the value is false (making part 1 true) or true (making part 2 true).

  • (cs)

    Gender is not boolean, mm'k? Even for those whose gender identity is strongly fixed, there are gray areas. Like most things in psychology, it's a continuous range, not a discrete one.

    As for the argument over bi-state, tri-state, n-state etc. logics, well, mathematically speaking, it's pointless. In aggregate, a collection of binary digits can represent any arbitrarily large number of discrete states (isn't this exactly what an enum is, in C, after all?). Using multiple state in the primary representation is pointless. The real division is between discrete and continuous, not bi-state and n-state.

  • (cs) in reply to felix

    <!--StartFragment -->

    felix:
    Grovesy:

    <FONT face=Arial size=2>And yes, SQL is dumb, confused and general not up to the job, and certainly not something I would choose as a ‘Higher authority’
    </FONT>



    That doesn't mean the relational model is dumb. Codd defined the relational model, not SQL. It's not his fault that the language came out like this.



    I didn't say the Relational Model was 'dumb', I think it's a great peice of work, and I can't remember ever blaming Codd for SQL either. I did say SQL was wrong.

  • anand (unregistered)

    hey what if the guy who wrote the code used the bool enum for another purpose too.
    like to see if the enum had never been changed or touched.
    if it was false, and somewhere in the code it became true, then again false.
    then you wont know about the transition from false->true->false..
    so probably he added that enum value..
    he can catch the transitions in other ways too, but he just did it like this.. who know?

    or ya he was really dumb..

  • (cs) in reply to Derek
    Anonymous:
    Anonymous:

    Then how did you post? You seem to have a funny definition of "entirely nonfunctional".


    Recently, a lot of experts in the browser field have begun to agree that it's likely that multiple browsers can coexist on a single computer.  They say it's probably really complicated, but possible.

    WTF???
  • Jbossss (unregistered)

    funny thing is that

    X == NOT_TRUE_OR_FALSE = (X == (not true)) or (X == false) = X == false

    there is the WTF

  • Ralf (unregistered) in reply to Katabrok

    Having a logic with more than two values is not as uncommon as you might think. Expert systems almost alway worked with three value logic. Ofcause doing this and still calling it bool algebra is not correct.

    A system I worked with had a 4-value logic: true, false, unknown and not-known. The difference between unknown and not-known was that unknown was the value of an unassigned proposition (null) and not-known was and actual assigned value (not enough informatie to detemine value).

    If a system needs to produre correct logical result having the default bool leads to errors.

  • (cs) in reply to pmagill

    Anonymous:
    Hmm, tri state booleans.

    I see them as more of a schrodinger's cat kind of problem.  Let's say you have a web site that stores visitors in a database.  This database also marks them as registered if they do so.  Now you could see this registered field as a boolean, either TRUE or FALSE, they are registered or they are not, but since this is a database and you may be doing as few updates as possible, and registration was added after initial release, it allows NULL.  This then becomes tri-state.

    Now on to the cat.  We know what TRUE and FALSE represent in the registered field, but we have a third value of NULL.  As with the theoretical cat, we don't know if the visitor registered or not until we check it.  Once we check we notice that it's state is not yet defined so we safely (and rightly so) assume FALSE.  As schrodinger's cat suddenly dies we know that this visitor has not registered because, if he had, this value would explicitly state TRUE.

    So are tri state booleans really tri state?  In most cases I think not, but there could be a time when the cat is undead if you bury it in the local Pet Semetary.

    Very eloquently stated!!

  • (cs) in reply to Grovesy
    Grovesy:

    <!--StartFragment -->I didn't say the Relational Model was 'dumb', I think it's a great peice of work, and I can't remember ever blaming Codd for SQL either. I did say SQL was wrong.


    Well, in the particular case we're discussing (null values in boolean columns), most SQL databases do as Codd said.

  • zootm (unregistered) in reply to Colin
    Anonymous:
    Tri-bool: true, false, null.

    "The Trouble with Tri-Bools" is your geeky reference of the day. :)

    I don't see the problem with the first one - that is how flags are defined in C# (you have to prepend the enumeration with the "[Flags]" attribute, but it's possible this was omitted?).
  • strickdd (unregistered) in reply to AndyW

    The funny thing about there being only 2 values for a bool is that Visual Studios 2005 now has a third value built in: null. I guess this takes care of people who don't instantiat the variable or if the DB has bad information.

  • Spudley (unregistered)

    I don't see any big problem with todays WTF.

    Okay, sure the tri-state boolean is a bit weird, but if you want to cope with a nullable SQL field, it's hardly the worst way you could find to do it.

    The bigger enum is also fine - as has been said, it's common enough to combine values like this with OR. The reject/rejected/unrejected options that some people are laughing at also look fine -- I'd interpret them as: reject -- marks that someone has asked for the item to be rejected. rejected -- marks that it has actually been rejected. unrejected -- marks that the rejection has been reversed. All perfectly legitimate things to want to keep track of in a status field. Possibly some slightly poor choices for their names, but nothing that deserves posting here.

  • Chris S (unregistered) in reply to mallard

    <font size="2">He used powers of 2 so that the enum values can be logically OR'd together.  For example, using this scheme in C# allows you to do this:

    OrderStatus S = OrderStatus.Opened || OrderStatus.Rejected;

    Of course the real WTF is that an order really shouldnt have more than one status at a time, and even if he did want to use the enum this way he is supposed to apply the [Flags()] attribute...
    </font>

  • Tom (unregistered) in reply to Chris S

    enum BOOL {
       HEADS

       TAILS

       EDGE of Coin

    }

  • (cs)

    The real WTF here is that the state flags from the first enum can't hold all the values for bool in the second enum.

  • Integration Nation (unregistered) in reply to trav
    Anonymous:
    Alex Papadimoulis:

    public enum OrderStatus
    {
    Opened = 1,
    PendingApproval = 2,
    Approved = 4,
    PendingAuthorization = 8,
    Authorized = 16,
    PaidFor = 32,
    Reject = 64,
    Rejected = 128,
    Deleted = 256,
    Removed = 512,
    UnRejected = 1024
    }



    Looks like the programmer is fiddling with his bits.  BAD PROGRAMMER, BURN IN THE FIRES OF PURGATORY HELL!

    I know several individuals who are still stuck in the C mindset that it's so much more efficient to place compound attributes in a bitmask.

    I can only tell you with what JOY I have when the same shitheads store the mask value directly in the database and you have to JOIN or WHERE against this.

    Simple example:

    SELECT ID, CustomerName FROM Customer WHERE MedFlags = 4 OR MedFlags = 128 OR MedFlags = 132

    DBA:  What?  MedFlags isn't a FK?

  • pmagill (unregistered) in reply to ChiefCrazyTalk
    Anonymous:

    Anonymous:
    Hmm, tri state booleans.

    I see them as more of a schrodinger's cat kind of problem.  Let's say you have a web site that stores visitors in a database.  This database also marks them as registered if they do so.  Now you could see this registered field as a boolean, either TRUE or FALSE, they are registered or they are not, but since this is a database and you may be doing as few updates as possible, and registration was added after initial release, it allows NULL.  This then becomes tri-state.

    Now on to the cat.  We know what TRUE and FALSE represent in the registered field, but we have a third value of NULL.  As with the theoretical cat, we don't know if the visitor registered or not until we check it.  Once we check we notice that it's state is not yet defined so we safely (and rightly so) assume FALSE.  As schrodinger's cat suddenly dies we know that this visitor has not registered because, if he had, this value would explicitly state TRUE.

    So are tri state booleans really tri state?  In most cases I think not, but there could be a time when the cat is undead if you bury it in the local Pet Semetary.

     

    In your example, I agree, there is an implied false by the null value but that is by no means the case.  What if a user is asked a yes/no question, and the answer is stored on a website somewhere?   TRUE means Yes, FALSE means no, and NULL means they havent answered the question yet, so it is equally likely to go either way.  Sure, this doesn't meet the strict definition of "boolean" but in the real world of real problems, this is a valid consideration.



    This my friend is where the axiom of schrodinger's undead cat comes into play.
  • pmagill (unregistered) in reply to Truls
    Anonymous:

    <font color="#000000">pmagill:</font>

     Hmm, tri state booleans.

    I see them as more of a schrodinger's cat kind of problem.  Let's say you have a web site that stores visitors in a database.  This database also marks them as registered if they do so.  Now you could see this registered field as a boolean, either TRUE or FALSE, they are registered or they are not, but since this is a database and you may be doing as few updates as possible, and registration was added after initial release, it allows NULL.  This then becomes tri-state.

    Now on to the cat.  We know what TRUE and FALSE represent in the registered field, but we have a third value of NULL.  As with the theoretical cat, we don't know if the visitor registered or not until we check it.  Once we check we notice that it's state is not yet defined so we safely (and rightly so) assume FALSE.  As schrodinger's cat suddenly dies we know that this visitor has not registered because, if he had, this value would explicitly state TRUE.

    So are tri state booleans really tri state?  In most cases I think not, but there could be a time when the cat is undead if you bury it in the local Pet Semetary.

    That doesn't work at all. In the schrodinger's cat problem you don't assume one or the other or neither. You assume both because you can't observe it it. So he can observe the database (with respect to the program)... s/he's just to lazy to create better checking.

    meaning it exists partly as each simultaneously


    Apparently you forget the reason for the cat.  Yes until you observe you have to assume both, because it can equally be one or the other, just like a value in a database, before you observe you have to assume both, or more logically neither, because it could be either one or the other equally.  It is only upon observation, checking the cat or reading the field, that the true state is determined.  The study was in essence the idea, that by simply observing something you affect it's state.  The boolean here displays that in a very succient manner.  By observing the field and seeing a still inknown value we affect it's state to be false.

    Of course, I did add the MAYBE at the end, hence the undead cat or true unknown.


    captcha = doom  (for the cat or the boolean?)
  • (cs)

    wow 200 posts on one of the lamest WTFs ever... must be a slow week.

  • (cs) in reply to The Lone Ranger
    The Lone Ranger:

    Hi, Ho, Tonto, Away. . .

    Isn't your horse's name "Silver"?
    Or are you actually riding on Tonto's back now?
  • (cs) in reply to Integration Nation
    Anonymous:
    Anonymous:
    Alex Papadimoulis:

    public enum OrderStatus
    {
    Opened = 1,
    PendingApproval = 2,
    Approved = 4,
    PendingAuthorization = 8,
    Authorized = 16,
    PaidFor = 32,
    Reject = 64,
    Rejected = 128,
    Deleted = 256,
    Removed = 512,
    UnRejected = 1024
    }



    Looks like the programmer is fiddling with his bits.  BAD PROGRAMMER, BURN IN THE FIRES OF PURGATORY HELL!

    I know several individuals who are still stuck in the C mindset that it's so much more efficient to place compound attributes in a bitmask.

    I can only tell you with what JOY I have when the same shitheads store the mask value directly in the database and you have to JOIN or WHERE against this.

    Simple example:

    SELECT ID, CustomerName FROM Customer WHERE MedFlags = 4 OR MedFlags = 128 OR MedFlags = 132

    DBA:  What?  MedFlags isn't a FK?

     

    Huruh, someone who understands...

  • (cs) in reply to Nick
    Anonymous:
    Mr. Mo:
    Mr. Mo:
    Prefect:

    Yes, there is a difference between countable and uncountable infinite numbers.

    Countable infinates is a set like 0, 1, 2, 3, ... all the way to infinity.

    Uncountable infinites is a set like all of the floating point numbers between 0 and 1.

     



    OK, please count all positive integers (I just cut your workload in half- or did I?) and get back to me with the result. Simply saying "infinity" doesn't count!

    Still think it's countable? Just because you can list a bunch of them in sequence doesn't mean you can actually count all of them.

    Yes, I do understand the concept of varying degrees of infinity (as much as it can be humanly understood anyway) but I wouldn't use "countable" as an attribute for any of them.


    Ok, so I missed the #define countable sequenceable at the beginning of the math course.

    Here's the original quote:

    There are many mathematical statements that can neither be proven to be true nor proven to be false (in fact there are an uncountable infinite number of them).

    Please prove that there are an uncountable infinite number of them- or is this one of the uncountable ones?


    I believe Kurt Godel already did so, but if you want an abridged version...
    There is a countable set of mathematical proofs.  There is an uncountable set of truths in mathematics.  Therefore there is going to be an uncountable set of truths that do not have a corresponding proof.

    Just to digress for a second: there's a really simple proof that demonstrates that there are some infinities bigger than other infinities. Check Cantor's Theorem. So easy that you can demonstrate an application of it on a napkin:

    1. Imagine a grid that starts at the upper left of your napkin and proceeds in the direction of the bottom and right corners (and extends infinitely).  For the purposes of this discussion, we'll only consider the bit that falls on your napkin.

    2. Along the left side, starting from the top, write the numbers "1, 2, 3, 4..." until you get to the bottom of the napkin.

    3. Draw a vertical line to separate those numbers from the rest of the napkin. Then fill the spaces of the grid to the right of the napkin with numbers. Doesn't matter what they are, so long as they're counting numbers (non-negative integers). When you're done, you should have a column of numbers starting at 1 along the left side of the napkin, and a grid with semi-random numbers filling the rest of the napkin.

    4. Imagine someone has asked you to enumerate, in no particular order, every last real number between zero and one. The numbers in that grid are your attempts: just imagine that there's a "0." on the beginning of each one. Since your imaginary grid continues infinitely far to the right, you know that they are infinitely precise, and since it continues infinitely far down, you know there are an infinite number of entries.

    5. The good part: like you were doing a word search, draw an ellipse around the first digit of the first line, the second of the second line, the third of the third, etc, and imagine it continues on infinitely. For each digit you've circled, add one to that digit and write it down on the back of your napkin (if it's a nine, make it zero).

    Congratulations. You've now constructed a number that doesn't appear anywhere on your list, and you can prove it because it will differ from the first number at the first decmial place, from the second at the second decimal place, from the third at the third, ad infinitum.

    And that is the difference between a set which is infinite but enumerable. And, in fact, this distinction was described by good old Georg Cantor as being countably infinite or uncountable: if a set can be put into a one-to-one relationship with the positive integers, it's countably infinite. Otherwise, it's uncountably infinite.

    http://en.wikipedia.org/wiki/Infinity

  • (cs) in reply to Ralf

    Anonymous:
    Having a logic with more than two values is not as uncommon as you might think. Expert systems almost alway worked with three value logic. Ofcause doing this and still calling it bool algebra is not correct.

    A system I worked with had a 4-value logic: true, false, unknown and not-known. The difference between unknown and not-known was that unknown was the value of an unassigned proposition (null) and not-known was and actual assigned value (not enough informatie to detemine value).

    If a system needs to produre correct logical result having the default bool leads to errors.

    Why is everyone overcomplicating this?  The Boolean datatype is two values: true and false.  Many times you need something else.  But your need doesn't change the definition of Boolean in a computer science context.  Nullability is an issue with all value datatypes, not just Boolean.  So that's really a silly point to argue.

  • (cs) in reply to JohnO

    WTF, that should be: enum BOOL { NOT_TRUE_OR_FALSE = 0; TRUE = 1; FALSE = 2; BOTH_TRUE_AND_FALSE = 3; }; // Perhaps with the flags attribute should be set?

    See how much better it is now?

Leave a comment on “Enumerating The Difficulties”

Log In or post as a guest

Replying to comment #:

« Return to Article