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

Google Testing Blog: Code Health

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

Testing Blog Code Health: Reduce Nesting, Reduce Complexity Monday, June 05, 2017 This is another post in our Code Health series. A version of this post originally appeared in Google bathrooms worldwide as a Google Testing on the Toilet episode. You can download a printer-friendly version to display in your office. By Elliott Karpilovsky Deeply nested code hurts readability and is error-prone. Try spotting the bug in the two versions of this code: Code with too much nesting Code with less nesting response = server.Call(request) if response.GetStatus() == RPC.OK: if response.GetAuthorizedUser(): if response.GetEnc() == 'utf-8': if response.GetRows(): vals = [ParseRow(r) for r in response.GetRows()] avg = sum(vals) / len(vals) return avg, vals else: raise EmptyError() else: raise AuthError('unauthorized') else: raise ValueError('wrong encoding') else: raise RpcError(response.GetStatus()) respon

Google Testing Blog: Code Health Testing Blog Code Health: Reduce Nesting, Reduce Complexity Monday, June 05, 2017  5 comments Google Labels: Code Health , Elliott Karpilovsky , TotT Code Health: Google's Internal Code Quality Efforts Monday, April 03, 2017  3 comments Google Labels: Code Health , Max Kanat-Alexander    Labels  TotT 112 GTAC 61 James Whittaker 42 Misko Hevery 32 Code Health 31 Anthony Vallone 27 Patrick Copeland 23 Jobs 18 Andrew Trenk 13 C++ 11 Patrik Höglund 8 JavaScript 7 Allen Hutchison 6 George Pirocanac 6 Zhanyong Wan 6 Har

Explore this link on the map →

saved by

related reading