Effective Code Review


Published on

Published in: Technology

Effective Code Review

  1. 1. Code Review<br />Principles<br />http://www.flickr.com/photos/sebastian_bergmann/3991540987/<br />
  2. 2. Important Observation<br />Time Restrictions<br />http://www.flickr.com/photos/mike-bensalem/3023717032/<br />
  3. 3. Psychological Barrier - I<br />Hard to concentrate<br />Focusing for more than <br />a few dozens of minutes<br />without any recession<br />is hardly possible<br />http://www.flickr.com/photos/txd/2681183845/<br />
  4. 4. Psychological Barrier - II<br />Hard to understand<br />To read and to interpret<br />somebody else’s logic (code)<br />http://www.flickr.com/photos/dhammza/91435718/<br />
  5. 5. Effective Code Review<br />How?<br />Descriptive Abstract<br />Focus<br />Top-Down Overview<br />Bottom-Up Review<br />Read & Communicate<br />“Drive” the code<br />“Understand” the code<br />Search for: <br />Code Smells<br />Violations of OOD and OOP<br />Violations of Code Conventions<br />Comprehension<br />
  6. 6. Descriptive Abstract<br />http://www.flickr.com/photos/sskennel/2330323726/<br />Short Explanations<br />Teach and Mentor<br />
  7. 7. Focus<br />Focus on Problematic Issues<br />Couldn’t <br />Make It Straight<br />http://www.flickr.com/photos/horiavarlan/4259933101<br />
  8. 8. Top Down Overview<br />Get High Level Overview<br />Sketches<br />White Board<br />High Level Class Diagram<br />Read (a few) Unit Tests<br />http://www.nasa.gov/multimedia/imagegallery/image_feature_526.html<br /> NASA <br />
  9. 9. Bottom Up Review<br />Continue to review the Code<br />Review Unit Tests<br />Review Classes & Methods<br />Think about Missing<br />Unit Tests<br />http://www.nasa.gov/multimedia/imagegallery/image_feature_649.html<br />NASA/CXC/UMass Amherst/Q.D.Wang et al <br />
  10. 10. Drive the Code<br />Take Initiative<br />Become a “Driver”<br />Is it easy to Drive?<br />Pair Programming<br />Techniques<br />http://www.flickr.com/photos/pmarkham/3652471231/<br />
  11. 11. Understand the Code (Logic)<br />http://www.flickr.com/photos/apperceive/3351889502/<br />Read, Read, Read<br />Do you understand?<br />
  12. 12. Communicate<br />Read the Code Loudly<br />Ask Questions<br />Think Loudly<br />http://www.flickr.com/photos/apperceive/3351889502/<br />
  13. 13. Code Smells & OO Violations<br />S.O.L.I.D<br />http://www.flickr.com/photos/katerha/4526272937/<br />Long Methods<br />Unreadable<br />Hard to maintain<br />http://www.flickr.com/photos/king-edward/2266814656/<br />Duplicate Code<br />Binding to Implementation<br />Encapsulation Violations<br />
  14. 14. Fix It<br />http://www.flickr.com/photos/justinbaeder/183930977/<br />The “Navigator” takes Comments<br />and makes fixes later<br />Pair Programming<br />Techniques<br />