continuous code quality improvement

20
Copyright © 2001-2006 Infor Global Soluti ons Infor Confidential Continuous Code Quality Improvement --Tools & Process Navigator, 10-Oct-06

Upload: ocean-dong

Post on 06-May-2015

955 views

Category:

Documents


2 download

TRANSCRIPT

Copyright © 2001-2006 Infor Global SolutionsInfor Confidential

Continuous Code Quality Improvement --Tools & Process

Navigator, 10-Oct-06

2 Copyright © 2001-2006 Infor Global Solutions

Yesterday

Better?

3 Copyright © 2001-2006 Infor Global Solutions

Today

Better!

Continuous Code Quality Improvement

Tools & Process

4 Copyright © 2001-2006 Infor Global Solutions

Tools Summary

Code Quality

Coding Standard

Comment Unit Test

Others…

Fxcop

NcoverNdoc

5 Copyright © 2001-2006 Infor Global Solutions

Tools: Fxcop

Coding Standard Examples Don’t declare visible instance fields Pass base type as parameters Nested type should not be visible

Rule One rule to one coding standard

Fxcop Check code according to rules Rules container Plugable

Introduction

6 Copyright © 2001-2006 Infor Global Solutions

Tools: Fxcop

Our Company’s Coding Standard Method must begin with upper case Const values should never be public Must log an exception as soon as it’s caught

Extended Rule Implement a small set of Rule API Use Fxcop’s Introspection Engine

Extension

7 Copyright © 2001-2006 Infor Global Solutions

Tools: NCover

Accurate unit test coverage Clear indication of where to enhance unit test

Requirement

We expect

We need

An actual and clear statistics like this:MethodName UnitTest CoverageFMDDesignerController.Constructor 100.00%FMDDesignerController.EditNavigatorItems 100.00%FMDDesignerController.CreateNavigatorModel 100.00%FMDDesignerController.SaveNavigatorModel 60.00%FMDDesignerController.SaveItemProperty 0.00%

8 Copyright © 2001-2006 Infor Global Solutions

Tools: NCover

Introduction

Code coverage A measure for software testing

NCover A code coverage tool for .NET

ClassName Code CoverageClassA 30%ClassB 100%ClassC 0%

9 Copyright © 2001-2006 Infor Global Solutions

Tools: NCover

Practice

Extension: NCoverEx Multiple execute in a loop for single assembly Reformat to statistic table and filter output for non-private methods

10 Copyright © 2001-2006 Infor Global Solutions

Tools: NDoc

Complete and clear comments

A statistics of missing common comments Class Declaration Method Declaration

A statistics of missing special comments Whether a parameter or returned value could possibly be null Whether a parameter or returned value could possibly be empty if it is

string type Whether a parameter or returned value could possibly be empty if it is

collection type

Requirement

11 Copyright © 2001-2006 Infor Global Solutions

Tools: NDoc

About Ndoc Generates Documentation for .NET Code Multiple Doc Formats Support Open-Source

Extension

Practice

12 Copyright © 2001-2006 Infor Global Solutions

Process Summary

Fix & Update Status

Discuss

Washup Items

ClaimPublish

Check

13 Copyright © 2001-2006 Infor Global Solutions

Process: Check

One Master for Each Tool

Every Week

Two Phase Phase1 – Partial and Incremental

Fxcop - Sort rules by message level NCover - Missing test classes; Missing test methods NDoc - Fixed count for each component

Phase2 – Select All

14 Copyright © 2001-2006 Infor Global Solutions

Process: Publish & Claim

Uniform Excel Output

Claim Items ASAP by Self Generally by Component Ownership by Primitive Authorship

15 Copyright © 2001-2006 Infor Global Solutions

Process: Fix & Update Status

Must finish by weekend

Fit into daily work by each self freely

Get help or change ownership if necessary

Exclude with reasons

16 Copyright © 2001-2006 Infor Global Solutions

Process: Discuss

Discuss

•On Demand

•After publishing, fix&update, or anytime else

•Lightweight

•Discuss Fxcop rules

•Discuss difficulty in writing unit tests

•Discuss comment standard

•Discuss how to further extend Fxcop/Ndoc/NCover

17 Copyright © 2001-2006 Infor Global Solutions

Conclusion

Yesterday Today

Frequency An Iteration (6 weeks) 1 week

Check Mistakes Manually,

Time-cost,

Limited Results

Auto,

Quick,

All Results by Tools

Fix Mistakes Limited Corrections,

No Review and Track

All Corrected,

Easy to Review&Track

Work Focus Find Mistakes Find/Develop Better Tools and Process

Funny No Yes

18 Copyright © 2001-2006 Infor Global Solutions

Limits

Work Load of Tool Extension

Class TestClass

MethodA

MethodB

TestMethod1

TestMethod2

TestMethod3

More Accurate Unit Test Coverage

Measure & Check of Software Design

19 Copyright © 2001-2006 Infor Global Solutions

Tomorrow

From Weekly To Daily Easy to Append Missing Comments and Unit Test Methods Keep Few Mistakes All Along Ultimately Test-Driven Realized

Big Rule Repository

More and Smarter Tools

20 Copyright © 2001-2006 Infor Global Solutions

Thanks