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

Remove inverted logic #9

Open
ValdasK opened this issue Oct 1, 2015 · 3 comments
Open

Remove inverted logic #9

ValdasK opened this issue Oct 1, 2015 · 3 comments

Comments

@ValdasK
Copy link

ValdasK commented Oct 1, 2015

Get rid of all inverted logic in controllers, where returns happen in case of failure, not success.

Current implementation requires code duplication and is prone to errors.

@l3pp4rd
Copy link
Member

l3pp4rd commented Oct 1, 2015

I do not see anything evil here, preventing nested if statements in deep levels is less complex in my opinion.. if I understand correctly the issue stated

@ValdasK
Copy link
Author

ValdasK commented Oct 1, 2015

If view you are rendering requires multiple parameters, controllers have plenty of duplication.

White-listing is easier to maintain than black-listing, because undefined cases default to error instead of success.

@l3pp4rd
Copy link
Member

l3pp4rd commented Oct 1, 2015

My point is that nesting if statements increases complexity and that is a fact. I cannot agree that it would be less complex otherwise. if your code needs more parameters, rearrange it the way you want.
Repeating code in most of the cases, does not increase complexity. Instead DRY sometimes also increases complexity. Making easy instead of making it simple increases complexity, not other way around

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants