Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [code-metrics]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
7 votes
6 answers
512 views

Is there a software quality metric related to side effects?

In large systems there are often code paths that modify state or produce side effects that other code comes to depend on. This makes it hard to safely change code without understanding the whole ...
Sam's user avatar
  • 461
0 votes
3 answers
269 views

Number of lines of code executed per line of code: Are there significant differences per language? [closed]

Having fewer lines of code per feature is typically better as it increases the developer productivity. Did anyone ever measure the number of code lines executions per line of code across multiple ...
Sebastian Wagner's user avatar
1 vote
1 answer
199 views

counting identifiers and operators as code size metric

I'm looking for a code metric for monitor and track over time the size of several projects and their components. Also, I would like to use it for: evaluate size reduction after refactoring compare ...
Guish's user avatar
  • 23
-1 votes
1 answer
432 views

What exactly are the Operators and Operands in Halstead Metrics?

Can anybody point me to the official source where it is explained what are operators and operands in Halstead Metrics for code, I would prefer the original paper by Halstead. Please don't post the ...
Prashant's user avatar
4 votes
2 answers
1k views

Summing cyclomatic complexity of function or files

Is the sum of the cyclomatic complexity of all section in a file the total cyclomatic complexity for this file? If it is, is the sum of a set of related files the total cyclomatic complexity for this ...
cervh's user avatar
  • 83
1 vote
2 answers
200 views

Class Divisibility Metric

A few years ago I was using Sonar (before it was SonarQube) to analyze some Java code, and I remember seeing a useful metric that would come in handy again today. However it does not appear to be ...
Jim Kiley's user avatar
  • 191
0 votes
4 answers
720 views

How to prove business benefit in software refactoring? [duplicate]

By these days I work in a legacy code that uses JAVA. The project has a code tightly coupled and low cohesion. All my teammates suffer to make changes in the software, one reason is that we haven't ...
Lucas Fantacucci's user avatar
0 votes
2 answers
2k views

Relation between LOC and Cyclomatic Complexity

Is there something that ratio of the metrics LOC and Sum Cyclomatic Complexity in a project with many modules can talk about? Does it show the logical complexity of a module/project?
Christy Wald's user avatar
0 votes
2 answers
1k views

When should I care about code metrics in Visual Studio?

Occasionally I look at the code metrics in visual studio for my solution. I don't ever see anything I would find alarming. My maintainability is usually pretty high with exception to some obvious ...
Shelby115's user avatar
  • 465
2 votes
1 answer
5k views

how to measure defects per KLOC

I have been reading on the internet about the metric "number of bugs per 1000 lines of code" and what would be a good number. However, I wonder how someone would compute such a metric? The reason a ...
icehawk's user avatar
  • 183
6 votes
3 answers
7k views

How to calculate Cyclomatic Complexity exactly?

My question is more about the transformation from programming code to control flow graph. Say, I have a piece of code: public class Contractor { // other member fields... private bool ...
VincentZHANG's user avatar
2 votes
1 answer
5k views

WMC Calculation in CK Metrics Suite

I have two classes C1 and C2. C1 has 2 methods and C2 has 3 methods each of complexity value 1. C2 inherits from C1. So, I know C2 has 2+3=5 methods in all. The question is, should I take C2 to have 5 ...
omeganebula's user avatar
7 votes
5 answers
3k views

Is measuring the binary size of a c++ program a good indication of code complexity? Or something else?

In my company we have this obligatory practice before a review to be send the binary size impact of the code change to be measured and provided. We must use -Os for this metric to avoid ...
gsf's user avatar
  • 274
3 votes
2 answers
2k views

Why in cyclomatic complexity we add 1 for operators within a condition?

I know that basically, CC can be computed as number of decision + 1. In addition, every logical operator in the condition causes CC to increase by 1. But why? Having the code if(A || B || C) else... ...
user144171's user avatar
0 votes
2 answers
293 views

Finding metrics for development time in different languages [closed]

I'm trying to determine if a language I'm investigating (Groovy) is better for developing enterprise applications than our current language (Java). Specifically I'm trying to figure out if it will ...
Jae Carr's user avatar
  • 231
2 votes
2 answers
237 views

According to software engineering which method are too long? [closed]

I was just working with a method of about 70 lines of code developed by others. It uses a very nice pattern structure, stuff like IOC container, but I wonder.. The method is too long? Is it a so long ...
M.F05051985's user avatar
0 votes
4 answers
505 views

Are there metrics, like in other professions, that can be used to measure whether a programmer is considered experienced? [closed]

Driving instructors (at leas in Germany) often mention 100.000 km driven as a reference point where a driver is considered experienced. Is there a similar number for programmers? For example, how many ...
Tim Bodeit's user avatar
1 vote
2 answers
3k views

Relation between " lines of the longest working program " in a language and familiarity with it? [closed]

In some computer master program online application, it says: Please list the programming languages in which you have written programs. For each language, indicate the length in lines of the ...
Tim's user avatar
  • 5,485
1 vote
1 answer
287 views

Estimated errors in implementation comparison

I've been working on improving an existing library to be more maintainable after trying to implement a feature I wanted and found the code to be hard to alter. The library is a node.js grunt plugin ...
Jacob's user avatar
  • 189
6 votes
1 answer
5k views

What does the "4" in LCOM4 mean?

I know that methods in a class should have high cohesion which roughly translates to having all the methods use all the instance variables directly or indirectly. I know that LCOM4 (Lack of cohesion)...
Geek's user avatar
  • 5,197
4 votes
2 answers
256 views

Strategies for using a code metric evaluation tool

Should code quality metric evaluation tools like Sonar be integrated with IDE for running local analysis or should they be a part of the build process (like integrated with maven) for continuous ...
Geek's user avatar
  • 5,197
18 votes
4 answers
5k views

Source code metrics for measuring code stability?

Considering how software is developed during a release cycle (implementation, testing, bug fixing, release) I was thinking that one should be able to see some pattern in the lines of code that are ...
Giorgio's user avatar
  • 19.7k
0 votes
3 answers
1k views

Is the number of bugs in a section of code proportional to the # of lines ? The square of the # of lines ?

Are there any studies that aggregate data over a wide population of contributed code, that establish a correlation between amount of code written in a commit and the # of bugs discovered in that code ?...
Dean Radcliffe's user avatar
9 votes
2 answers
5k views

How is technical debt best measured? What metric(s) are most useful? [duplicate]

Possible Duplicate: How can I quantify the amount of technical debt that exists in a project? If I wanted to help a customer understand the degree of technical debt in his application, what would ...
throp's user avatar
  • 199
36 votes
2 answers
17k views

Are There Metrics For Cohesion And Coupling?

Is there a metric analogous to the McCabe Complexity measure to measure how cohesive a routine is and also how loosely (or tightly) coupled the routine is to other code in the same code base?
Onorio Catenacci's user avatar
22 votes
4 answers
5k views

Experiments correlating code metrics to bug density

I'm wondering if someone has done some experiments correlating code metrics (SLOC, Cyclomatic Complexity, etc) with bug density in Object Oriented applications. I'm not looking for experiments that ...
Augusto's user avatar
  • 1,022
73 votes
12 answers
20k views

How can I quantify the amount of technical debt that exists in a project?

Does anyone know if there is some kind of tool to put a number on technical debt of a code base, as a kind of code metric? If not, is anyone aware of an algorithm or set of heuristics for it? If ...
Erik Dietrich's user avatar
17 votes
3 answers
539 views

Is there a correlation between complexity and reachability?

I've been studying cyclomatic complexity (McCabe) and reachability of software at uni recently. Today my lecturer said that there's no correlation between the two metrics, but is this really the case? ...
Saladin Akara's user avatar
11 votes
4 answers
4k views

Does it make sense to compute cyclomatic complexity/lines of code ratio?

In general, maintainability index relies on many factors. For example, in Visual Studio, it rely on cyclomatic complexity, depth of inheritance, class coupling and lines of code; those four values ...
Arseni Mourzenko's user avatar
351 votes
6 answers
29k views

What is negative code?

I was reading the Wikipedia article on Douglas McIlroy and found a quote that mentions "The real hero of programming is the one who writes negative code." What does that mean?
user avatar