Page 3 of 26

Code Churn: post-release defect elimination

Among numerous metrics on code evaluation (like CRAP index) in product lifecycle, code churn seems to be the one to look for while dealing with post-release and legacy code elimination.

Code churn helps you to evaluate file changes across builds.

 Code churn is a good predictor of post-release defects. Thus, it’s a warning sign if you approach a deadline while your code churn increases. That’s a sign that the code gets more and more volatile the closer you get to your deadline. You want the opposite. You want to stabilise more and more code the closer you get to delivery.


Code Churn features

One of the features of code churn – is bottleneck finding across developers and tasks. Low commit rates per author can signal the management, that there’s some sort of problem going on:

  •  Task ambiguity that prevents to complete the task, indecisive stakeholders
  • Technical issues within the platform, preventing on completing the task
  • Legacy code that remains in the product, and possible technical debt increase
  • Under-engagement

Ben Thomson in his post about code churn, provides few graphs, illuminating code impact on productive/churn code across release cycle. As an example, I’ve used CodeScene service, to test code churn on one of the plugins I’ve worked a lot back in the days (hopefully will have time to get back to it soon) – cakephp-calendar.

Calendar Sample

cakephp-calendar code churn graph

As we can see, March-April was a major rewrite of the plugin, that followed next spike occurring in July.  March re-write made the code more fragile. If we dig deeper, we can see that an overall complexity of March-April release was drastically decrease. Here’s one of the examples:

complexity graph of CalendarsTable.php

It’s still quite high, but it’s nothing comparing to what it was. Still, the code was in semi-prototype mode.

Apart of CodeScene service, there’s a specific churn-code composer package for PHP-based projects, that might be more useful for developers.

Dashboards with GraphQL & ElasticSearch

Here’s an example of creating Dashboards with GraphQL and ElasticSearch from React community.

As a big fan of VueJS framework, it’s still nice to check what’s happening on the other side of the fence from React community fellow coders. 

Mitch Clay published an article on how you can utilise GraphQL with ElasticSearch to design dashboards for the your projects.

The stack is pretty common for JS environment:

  1. NodeJS
  2. React
  3. GraphQL with Apollo

But, the only bit I missed using – ElasticSearch engine, as more and more projects use it – it seems that I need to give it another look.

AdminLTE Midnight theme: customising templates

AdminLTE is by far one of the great examples of what Bootstrap CSS can do and consists of pre-defined UI elements used for Admin control panels. Similarly we have ElementUI, Bulma, and Bootstrap CSS in its core. 

Right now, there’s a massive amount of various admin panels on the net.

AdminLTE Midnight Theme
AdminLTE Midnight Theme

So, I made a quick Proof of Concept on how we can easily convert default AdminLTE layout into a dark theme, with a bit of help from grunt and yarn.

AdminLTE Midnight Dark Theme is available on GitHub. I added a detailed description on how to run it in dev mode via AdminLTE repository.

You might find it useful to go through customisation instructions first.

VueJS.London – Jest for Vue testing

Images Copyright

In September, I was lucky to attend VueJS London conference. It was an amazing experience, with lots of interesting talented people from different corners of the EU and the States.

I’ll slowly start assembling the info on the talks that took place there. Once the slides become available I will start adding them here as well.

One of the greatest talks at the conference was by Roman Kuba. It was about test utils for VueJS, and actual experience on integrating Jest for Vue infrastructure.

Qobrix is slowly integrating VueJS as a sidekick for all the sophisticated UI/UX solutions, trying to reduce jQuery impact on the platform. One of the reasons behind a slow pace of integration – kind of frustrating situation with plethora of test tools.

Quick googling on the subject, brings some more structured materials from Roman, on VueJS/Jest integrations and how they do it in CodeShip.

One of the things that’s definitely worth checking – vue-test-utils.

Psalm – static analysis of PHP

Once every blue moon, I dive into Github repositories to check for something useful for my everyday routines.

This time, I stumbled upon Psalm from Vimeo. 

Psalm is designed to understand that complexity, allowing it to quickly find common programmer errors like null references and misspelled variable names.

vimeo Psalm documentation

I’ve been using phpstan for basic code static analysis for a while. I was running it with various rule levels, depending on the complexity of the codebase.

So far, benchmarking an output from both varies on the same codebase. Psalm managed to find more inconsistencies in the code – looks like it’s worth giving a shot.