Konubinix' opinionated web of thoughts

Is Tdd Possible in Companies?

Fleeting

Is tdd possible in companies?

The main principle of tdd is « make it work, then make it elegant ».

I’m totally sold with this statement and think I never saw a development that was initially elegant. Some people rationalize some great principles, like SOLID, but this does not necessarily lead to elegant software.

Likely because elegance is more of an intuitive notion and one needs to end something, take a step back and appreciate whether per feel it is elegant or not.

In open source software I created, I often took this step back a few days or weeks afterwards, and refactored the code then. Therefore the flow was more like.

  1. write some code, till it works,
  2. do something else for some time,
  3. go back take a look in the code I wrote, often because I suddenly feel it was not that good after all,
  4. realize how bad it is,
  5. refactor,

In companies, I’ve mostly seen the following scheme.

  1. write some code, till it works,
  2. you are already a few days late according to some expectations (even though you are clear about your non commitments),
  3. you show that it works,
  4. people are glad and ask you to stop working on it,
  5. you inform that there are much technical debt,
  6. you are asked « is it a blocker? »
  7. you answer like « hmmm, not exactly but… »
  8. you are asked to move on something else

I guess that sonarqube, with the clean as you code paradigm helps mitigating this, even though often, you just have to ignore the shown issues because you have to work on the other project people want you to have done by yesterday.

To my mind, the only thing that remains to feel good about one’s code is to learn more about stoicism, in particular learn that you cannot do anything about that (blame the game, not the players) and decide not to feel bad about that.

Notes linking here