flâneur — a map of the web's best reading

Google Testing Blog: Code Health: Reduce Nesting, Reduce Complexity

testing.googleblog.com · 1,355 words · saved by 1 readers

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