SmartQA Community

Technical debt is fat, clean code is liposuction

Featured image of blog "Technical debt is fat, clean code is liposuction'

Raja Nagendra Kumar in discussion with T Ashok (@ash_thiru on Twitter)

Summary

Raja Nagendra Kumar outlines the role of refactoring, unit testing in producing clean code. He states this very interestingly as “Technical debt is fat, clean code is liposuction” and crisply explains the act of producing clean code.

The video of this “nano learning” smartbits video is available here.


Question: In our conversations you said  “Technical Debt is Like Fat, Clean Code is Liposuction ”.  A very interesting phrase it is, could you please elaborate?

This phrase has come out with the intention of producing world-class products from India, where every developer as he gets married to the profession, his duty is to produce products of world-class.

In that context, every day whatever code he writes, he is trying to produce a product baby and as more and more code gets added like the way the baby learns each day.  The large code also will start accumulating a lot of fat. If the future of the baby has to be better, you should know how to grow the baby or constrain the baby in a way and that’s where the clean code practices starts coming. 

As more and more large code starts coming into the product, on one side  product growth happens and on the other side, the clean code  practices should know which is relevant now, then start cutting the fat. The beauty of this approach is that it is not like  doctor operating on somebody, here the professional himself is doing to yesterday’s code whatever he has written is able to remove that code which is not relevant or modify the code to make it scale better. 

So, when anything is growing there is also a fat and that fat has to be transformed in a way where it is taking advantage of that and is leaping forward much faster. Otherwise, then the two options are : living with fat and not being able to run or becoming better professional by identifying the fat on time and trying to run faster. 

What do mean by clean code?

When we are trying to achieve something there are a lot of abstractions coming on the way, which actually no code is communicating to you. For example, you want to write a feature X and you have done it in X way and feature Y comes in, now to position this feature “Y, you need to have a creative thinking rather than fitting that along with X.

Now the product will have both X and Y. Instead of fitting them you need to make sure  what is affecting Y to be there in concurrence with X, the   engineer must listen to these clashes and see how to refactor it so that Y can go smoother. Unless we try to be a listener to our own challenges, what code is speaking, clean code will not come.

Most of the time people try to fit x y z as silos, they may work independently, but not coherently. My meaning of clean code is “ listen to the last code while adding new code” and that’s where people will start talking about what is the need or purpose of refactoring, what the purpose of unit testing is. They’ are not compliance. They are the ways for you to bring out a world-class product from your own daily experiences. 

click to video