Technical Debt Calculator

Recently I have read an article finding out that the cost of technical debt can be computed, so yesterday I've written an article to show the conclusions from that article. Main conclusion, the cost of technical is on average of 3.61$ per line of code.

You can read the whole article regarding the study that concludes that here

Further digging through the internet, I found this open source plugin for sonar (which is also open source) that computes technical debt based on several assumptions.

The algorithm to compute the cost of technical debt can be found on the above url of that plugin.

They are basing their calculations with the following defaults (costs are expressed man hour):

  • cost_to_fix_one_block 2
  • cost_to fix_one_violation 0.1
  • cost_to_comment_one_API 0.2
  • cost_to_cover_one_of_complexity 0.2
  • cost_to_split_a_method 0.5
  • cost_to_split_a_class 8
  • cost_to_cut_an_edge_between_two_files 4


All of the above facts can generate by themselves a huge amount of debate.

I am not writing this post in order to start a flame war, but rather to see the value that such calculations might bring to our community and how we could manage to have such tools in our toolchain.

One approach is to write a plugin for the Sonar platform that would interpret Perl code.
I don't quite like this idea because it's not the perlish way.

Another approach is to extend the Perl::Critic module in order to put a cost on each violation.
Taking into consideration the vast amount of violations testable by Perl::Critic and auxiliary great modules like Devel::Cover, Pod::Coverage and the rest of CPAN modules from this kind of suite, I think we can build a toolset that will offer a much clear vision regarding code quality, expressed in money.

Going further, if I'd have such a tool, I'd be willing to proudly show the cost of technical debt that my (future) modules comes along with, straight on the meta/cpan site.
We could write a plugin for Ohloh that would show the world the technical debt cost for Perl projects.

Letting my fantasy go wild, I can think of Achievements in terms of Perl::Achievementscontext awarded based on technical debt cuts.

So, first steps first, I want to ask if we have some people willing to modify the Perl::Critic in order to have the cost attached to violations - I am sure there are gazillions of you guys much much better accustomed to Perl::Critic than I am.

Your thoughts and comments are more than welcome !!
And your involvement much much appreciated

1 Comment

That sounds like technical debt is quite a deal in some situations.

Leave a comment

About Tudor Constantin

user-pic Perl Is My Cocaine