if (self.aBooleanProperty) { self.aBooleanProperty = YES;
In correctly written code, you don’t miss anything, and this setter line increases the paid lines of code with one non-op.
There are two reasons why this can be done for erroneous reasons.
As @HotLicks said, there may be side effects for the setter that may be required to run. But they had to be launched on the set, if the developer had no mistaken idea of ​​installing ivar directly everywhere, and then use the above to combine the cost of installation in one place. But it will be a remarkably fragile and stupid thing.
Another reason is that traditionally Objective-C BOOL is an illustrious char . Only it is not so glorified. Thus, comparing BOOL with YES really dangerous because YES has an explicit meaning.
BOOL mmmmmK = 2;
As with climbing, and something starts to fall, you do not shout “bottle”, “shoes”, “pebbles” or “prosthetic limb”, but you always shout ROCK .
So, perhaps the developer was thinking about normalizing the affirmative with an explicit YES. Again, it is highly doubtful and, even if this is so, then this should raise suspicion regarding the quality of the rest of the code base.
Uch.
source share