Tuesday, September 8, 2009

Design and Code Review Checklist

I have been blogging about some of the principles I use in design/code reviews reviews.  Here is the full list of topics I look for, I’ll create links as I blog about more individual items in the future.

  • Review Unit Tests
  • Is the code in the right place?
  • Does the name space make sense? http://blogs.msdn.com/brada/articles/361363.aspx
  • Is the class / procedure / variable scope correct.
  • Are the Classes, methods, and variables named correctly? http://blogs.msdn.com/brada/articles/361363.aspx
  • Are the methods, and variables typed correctly?
  • Look at the code.
  • Review for OCP  (open closed principle - Open for extension closed for modification)
  • Review for DRY Principle (Don't Repeat Yourself - abstract common things and put in single place).
  • Review for SRP (Single Responsibility Principle - every object has a single responsibility. All the object's services should be focused on that responsibility).
  • Review for LSP (Liskov Substitution Principle Subtypes must be substitutable for their base types).
  • Consider delegation over inheritance. If you don't need to change base class behavior, consider delegating (handing over responsibility of a task) rather than inheritance.
  • Consider Composition over inheritance. Similar to delegation except the owner class uses a set of behaviors and chooses which one to use at runtime. When the delegating class is destroyed, so are all the child classes.
  • Aggregation. Similar to composition except when the delegating class is destroyed, the child classes are not.
  • Consider Polymorphism. Make a group of heterogeneous classes look homogeneous
  • Consider generics.
  • Testability considerations?
  • YAGNI (You aint gonna need it) When in doubt, leave it out!
  • Does object wake up in a known good state (constructor)
  • Consider Security.

 

No comments:

Post a Comment