Continuous Code Quality Improvement


Published on

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Continuous Code Quality Improvement

  1. 1. Continuous Code Quality Improvement --Tools & Process Navigator, 10-Oct-06
  2. 2. Yesterday Better?
  3. 3. Today Better! Continuous Code Quality Improvement Tools & Process
  4. 4. Tools Summary Code Quality Coding Standard Comment Unit Test Others… Fxcop Ncover Ndoc
  5. 5. Tools: Fxcop <ul><li>Coding Standard Examples </li></ul><ul><ul><li>Don’t declare visible instance fields </li></ul></ul><ul><ul><li>Pass base type as parameters </li></ul></ul><ul><ul><li>Nested type should not be visible </li></ul></ul><ul><li>Rule </li></ul><ul><ul><li>One rule to one coding standard </li></ul></ul><ul><li>Fxcop </li></ul><ul><ul><li>Check code according to rules </li></ul></ul><ul><ul><li>Rules container </li></ul></ul><ul><ul><li>Plugable </li></ul></ul>Introduction
  6. 6. Tools: Fxcop <ul><li>Our Company’s Coding Standard </li></ul><ul><ul><li>Method must begin with upper case </li></ul></ul><ul><ul><li>Const values should never be public </li></ul></ul><ul><ul><li>Must log an exception as soon as it’s caught </li></ul></ul><ul><li>Extended Rule </li></ul><ul><ul><li>Implement a small set of Rule API </li></ul></ul><ul><ul><li>Use Fxcop’s Introspection Engine </li></ul></ul>Extension
  7. 7. Tools: NCover <ul><li>Accurate unit test coverage </li></ul><ul><li>Clear indication of where to enhance unit test </li></ul><ul><ul><li>Requirement </li></ul></ul>We expect We need <ul><li>An actual and clear statistics like this: </li></ul>
  8. 8. Tools: NCover <ul><ul><li>Introduction </li></ul></ul>Code coverage <ul><li>A measure for software testing </li></ul>NCover <ul><li>A code coverage tool for .NET </li></ul>
  9. 9. Tools: NCover <ul><ul><li>Practice </li></ul></ul>Extension: NCoverEx <ul><li>Multiple execute in a loop for single assembly </li></ul><ul><li>Reformat to statistic table and filter output for non-private methods </li></ul>
  10. 10. Tools: NDoc <ul><li>Complete and clear comments </li></ul><ul><li>A statistics of missing common comments </li></ul><ul><ul><li>Class Declaration </li></ul></ul><ul><ul><li>Method Declaration </li></ul></ul><ul><li>A statistics of missing special comments </li></ul><ul><ul><li>Whether a parameter or returned value could possibly be null </li></ul></ul><ul><ul><li>Whether a parameter or returned value could possibly be empty if it is string type </li></ul></ul><ul><ul><li>Whether a parameter or returned value could possibly be empty if it is collection type </li></ul></ul>Requirement
  11. 11. Tools: NDoc <ul><li>About Ndoc </li></ul><ul><ul><li>Generates Documentation for .NET Code </li></ul></ul><ul><ul><li>Multiple Doc Formats Support </li></ul></ul><ul><ul><li>Open-Source </li></ul></ul><ul><li>Extension </li></ul>Practice
  12. 12. Process Summary Fix & Update Status Discuss Washup Items Claim Publish Check
  13. 13. Process: Check <ul><li>One Master for Each Tool </li></ul><ul><li>Every Week </li></ul><ul><li>Two Phase </li></ul><ul><ul><li>Phase1 – Partial and Incremental </li></ul></ul><ul><ul><ul><li>Fxcop - Sort rules by message level </li></ul></ul></ul><ul><ul><ul><li>NCover - Missing test classes; Missing test methods </li></ul></ul></ul><ul><ul><ul><li>NDoc - Fixed count for each component </li></ul></ul></ul><ul><ul><li>Phase2 – Select All </li></ul></ul>
  14. 14. Process: Publish & Claim <ul><li>Uniform Excel Output </li></ul><ul><li>Claim Items </li></ul><ul><ul><li>ASAP by Self </li></ul></ul><ul><ul><li>Generally by Component Ownership </li></ul></ul><ul><ul><li>by Primitive Authorship </li></ul></ul>
  15. 15. Process: Fix & Update Status <ul><li>Must finish by weekend </li></ul><ul><li>Fit into daily work by each self freely </li></ul><ul><li>Get help or change ownership if necessary </li></ul><ul><li>Exclude with reasons </li></ul>
  16. 16. Process: Discuss Discuss <ul><li>On Demand </li></ul><ul><ul><li>After publishing, fix&update, or anytime else </li></ul></ul><ul><li>Lightweight </li></ul><ul><ul><li>Discuss Fxcop rules </li></ul></ul><ul><ul><li>Discuss difficulty in writing unit tests </li></ul></ul><ul><ul><li>Discuss comment standard </li></ul></ul><ul><ul><li>Discuss how to further extend Fxcop/Ndoc/NCover </li></ul></ul>
  17. 17. Conclusion Yes No Funny Find/Develop Better Tools and Process Find Mistakes Work Focus All Corrected, Easy to Review&Track Limited Corrections, No Review and Track Fix Mistakes Auto, Quick, All Results by Tools Manually, Time-cost, Limited Results Check Mistakes 1 week An Iteration (6 weeks) Frequency Today Yesterday
  18. 18. Limits Work Load of Tool Extension Measure & Check of Software Design Class TestClass MethodA MethodB TestMethod1 TestMethod2 TestMethod3 More Accurate Unit Test Coverage
  19. 19. Tomorrow <ul><li>From Weekly To Daily </li></ul><ul><ul><li>Easy to Append Missing Comments and Unit Test Methods </li></ul></ul><ul><ul><li>Keep Few Mistakes All Along </li></ul></ul><ul><ul><li>Ultimately Test-Driven Realized </li></ul></ul><ul><li>Big Rule Repository </li></ul><ul><li>More and Smarter Tools </li></ul>
  20. 20. Thanks