true false vs yes no


(Oliver M) #1

I found using "true/false" Boolean values reduced the code readability from the "YES/NO" of objective-c code.

I'm wondering if others also consider "yes/no" to be simply better.

A few reasons:

Yes and no are much more common in every day English. Their concepts and meanings are well understood to everyone with little question.

Concepts of truthfulness and falsehood have a great deal of philosophical/moral baggage associated with them and can be very subjective. They are not used regularly in every day English. Philosophers spend ages debating what is "truth", lawyers spend months arguing over who's truth to believe and theologians are ever searching for "a deeper truth".

A code statement like isLightOn = yes makes perfect logical sense in English. isLightOn = true does not.

Considering proposal SE-0005 point 5 is committing to using 'is' bool variable names (e.g. isLightOn) should true/false be replaced with yes/no?

I think it should.


(David Turnbull) #2

True and false goes way back to An Investigation of the Laws of Thought on
Which are Founded the Mathematical Theories of Logic and Probabilities by
George *Boole*, published in 1854.

http://www.gutenberg.org/ebooks/15114

-david

···

On Sat, Feb 6, 2016 at 2:13 PM, Oliver M via swift-users < swift-users@swift.org> wrote:

I found using "true/false" Boolean values reduced the code readability
from the "YES/NO" of objective-c code.

I'm wondering if others also consider "yes/no" to be simply better.

A few reasons:

Yes and no are much more common in every day English. Their concepts and
meanings are well understood to everyone with little question.

Concepts of truthfulness and falsehood have a great deal of
philosophical/moral baggage associated with them and can be very
subjective. They are not used regularly in every day English. Philosophers
spend ages debating what is "truth", lawyers spend months arguing over
who's truth to believe and theologians are ever searching for "a deeper
truth".

A code statement like isLightOn = yes makes perfect logical sense in
English. isLightOn = true does not.

Considering proposal SE-0005 point 5 is committing to using 'is' bool
variable names (e.g. isLightOn) should true/false be replaced with yes/no?

I think it should.

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Thomas Wetmore) #3

Oliver,

Tilting at windmills.

Tom

···

On Feb 6, 2016, at 5:13 PM, Oliver M via swift-users <swift-users@swift.org> wrote:

I found using "true/false" Boolean values reduced the code readability from the "YES/NO" of objective-c code.

I'm wondering if others also consider "yes/no" to be simply better.

A few reasons:

Yes and no are much more common in every day English. Their concepts and meanings are well understood to everyone with little question.

Concepts of truthfulness and falsehood have a great deal of philosophical/moral baggage associated with them and can be very subjective. They are not used regularly in every day English. Philosophers spend ages debating what is "truth", lawyers spend months arguing over who's truth to believe and theologians are ever searching for "a deeper truth".

A code statement like isLightOn = yes makes perfect logical sense in English. isLightOn = true does not.

Considering proposal SE-0005 point 5 is committing to using 'is' bool variable names (e.g. isLightOn) should true/false be replaced with yes/no?

I think it should.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Isaac Gouy) #4

On Saturday, February 6, 2016 2:13 PM, Oliver M

A code statement like isLightOn = yes makes perfect logical sense in
English. isLightOn = true does not.

But lightIsOn does make sense :wink:

if lightIsOn {
} else {
}

while lightIsOn {
}


(Adam Eberbach) #5

I like true/false - it might take a short time to get used to after YES/NO but it is more universally correct.

"if x == y" - I have a lot of trouble thinking about the result of that expression as YES while it is certainly “true”.

“true” also works just as well as YES when looking at a typical ObjC property like “isEnabled” or “userInteractionEnabled”.

I also thought back to George Boole. “Evaluates to true” is a phrase in the programmer’s lexicon and has been for a long time because those are the terms he used.

···

On 7 Feb 2016, at 9:13 am, Oliver M via swift-users <swift-users@swift.org> wrote:

I found using "true/false" Boolean values reduced the code readability from the "YES/NO" of objective-c code.

I'm wondering if others also consider "yes/no" to be simply better.

A few reasons:

Yes and no are much more common in every day English. Their concepts and meanings are well understood to everyone with little question.

Concepts of truthfulness and falsehood have a great deal of philosophical/moral baggage associated with them and can be very subjective. They are not used regularly in every day English. Philosophers spend ages debating what is "truth", lawyers spend months arguing over who's truth to believe and theologians are ever searching for "a deeper truth".

A code statement like isLightOn = yes makes perfect logical sense in English. isLightOn = true does not.

Considering proposal SE-0005 point 5 is committing to using 'is' bool variable names (e.g. isLightOn) should true/false be replaced with yes/no?

I think it should.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(bishal ghimire) #6

Only thing that constantly reminds me that I am using Swift not Objective-C is YES/NO bool value.

Even after almost year of using Swift, I feel like Bool value should be Yes and No not true and false.
But as all other programming language follow true and false. I think its just matter of time before Objective-C developer get used to it.

···

I found using&quot;true/false&quot; Boolean values reduced the code readability from the&quot;YES/NO&quot; of objective-c code.

I&#39;m wondering if others also consider&quot;yes/no&quot; to be simply better.

A few reasons:

Yes and no are much more common in every day English. Their concepts and meanings are well understood to everyone with little question.

Concepts of truthfulness and falsehood have a great deal of philosophical/moral baggage associated with them and can be very subjective. They are not used regularly in every day English. Philosophers spend ages debating what is&quot;truth&quot;, lawyers spend months arguing over who&#39;s truth to believe and theologians are ever searching for&quot;a deeper truth&quot;.

A code statement like isLightOn = yes makes perfect logical sense in English. isLightOn = true does not.

Considering proposal SE-0005 point 5 is committing to using&#39;is&#39; bool variable names (e.g. isLightOn) should true/false be replaced with yes/no?

I think it should.