Last week, I spent a decent amount of time removing the dead code from our codebase. I love to delete the code. As for me, so few things bring the same pleasure as bringing order to the code. Yes, I love to do it so much that I am puzzled by engineers who leave unnecessary code in the application. But over the weekend, I heard someone talking about Milgram's experiment “Submission to authority” (I also wrote about this - note of a translator ) and I could not help drawing a parallel between a man who was shocking another human being and an engineer who leaves known bugs and bad code.
If you are not familiar with the experiment by Stanley Milgram, then it is that the Experimenter (a person endowed with power) orders the Teacher (object of study) to beat a series of increasing current discharges of the Student who is in another room. Wikipedia illustration:
E is the experimenter (experimenter), T is the teacher, L is the learner
The essence of the experiment was to study the reaction of people to orders that conflict with their moral principles. Prior to the experiment, it was thought that most of the subjects would stop the experiment as soon as they understood that they were hurting the Apprentice. However, during the experiment it turned out that an amazing number of subjects reached a maximum discharge of 450 volts.
In the first set of Milgram experiments, 65 percent of the participants (26 out of 40) used the maximum possible value of 450 volts, although it was unpleasant for them to do so; at a certain point in time, each participant stopped and doubted the experiment; some participants wanted to stop and return the money they paid for participation. During the experiment, participants experienced varying degrees of anxiety and stress. They were sweating, trembling, stuttering, biting their lips, moaning, digging their nails into the skin, some laughing nervously.
When we learn about such results, we want to believe that we would never do that. We want to believe that “just obeying orders” is a human flaw that we don’t have. But experiments, such as the Milgram experiment, show that such a belief is optimistic at best, and completely wrong at worst.
And now, when we know how people react to authority, when physical pain is at stake, let's see how programmers react to authority when it comes to more abstract things, such as frustration and inconvenience. Let's take the Milgam experiment diagram and redo it so that it reflects the development team:
If we look at the development team as it is shown in the illustration, it is not so surprising why we, the engineers, leave bad code and leave known bugs. Probably at some point a person with authority made it clear that we don’t have time to fix problems or these problems are not high enough compared to other things in the roadmap. Or that deleting a dead code does not bring value to the user. As a result, we leave the code as it is and proceed to the next task, although it conflicts with our moral compass and the notions of what is good and what is bad.
In Milgram's experiment, the subjects often hesitated and protested against sending another discharge to a person in another room. In such cases, the experimenter demanded the continuation of one of the predefined phrases:
Using nothing but words, the experimenter was able to achieve that 65 percent of the subjects, against their will, beat very painful current discharges of other people. I wonder what words we use in the context of software development?
I am not writing about this in order to offer some kind of solution. I don't have it. I write in order to cultivate - above all in myself - sympathy and understanding . When I see code that leaves a sense of bewilderment or behavior that I don’t understand, I must remember that actions do not always reflect intentions. I have to remember that engineers leave bad code not because they don’t care - they leave bad code because they didn’t have the freedom to fix it. And they leave the bugs, not because they do not care about users, but because they did not have the authority to deviate from the product’s roadmap.
Source: https://habr.com/ru/post/432838/
All Articles