Quality Code Metrics: Measure it to Master it!


After over 6 months of development of our flagship Android product for E-Commerce, the ShopManager™ for OXID e-Shop, our marketing-team was surprised at the number of times the App crashed in real use-cases, in spite of our technicians’ best efforts to make stable releases.

We were running high on development cost of the product, and low on time for taking the product to the market. There was a dreaded desperation in the product-team, to fix it’s quality problems, not knowing quite which end of the beast to exactly start from!

At this time, we decided to take a structured approach to breaking down the product’s quality problems, which lo and behold, stemmed from an ambitious feature-plan that had to be accomplished in limited time, on the way introducing a huge amount of technical debt.

We started to measure the most significant metrics using formal static-code-analysis methods and tools, primarily focusing on:

  1. Blocking, Critical and Major code-deficiencies
  2. Technical Debt (in % of total code produced)
  3. Code-Complexity
  4. Lines of Code-Duplications

In addition, we decided to chase a couple of soft-goals (for the time being):

  1. Reduce number of lines of code
  2. Increase the comments-to-code ratio

We dedicated all the developers in the product-team to the single goal of improving these metrics. Our target was to achieve 0 Blocking, 0 Critical and 0 Major issues, 1% Technical-Debt and 1% Code-Duplication**.
The results were amazing.

Within 2 weeks, the product started to show visible signs of stability. Beta users started to give positive feedback. Code-metrics were starting to look acceptable, and to the date of this note stood at 0.8% Technical Debt (down from 7.3%), 1.1% Code-Duplication (down from 16.5%) and 0 critical-issues (down from 15), as also a small drop in the total lines-of-code.

The ShopManager™ product-team now takes great pride in having solved a relatively big quality problem in a methodical fashion, resting-assured that the learnings will be transferred to new Apps we shall be developing in future.

On the subjects of quality & product-perfection you are never really done. We are committed to developing a deeper understanding of Code-Complexity and mark it as the next metric to master. Similarly the ShopManager™ product-team is inspired to compare this product’s code-metrics with the most used Androids Apps, such as Firefox for Android.

Join us!

The topic of static-code-analysis will be discussed at the PHP-Usergroup-Stuttgart on 10.02. If you’d like to be there, here’s where to register!