Formatting - alexdaube/My-Software-Engineering-Guide GitHub Wiki
Formatting
Why?
- If the code is a mess, it usually leads to other problems. Ex: Security...
- Quality is found in the attention to details
- It is a must
- Choose a bundle of rules to properly format and always use them
Vertical Formatting
Make your code breath
- Complete idea => grouped lines represent a complete idea
- Density => Reduce the effort needed to comprehend the code
- Distance between entities =>
- Local variables => As near as possible to their use
- Member variables => Grouped at top of the class
- Methods with dependencies => Natural calling order, unless there is conceptual affinity...
Horizontal Formatting
Be uniform above all
- Spaces in the right areas
- Spaces are for separation, distinction
- Alignment
- Indentation