Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule 5.1.2 Avoid deep nesting of function code blocks. It should be limited to 4 levels #336

Closed
kentr0w opened this issue Sep 29, 2020 · 0 comments · Fixed by #348
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kentr0w
Copy link
Collaborator

kentr0w commented Sep 29, 2020

The nesting depth of the code block of a function is the depth of mutual inclusion between the code control blocks in the function (for example: if, for, while, when, etc.). Each level of nesting will increase the mental effort when reading code, because you need to maintain a current "stack" in your mind (for example, entering conditional statements, entering loops, etc.). Exception: The nesting levels of lambda expressions, local classes, and anonymous classes in functions are calculated based on the innermost function, and the nesting levels of enclosing methods are not accumulated. To avoid a confusion of code readers functional decomposition should be done. This will help reader to switch between context.

@kentr0w kentr0w added the enhancement New feature or request label Sep 29, 2020
@kentr0w kentr0w self-assigned this Sep 29, 2020
@petertrr petertrr added this to the Chapter 5 milestone Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants