Skip to main content

Questions tagged [boolean]

7 votes
8 answers
946 views

According to Is it wrong to use a boolean parameter to determine behavior?, I know using boolean parameters to decide the behaviour is bad, for example, when using boolean parameters as the following: ...
wcminipgasker2023's user avatar
0 votes
3 answers
253 views

I know there are some questions about boolean flags: Is it wrong to use a boolean parameter to determine behavior?, Multiple boolean arguments - why is it bad? which indicates the following code is ...
wcminipgasker2023's user avatar
3 votes
2 answers
6k views

I like the practice of naming boolean variables with a prefix like "is", "has", "should", or "can". But what about the functions that produce those results? ...
Ryan's user avatar
  • 167
0 votes
2 answers
548 views

.NET Boolean type usually makes if else pair all over the code. Functional Boolean should be more like Either type. Ideally represented as Either<Unit, Unit>. However, my issues with Either type ...
TIKSN's user avatar
  • 109
4 votes
5 answers
421 views

I have a disagreement with one of my colleagues on whether or not functions should have inverse functions available. I would like to know when/if inverse functions should be used. For example, say we ...
Byebye's user avatar
  • 346
3 votes
5 answers
1k views

I commonly use a boolean condition/variable when it's something too big or complicated and takes too much space by itself inside ifs - basically to avoid repeatability and thus improve readability. E....
PascCase's user avatar
1 vote
6 answers
4k views

I have had hard times naming boolean fields. On the one hand, i've read that it is good to name them as affirmative statements, like hasAge, or canDance. It's not a problem when naming local ...
Kamil Bęben's user avatar
-1 votes
1 answer
333 views

How about instead of #define bool _Bool #define true 1 #define false 0 #define __bool_true_false_are_defined 1 We should have this: #define bool _Bool #define true (bool)1 #define false (bool)0 #...
user avatar
11 votes
2 answers
511 views

I have been writing tests for a lot of long if/else trees recently, and I'm finding it a little discouraging. I want to speak in concrete terms, so consider the following example (I'll write in Ruby ...
preferred_anon's user avatar
1 vote
8 answers
4k views

Most programmers (including me) believe that methods with a boolean flag parameter should be refactored into two methods without the flag parameter. Are there any use cases for a boolean parameter ...
CJ Dennis's user avatar
  • 669
40 votes
8 answers
11k views

For example, suppose I have a class, Member, which has a lastChangePasswordTime: class Member{ . . . constructor(){ this.lastChangePasswordTime=null, } } whose lastChangePasswordTime ...
ocomfd's user avatar
  • 5,760
5 votes
7 answers
4k views

I am recently studying computer science and I was introduced into Boolean algebra. It seems that Boolean algebra is used to simplify logic gates in hardware in order to make the circuit design minimal ...
themhz's user avatar
  • 169
5 votes
3 answers
9k views

For example, to store whether sound is on, I have a boolean originally named "isSoundOn": private boolean isSoundOn=true; however, the default value of boolean is false, but I want my application to ...
ocomfd's user avatar
  • 5,760
-1 votes
1 answer
80 views

In a boolean system, say you have a while loop going on. Then you might have this: if (just_did_x) { do_something() } To prevent it calling do_something() more than once, you might do: if (...
Lance Pollard's user avatar
0 votes
1 answer
199 views

Wondering if there is anything closely resembling data-binding but for boolean values / triggers. It seems like it could be related to Binary Decision Diagrams (BDDs), but they are precomputed rather ...
Lance Pollard's user avatar

15 30 50 per page
1
2 3 4 5