I have a boolean expression: A && (B || C && D)
However A, B, C, and D are quite long character-wise so representing it all in a single line is not possible. Let us assume for this example that A, B, C, and D will be on their own lines.
What is a recommended way to represent this expression using indentations extra parenthesis if necessary, line breaks and so on to maximize human readability.
First of all, according to your comment, you can use boolean variables such as
bAreFooAndBarEqual, only have their name carry a deeper meaning, and follow your own naming conventions.As for your specific example, I would explicitly show that I want the && to take precedence over the ||, and so add another pair of parentheses:
A && (B || (C && D)).Then, I would indent on each bracket opening, having the operator to the left of the operands (this is a personal taste, you should see what looks clearest to you):
Of course, this is just a personal taste, and you should think what feels most natural and looks the most clear to you.