Reconsider requiring curly braces for single-statement if-bodies
From https://www.eclipse.org/lists/escet-dev/msg00182.html:
I still don't like the "single statement needs curly brackets" thing. It makes handling a trivial case costing 3 lines, and if you have a bunch of such lines, it explodes in length.
public Node conjunct(Node a, Node b) { if (a == b) return a; if (a == Tree.ZERO || b == Tree.ZERO) return Tree.ZERO; if (a == Tree.ONE) return b; if (b == Tree.ONE) return a; public Node conjunct(Node a, Node b) { if (a == b) { return a; } if (a == Tree.ZERO || b == Tree.ZERO) { return Tree.ZERO; } if (a == Tree.ONE) { return b; } if (b == Tree.ONE) { return a; }
I don't know about you, but I find the first version much easier to globally grasp there are 4 if statements. If there is an empty line below it, it trivially makes a group of code. >The bottom version takes effort to understand, at least I need to search for the start of the next statement. Conditions and actions are mixed vertically.