By a strange coincidence, my last article did not go under water, and in a quiet mode, swam on the surface of Habr. It seems that people still have an interest, and therefore we can reflect a little more on the irrationality of our thinking and actions. This is exactly the water in which we swim every day, rely on its laws, make decisions based on its availability, and, at the same time, we do not notice at all.
This time I will need the help of 2 researchers in this topic. Daniel Kahneman - a psychologist and economist, winner of the Nobel Prize in economics. His scientific research questioned human rationalism, which had dominated the economic sphere before. And Dan Arieli is a professor of psychology at Duke University, who has done a lot of human experimentation and published famous books on irrationalization. Both of them, almost all of their conscious lives, were put on studying human behavior, to better learn how our brain works and what motivates us. And now we can just read their books and soak up all this great experience. However, I will give links at the end of the article.
Daniel describes the brain in the form of 2 systems. System-1 is fast, instinctive, emotional, and System-2 is slower, more rational.
System-1: If we make an analogy with computers, then this is probably cache + persistence. Each request first passes through this area of memory, where there are many checks that are ready to fire at any moment. Here emotions are formed, against which further processing of the request takes place. If you try to present it as a code, it might look something like this:
assert danger: throw FearEvent() if (enemyAround) throw FightOrRunDecisionEvent() throw MobilizeHardware() ... assert satisfaction: throw RelaxationEvent() throw DelightEvent() ...
I told you, this is a rather funny code and, interestingly, it is quite unique, because each person is written differently. Processing may stop here. For example, if I wanted to scratch my ear, or spin a pedal on a bicycle, or give an assessment to a person who is a representative of some generally accepted stereotype, I will do it on an automatic machine, but thinking about what I have just done. The brain is the most energy-intensive organ in the human body, and one cannot do without optimizations, therefore its main slogan and algorithm is “to follow the path of least resistance”. This greatly saves resources and in most cases simplifies life. In the overwhelming, but not always. Here our second friend, Dan, succeeded, who likes to analyze such automatic reactions of people who seem to be doing a good job,
System-2: this is the rational part. Something like RAM + persistence. If the request came to this level, it means that the solution was not cached and there is something to think about and really make a decision. Here our long-term memory plays a crucial role. As on the physical level (neurons that are connected to each other), and on the logical level (a set of associative images with connections), a person’s memory can be represented as a graph. It reflects our main life experience. When we run a decision-making program, in essence, this is a transition along the edges of the graph in search of the optimal solution or answer to a question. It is possible to schematically represent this process in the form of running several threads, as in the map-reduce algorithm, where at the map stage the most suitable results are collected from different areas, then
If to summarize, the flow of execution always goes through System-1, and if a suitable handler is found or an exception occurs, it ends right there, otherwise we move to a slower level of System-2, where the situation is subjected to more careful analysis. In practice, this means that we are not always as rational as we think about ourselves. The overwhelming majority of reactions occur automatically, never reaching the rational part. And this process is subject to a lot of mistakes.
I really love code review. This is part of the development, which allows you to identify hidden problems, get an assessment of the solution of the problem by someone else, thus setting up the process of transferring knowledge and experience within the team. At some point, I realized that this practice is a two-sided sword. On the one hand, all these advantages, on the other hand, is a blow to team work and relations within the team, if you use this tool one-sidedly. Suppose our nameless hero Vasya received a task and implements some piece of functionality. He tries to use all his potential and knowledge in order to make the implementation the best from his point of view. Whether it turns out to be such or not depends on the specific abilities of this particular programmer, but in his eyes, this implementation is almost idealized at the system-1 level. The time of code-review comes, colleague Peter appears and breaks this perfect picture, even for the benefit of the whole project, offering an even better solution. The result causes a storm of protest in the unfortunate Vasya. After all, everything was so good and cloudless, and then some nasty man ... why does he do this? everything is lost! System-1 in a panic, the brain may react with anger, rage, or it may be hopelessness, anxiety, a sense of the worthlessness of being. Upstairs, it most likely will not break through and no one will ever see it, but these emotions will be directed precisely at the person who made the review. Despite the fact that initially the comments were exclusively on the code that was written by our programmer, and not on him personally. In the future, these reactions can accumulate and slip in everyday communication,
People look at each other and at the world around them through the prisms of cognitive distortions that accumulate with experience. It is very difficult to distinguish what actually happens in reality, from the assumptions that the brain calculated and substituted in the form of the missing terms of the equation.
If Petya took into account that Vasya is not just a rational machine that grinds facts, he would probably try to soften his comments, and arrange them in the form of questions that provoke him to think about shortcomings and push for a better solution. To balance the balance of power, I would include a couple of positive points in my review and tell why he likes them. Those. I would try to do so in order not to provoke Vasi's System-1 to throw an exception, and to get to System-2 as calmly as possible. If at the same time Petya is trying to prove his steepness and total superiority, he is unlikely to be able to achieve this goal.
For his part, it would be nice for Vasya to be able to separate himself from the results of his work. To realize that the questions to his code are not hitting him personally, that people very often make mistakes and there is always room to grow and what to learn, and this is normal. That Peter, in the end, does his job in the same way, and tries to do it as best he can, as far as he is capable of it. And of course, that both Petit and Vasya have one common goal - to make a quality product and deliver it on time. Unfortunately, understanding all this at a rational level System-2 does not guarantee that System-1 will not do anything anyway. But here, oddly enough, the coupling of the brain plays into our hands, and therefore even such an understanding can help to cope with the situation.
David and Dan cover the topic in more detail (not about the review code, but in general), so if you are interested, I highly recommend the following books:
Thinking, Fast and Slow
Well, my previous article on Habré .
Thanks for attention.