Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Visual Studio Code Metrics


Published on

Published in: Technology
  • Be the first to comment

Visual Studio Code Metrics

  1. 1. Code MetricsWhat are they?Why should I care?Lines of Code (LOC)Cyclomatic ComplexityClass Coupling / Coupling Between Objects (CBO)Depth of Inheritance Tree (DIT)Maintainability IndexUsing the Tool Window
  2. 2. What are they?“[…]a measure of some property of a piece of softwareor its specifications […]”“[…] a set of software measures […]”
  3. 3. Why should I care?Find those areas that are (statistically) more likely toproduce problemsDetermine where to focus limited resourcesUnderstand the current state of a solution / projectKeep track of where we have been and where we aregoing
  4. 4. Lines of Code (LOC)Basic Info Raw count of IL lines Not a good measure by itselfStats N/A when used aloneCode Analysis N/A
  5. 5. Cyclomatic ComplexityBasic Info Count of decisions More decisions means more errors Used often with LOCStats 10 Suggested upper limitCode Analysis CA1502 Avoid excessive complexity 25
  6. 6. Depth of Inheritance (DIT)Basic Info The maximum length from the node to the root of the inheritance tree Three assumptions Deeper == harder to predict behavior Deeper == greater design complexity Deeper == more reuse of codeStats Low Less complex Less reuse of code High More complex More reuse of code 5 or 6 for upper limitCode Analysis CA1501 Avoid excessive inheritance 4 OOD_ChidamberKemerer94.pdf
  7. 7. Class Coupling /Coupling Between Objects (CBO)Basic Info Number of classes a single class usesStats 9 Upper limitCode Analysis CA1506 Avoid excessive class coupling 80 for class 30 for method Kemerer94.pdf
  8. 8. Maintainability IndexBasic Info Calculates an index value between 0 and 100 that represents the relative ease of maintaining the codeStats High == good Low == bad Ratings Green (20 – 100) Yellow (10 – 19) Red (0 – 9)Code Analysis CA1505 Avoid unmaintainable code 19 or lower
  9. 9. Using the Tool Window