Google Testing Blog: Code Health: Reduce Nesting, Reduce Complexity
Thanks for the article. I like the example. As a rule of thumb I'd add replace conditional with polymorphism if possible. Aren't the following 2 logical checks flipped on the exceptions they should raise? if not response.GetAuthorizedUser(): •• raise ValueError('wrong encoding') if response.GetEnc() != 'utf-8': •• raise AuthError('unauthorized') Regarding my logic flip comment lol. Disregard since I clearly see it was intentional after continuing with the artcile I recently refactored a too much nested logic check because I had the very impression it wasn't redeable. Glad to see that kind of article, I will keep this tip in mind. The one difference I would have is if error0 else if errorN else { success }. Slightly easier to immediately go, ah huh, error(s) then success paths. Thanks to less whitespace + usage of else keyword. The comments you read and contribute here belong only to the person who posted them. We reserve the right to remove off-topic comments.
Google Testing Blog: Code Health: Reduce Nesting, Reduce Complexity Testing Blog Code Health: Reduce Nesting, Reduce Complexity Monday, June 05, 2017 Google Labels: Code Health , Elliott Karpilovsky , TotT 5 comments : Unknown June 7, 2017 at 11:00:00 PM PDT Thanks for the article. I like the example. As a rule of thumb I'd add replace conditional with polymorphism if possible. Reply Delete Replies Reply Unknown June 21, 2017 at 9:41:00 AM PDT Aren't the following 2 logical checks flipped on the exceptions they should raise? if not response.GetAuthorizedUser(): •• raise
related reading
- Google Testing Blog: Code Healthtesting.googleblog.com
- Google Testing Blog: Less Is More: Principles for Simple Commentstesting.googleblog.com
- Google Testing Blog: Code Health: Too Many Comments on Your Code Reviews?testing.googleblog.com
- Google Testing Blog: Simplify Your Code: Functional Core, Imperative Shelltesting.googleblog.com
- Google Testing Blog: How Much Testing is Enough?testing.googleblog.com
- Google Testing Blogtesting.googleblog.com
- Cognitive load is what mattersminds.md
- Google Testing Blog: Testing on the Toilet: Test Behaviors, Not Methodstesting.googleblog.com
- Everything is Fertilenickcammarata.com
- Google Testing Blog: Communicate Design Tradeoffs Visuallytesting.googleblog.com
- https://danluu.comdanluu.com
- styleguide | Style guides for Google-originated open-source projectsgoogle.github.io