ReduKtor - Auto Debug For Kotlin
Written by Mike James   
Wednesday, 18 September 2019

No, this is not an AI approach but a good old down to earth engineering approach to isolating bugs. It's a technique that you could well apply manually, but as an automatic tool - even better.

It always surprises me that debugging isn't often taught as anything more than a vague instruction to "try and find where things go wrong". Debugging is an afterthought to learning to program, but it needn't be. What I found particularly interesting in a recent research paper from the Saint Petersburg Polytechnic University and JetBrains Research, about automating an aspect of debugging, was how much it had to say about the process of debugging.

The basic idea is that of reduction. You encounter a bug and a first step in finding out what the cause might be is to try and reduce the example to its simplest form that still causes the bug. This always sounds easy, but it isn't and it is generally referred to as delta debugging. Often when you find the minimal case that causes the problem you can see the bug clearly without having to do anything else. 

In this research delta debugging was applied to Kotin as an automated process - which resulted in a prototype called ReduKtor. What this does is to automatically perform transformations on the program to reduce its size while keeping the error. It is interesting to note that it isn't even easy to determine that a transformation does preserve the error. Some changes result in slightly different error messages that a programmer would immediately recognize as the same problem with a slight variation but an automatic procedure would find difficult. In this case it is claimed that the structure of the Kotlin error reporting makes this easier.

ReduKtor uses a pipeline of transformations, some language-independent and some very much Kotlin-dependent and it seems to work:

"The evaluation results support the practical usability of our approach to Kotlin delta debugging and also shows the importance of using both language-agnostic and language-specific techniques to achieve best reduction efficiency and performance."

The only sad part is that the prototype is too unstable to be used for real, but the Kotlin compiler team is co-operating with building ReduKtor into the compiler so it might have a practical spin-off in the future.

We need more tools to help with the difficult task of debugging and having a magic wand that would reduce any problem program to its simplest form would be a great help.

Mike James is the author of Programmers Guide To Kotlin (I/O Press) written for Java programmers, Android developers and programmers wanting to discover why Kotlin is a better Java and of Android Programming in Kotlin: Starting With An App (I/O Press).

More Information

ReduKtor: How We Stopped Worrying About Bugs in Kotlin Compiler Daniil Stepanov, Marat Akhin and Mikhail Belyaev

Related Articles

Kite - AI Powered Auto Completion for Python

Visual Studio IntelliCode Infers C# Coding Conventions

Refactoring to Kotlin Codelab

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, Facebook or Linkedin.



Find A DevFest Near You

October is with us and October is the main month for DevFests although November has almost as many and there are still some to come in December. You might be surprised how many events there are this y [ ... ]

Project Jacquard Products Materialize

Google's Project Jacquard has finally launched wearables that seem stylish and incorporate technology in an appropriate and practical manner. Your choices are an Yves St Laurent backpack and range of  [ ... ]

More News





or email your comment to:




Last Updated ( Wednesday, 18 September 2019 )