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
Explore this link on the map →related reading
- Google Testing Blog: Code Healthtesting.googleblog.com
- Everything is Fertilenickcammarata.com
- styleguide | Style guides for Google-originated open-source projectsgoogle.github.io
- Google Testing Blog: Less Is More: Principles for Simple Commentstesting.googleblog.com
- Hemingway Editorhemingwayapp.com
- Identifying and Correcting Programming Language Behavior Misconceptionscs.brown.edu
- Robust exception handling - Eli Bendersky's websiteeli.thegreenplace.net
- The Indytheindy.org
- GitHub - multica-ai/andrej-karpathy-skills: A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls. · GitHubgithub.com
- Writing Better Go: Lessons from 10 Code Reviews - Speaker Deckspeakerdeck.com
- Writing Better Go: Lessons from 10 Code Reviews - Speaker Deckspeakerdeck.com
- You MUST Review AI-generated Code — Vishnu's Pagesiamvishnu.com