I've recently started on a new development team. I spend a lot of time coding individual projects in my free time, and the last team I worked on at this company my work was mostly individual.
At the moment I'm spending most of my time maintaining and refactoring our applications and trying to get used to being in a collaborative software environment.
Our applications have a lot of if statements structured like this:
boolean foobar = false;
if(condition){
foobar = true;
}
Writing code individually, I'd be more inclined to this structure:
boolean foobar = false;
foobar = condition;
For those of you working on collaborative development teams, do you think the latter option would sacrifice readability? Is the elimination of superfluous code worth this sacrifice? Are there other factors I may not be taking into account?
For what it's worth, we use Sonar for source code quality management, and a Sonar flag I've fixed without protest is almost exactly this - that boolean methods should return the condition, not 'true' or 'false'.