A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 年之前
12345678910111213141516
  1. title: Maslow's pyramid of code review
  2. url: http://blog.d3in.org/post/111338685456/maslows-pyramid-of-code-review
  3. hash_url: b6f259d122890a04a89b658b364f62cd
  4. <p><img src="https://36.media.tumblr.com/72e7200921159a4374b7fc163fe0f6f2/tumblr_njwlh7rZui1qgj0nao1_400.png" alt=""/></p>
  5. <p>As in Maslow’s pyramid, each layer requires the previous one. It is useless for code that is charging the wrong customer to be readable.</p>
  6. <p>Code should be:</p>
  7. <ul><li><strong>Correct</strong>: does the code do what it’s supposed to? Does it handle edge cases? Is it adequately tested to make sure that it stays correct even when other engineers modify it? Is it performant enough for this use case?</li>
  8. <li><strong>Secure</strong>: does the code have vulnerabilities? Is the data stored safely? Is personal identification information (PII) handled correctly? Could the code be used to induce a DOS? Is input validation comprehensive enough?</li>
  9. <li><strong>Readable</strong>: is the code easy to read and comprehend? Does it make clear what the business requirements are (code is written to be read by a human, not by a computer)? Are tests concise enough? Are variables, functions and classes named appropriately? Do the domain models cleanly map the real world to reduce cognitive load? Does it use consistent coding convention?</li>
  10. <li><strong>Elegant</strong>: does the code leverage well-known patterns? Does it achieve what it needs to do without sacrificing simplicity and conciseness? Would you be excited to work in this code? Would you be proud of this code?</li>
  11. <li><strong>Altruist</strong>: does the code leave the codebase better than what it was? Does it inspire other engineers to improve their code as well? Is it cleaning up unused code, improving documentation, introducing better patterns through small-scale refactoring?</li>
  12. </ul><p><em>Update Feb 18th</em>: there’s some great comments on <a href="https://www.reddit.com/r/programming/comments/2wau2x/maslows_pyramid_of_code_review/">reddit</a> about this. I removed the notion of large refactor because I think small refactors have a higher probability of success. I also added a comment about why layering matters.</p>