Project #2 - Code Maintainability Analyzer

Version 1.0,
Due Date: 12:00 am, Sunday, Wk4

Purpose:

This project develops a program for quality analysis of C# code to measure the maintainablity of functions and classes. Different code metrics will be analized to generate a final maintainablity index. The Code Maintainability Analyzer computes the following metrics: size (LOC) and cyclomatic complexity for each function, and cohesion1 and coupling2 for each class in each file of a specified file set.
Size: The tool computes size in terms of the number of lines of code.
Cyclomatic Complexity: This refers to the number of independent paths in a function.
Cohesion: We are going to use one of the simplest structural cohesion metric proposed by Chidamber & Kemerer in 1991 known as lack of cohesion in methods (LCOM1). LCOM1 measures the cohesion in terms of the number of pairs of functions that do not share any data members.
Coupling: we will use this metric to measure dependency between classes. A class A depends on class B if A inherits, aggregates, composes, or uses class B. We are going to use the number of classes that one class depends on as the coupling measure for that class.
Finally the Code Maintainability Analyzer computes a maintainibility index for each class using these four metrics as:
MI=a * Size + b * Cyclomatic_Complexity + c * Cohesion + d * Coupling
The purpose of this code analysis is to find functions and classes that may need attention because of their their quality metrics. A secondary purpose is to help potential developers or managers quickly understand the structure of a set of code.

Requirements:

Your Code Maintainability Analyzer (CMA) Project:
  1. Shall be implemented in C#, using the .Net Framework. Use of a Graphical User Interface is optional, but not recommended, and may be implemented in either WinForms or Windows Presentation Foundation (WPF).
  2. Shall use Visual Studio, Community Edition available at no cost.
  3. Shall accept a specification of files using file patterns and a path from the command line.
  4. Shall provide output information that lists class names, overall maintainability index, cohesion and coupling values, function names, function sizes, and cyclomatic complexities for each class and function in each file, and a summary for all the files in the specified set.
  5. Shall provide an interface to list output based on a single metric value.
  6. Shall provide means to update coefficients used to compute the maintainability index.
  7. Shall support redirecting the output to a file.
  8. Your submission shall supply a compile.bat and run.bat file that compiles and runs your project without the user needing to specify any information, e.g., you are providing default values for path and file set. Please make those be the relative path to your project and the files that make up your project.

  1. Cohesion - Wikipedia
  2. Coupling - Wikipedia