MS の Visual Studio にはメンテナンスしやすさを表す Maintainability Index という 0~100までの値をとるメトリクスががあり、20以上でであれば良好、10台であればほどほど、9以下だとメンテナビリティが低いことを表すということになっています。
Maintainability Index – Calculates an index value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability. Color coded ratings can be used to quickly identify trouble spots in your code. A green rating is between 20 and 100 and indicates that the code has good maintainability. A yellow rating is between 10 and 19 and indicates that the code is moderately maintainable. A red rating is a rating between 0 and 9 and indicates low maintainability.
最近までこの算出方法を知らなかったのですが、下記のようなちょっと面白い式になっているようです。
Maintainability Index = 171 - 5.2 * ln(Halstead Volume) - 0.23 * (Cyclomatic Complexity) - 16.2 * ln(Lines of Code)*1
この式は CMU SEI のMaintainability Index Technique for Measuring Program Maintainability*2 からもたらされたもので、履歴を見ると 97年ごろからある伝統的なものみたいですね。まだこれは読んだことがなかったので、今度読んでみようと思います。
このエントリへのTrackbackにはこのURLが必要です→https://blog.cles.jp/item/7979
コメントは承認後の表示となります。
OpenIDでログインすると、即時に公開されます。
OpenID を使ってログインすることができます。