Code Review

As a senior member you may have to review your peers code quite often. You may have a check list also with you. Here I compiled a list to enable to you to cross check with your list. You may want revert to me if anything needed additonaly to this list :)
  1. String.IsNullOrEmpty method is used instead of if (stringVariable == null stringVariable == "")
  2. No unused private method, private variables, parameters in the function
  3. static variables are initialized when it declared.
  4. lock(staticvariable) is used before modifying the values in the static variable to avoid concurrency issues.
  5. No system exception is thrown in the functions. For e.g. never ever throw, throw new Exception();
  6. General exceptions (Sytem.Exception) are not catched and the specific exceptions are handled.
  7. cultureInfo (atleast System.Globalization.CultureInfo.CurrentCulture) is passed in the ToString() methods.
  8. IDisposable is correctly implemented.
  9. No empty finalizer (constructors)
  10. Variables are not initialized with its own default values (for e.g, bool b = false, MyClass object = null) which will be handled by the .net runtime.
  11. There is no unused local variables in the functions.
  12. The same object is not casted multiple times in the same method. (For e.g. when you DataContext to bind an object, developer might quite frequently cast the DataContext object in a method)
  13. Methods not using the member variable or instance methods, are declared as static.
  14. Properties are not returning array (If so, it should be corrected to use Collections)
  15. Enum declaration contains atleast one '0' value (None)
  16. No Empty Class and Interfaces used. If empty interfaces need to differentiate the object type (some times!!!), then use attributes.
  17. Exceptions are not re-thrown, instead only throw is used
  18. Classes are correctly suffixed (for e.g. Exception (customer exception class), Attribute (custom attribute class), EventArgs, Stream etc..)
  19. Obviously the naming conventions as you already aware :)
  20. No infinite thread situation in recursive methods (implement watch dog applications)

No comments:

Post a Comment