Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I'm in the "Use the braces. Just use them every time" camp [1]. As others have suggested you or your tooling will catch a lot of cases where you screw up on this, but the ones that slip through can...
Answer
#1: Initial revision
I'm in the *"Use the braces. Just use them every time"* camp [^1]. As others have suggested you or your tooling will catch a lot of cases where you screw up on this, but the ones that slip through can really hurt. So, I was surprised to hear [Robert "Uncle Bob" Martin](https://en.wikipedia.org/wiki/Robert_C._Martin) opine that [he's *"on a mission to destroy all braces"* (video link, but to the quote)](https://youtu.be/58jGpV2Cg50?t=4513). Now it was clear from the context that his preference is to get all the `while` statements into a form like ``` while ( someClearlyNamedCondition() ) takeClearlyNamedAction(); ``` and similarly for `if`, so that there is never a need to have more than one line following the condition (changes to the named action should be made in `takeClearlyNamedAction()`, right?) and the code can be read aloud without ambiguity or difficulty. Making that work is going to take some serious dedication to clean code and refactoring as you go, but elsewhere in the video series, Uncle Bob talks about the importance that he sees in adopting a discipline in your coding (he has TDD in particular in mind and gives an enlightening demonstration of how he goes about that). [^1]: This is a change for me and one that has been slow in coming. I'm old enough to have done most of my formative programming in terminals with a severely limited number of lines (hey but at least they were CRTs: many of the people I learned *from* had learned on punch cards and line printers). For a long time I was a proponent of formatting decisions that saved vertical space ([1TBS](https://en.wikipedia.org/wiki/Indentation_style#Variant:_1TBS_(OTBS)), leaving off unnecessary brackets, and so on). Even then I would sometimes print code so that I could examine it in the large.