Imzy
  • Discover communities
  • Log In
  • Sign up
  • Home
  • Discover communities
  • Log In
  • Sign up
  • About
  • Learn More
  • Contact
  • Community Policy
  • FAQ
  • Sitemap
  • Terms
  • Privacy Policy
  • Available on the App Store
  • Available on Google Play
Copyright © 2017 Saurus, Inc. All rights reserved.
programming

programming

All things programming - language and framework agnostic.

743 members
Posted byJackTheFlyingin/programming-Nov 03, 2016 at 12:56 AM

Applying the Linus Torvalds “Good Taste” Coding Requirement

Applying the Linus Torvalds "Good Taste" Coding Requirement

To the best of my ability to discern, the crux of the "good taste" requirement is the elimination of edge cases, which tend to reveal themselves as conditional statements. The fewer conditions you test for, the better your code " tastes". Here is one particular example of an improvement I made that I wanted to share.

bartobri
One comment
  • syrrimNov 16, 2016 at 11:43 PM

    The improvement here is that the code has less paths to travel down. Therefore there are less edge cases, and it becomes easier to comprehend.

    I think the highlight is perhaps overreaching though: "The fewer conditions you test for, the better your code 'tastes'". Your code should, in general, explain your logic and thinking. There are very few situations where the speedup caused by removing a conditional is noticeable. Therefore, you should code for ease of understanding - by yourself, and whoever comes after. If the code works, but you don't understand it, or someone else would have to think hard to get it, then that is bad code.

programming

programming

All things programming - language and framework agnostic.

743 members
  • About
  • Sitemap
  • Terms and Conditions
  • Privacy Policy
  • Copyright © 2017 Saurus, Inc. All rights reserved.