Here are the rules that I live ...
Rule number 1
Use well-defined constants in the programming languages โโthat you use to communicate with the CPU, i.e. true / false in most modern cases for boolean values. If the database offers a boolean type or some such equivalent, of course, it should be used.
Rule number 2
Interaction with users of your software using their preferred language and idiom, that is, Yes / No questions that should be asked by Yes / No (or, possibly, an alternative to No, for example Cancel).
Rule number 3
Uncertainty must be expressed in terms of volume, i.e. โit dependsโ, followed by the question โabout what?โ. I know developers who answer the question by copying and pasting almost every dependency they may need in every project code file, like the using statement. This is just careless, and please take care of the alphabetical, or at least the group namespace together.
When bool Just Is Not Enough
By the way, the interesting twist on this available in C # is Nullable;
You can write
Nullable<bool> RespondToIritatingQuestion() { return new Nullable<bool>(); }
OR
bool? RespondToIritatingQuestionWithSytle() { return new bool?(); }
and the questionnaire will have to evaluate your answer before even knowing what answer, if any, maybe ...
bool? answer = RespondToIritatingQuestionWithStyle(); if (answer.HasValue) Trace.WriteLine("The bloke responded with " + answer.Value.ToString()); else Trace.WriteLine("The bloke responded with 'depends'.");
EnocNRoll - Ananda Gopal
source share