Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do software metrics work both ways

Tags:

code-metrics

I just started working for a large company. in a recent internal audit, measuring metrics such as Cyclomatic complexity and file sizes it turned out that several modules including the one owned by my team have a very high index. so in the last week we have been all concentrating on lowering these indexes for our code. by removing decision points and splitting files.

maybe I am missing something being the new guy but, how will this make our software better?, I know that software metrics can measure how good your code is, but dose it work the other way around? will our code become better just because for example we are making a 10000 lines file into 4 2500 lines files?

like image 287
Tom Avatar asked Jan 04 '10 07:01

Tom


People also ask

What are the two types of software metrics?

Metric Classification Software metrics can be divided into two categories; product metrics and process metrics.

What is the purpose of software metrics?

Software metrics offer an assessment of the impact of decisions made during software development projects. This helps managers assess and prioritize objectives and performance goals.

Why software metrics is not widely used in industry?

We can measure all sorts of things about each of these aspects of software quality, but it is the subjective quality aspects that drive modern software development: the delivery of business value. This makes the traditional metrics largely irrelevant. They don't go away; they just fade into the background.


1 Answers

The purpose of metrics is to have more control over your project. They are not a goal on their own, but can help to increase the overall quality and/or to spot design disharmonies. Cyclomatic complexity is just one of them.

Test coverage is another one. It is however well-known that you can get high test coverage and still have a poor test suite, or the opposite, a great test suite that focus on one part of the code. The same happens for cyclomatic complexity. Consider the context of each metrics, and whether there is something to improve.

You should try to avoid accidental complexity, but if the processing has essential complexity, you code will anyway be more complicated. Try then to write mainteanble code with a fair balance between the number of methods and their size.

A great book to look at is "Object-oriented metrics in practice".

like image 57
ewernli Avatar answered Sep 20 '22 13:09

ewernli