-
Notifications
You must be signed in to change notification settings - Fork 492
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
Refactor of TryAdd method #11687
Refactor of TryAdd method #11687
Conversation
Improving the quality of the code is always welcome and avoiding nesting is something that generally speaking improves the quality of the code by making it more readable. Readability is the goal, removing nesting is just one way to achieve that. In this case the elimination of the nested blocks doesn't improves the readability but it make it worse instead. It is impossible to me at least to understand what the method does after this refactoring because of the empty semantic of |
Ok, I see what you mean @lontivero . I dialed the extraction down - the level of nesting is still reduced by two compared to the original. Do you think this approach is ok? |
I think so, yes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I would just do the following modification: https://github.com/zkSNACKs/WalletWasabi/pull/11687/files?diff=split&w=1#r1359933660
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@M1nd3r Thanks |
Hi, I am new on this project and I am not sure about the "right" process. I just saw a multiple-level nested if statements in a code I was trying to read. Thus, I have decided to refactor the code to improve readability (extract one method into four).
If extraction of methods is less preferable to nested if blocks, feel free to disregard/close this pull request.
Thanks for any feedback