Are there any rules that a decent software developer must follow? Many attempts have been made to set up guidelines for crafting software, such as the clean code principles, which encompass for instance TDD (test driven development) and SOLID. Lately, “compassionate coding” has come up as a reaction to a tendency in clean code practitioners, where the intrinsic value of the clean-code-principles in themselves are held to be more important than the functioning team, the end users, or the product to be delivered. I suggest there exist a common moral rule that could be used as a guideline for all human actions — not only software developers, but all rational beings.
Linus Torvalds was recently in the focus of IT news after announcing the need to retreat. Linus plays a central role in the development of the core of the Linux operating system. It’s no exaggeration to say that Linux has had a huge impact on software development over the last 25 years.
A number of embarrassing and difficult conflicts in the developer environment led Linus to an acknowledgment of lack of communication. Linus writes “I realized that I had completely misread some of the people involved”.
Linus admits the inability to communicate with his colleagues on the emotional plane — he realized that he lacks empathy and needs to seek help learning to understand and respond to other people’s feelings. He compares the situation with previous periods where he has spent some time off to develop tools, such as the source code system git. He now needs to learn new tricks, and has already a plan in place for a program that checks outgoing emails and halts sending if inappropriate language is detected.
Linus returned from the desert, or wherever he was, after just over a month. Meanwhile, the Linux kernel developers had agreed on a new Code of Conduct, which clearly emphasized requirements to avoid harassment and bad behavior. To find out if any change in behavior actually had occurred, the site Phoronix made a comparison of the tone in Linus’ code review before and now. The difference is noticeable.While he could previously reply “COMPLETELY UNACCEPTABLE” in uppercase letters to a pull request with some bad practices, he now uses the more moderate phrase “Just do not do it”.
The case of Linus’ missing empathy is not unique. The world of Information Technology is dominated by men who work with machines, and it may seem that the characteristics of the machine assimilates into the men operating it. Human interaction becomes input and output, pure calculations, and emotions are given little importance.
Communication with customers, users, colleagues and friends becomes terse, without regard to how it is received.
This tendency to communicate without emotions is spreading out across all internet communities. Foul language, racism, harassment, and denigrating comments are rather the norm in internet debate forums, necessitating the hard work of moderators to filter out offensive posts.
But empathy is more than a filter. Empathy is the ability to understand the feelings of other people. It is possible to regard a human being as an entity in itself, but that is only a mental construct. As the human is manifested, through birth, we are all parts of communities, the minimum possible community being the relation a child has to its parents. We are social animals, and to increase our being and consciousness, we should attempt to enhance our sense of community through empathy.
So what should you do if you suddenly realize that — hey! I lack empathy! What can you do? Are you doomed to a life on the deserted island of non-empathy?
One might think empathy is innate. However, most other human traits develop as life happens, humans are shaped by their experiences. There is no good reason to believe that the ability to feel empathy should be an exception.
The golden rule — you should do to others what you want others to do to yourself — is a moral principle found in the vast majority of cultures in one or other variant. It is perhaps the closest one comes to a universal moral principle.
Unfortunately, other people’s thoughts and feelings are not directly available to us. We need to use the tools we have, gathering information through the senses — perceiving words and motions, which when interpreted with imagination, empathy and reason, enable some possibility of understanding the viewpoint of another.
As Aristotle said, “ We become brave by doing brave actions “ — in the same manner empathy can be developed through imitating and performing empathic actions.
Habits are not easy to change, but it is possible. You may need some tools to start practicing empathy, such as alarms, notes, triggers etc. Try to incorporate the golden rule as a filter that automatically activates just before you are about to express something: If I was the person reading this — how would I react? If I had the same background, the same surroundings — how could I react? How would I respond to what I’m writing now? What would the other person want from me?
Code is hard to understand. Not only for those who don’t know how to code, even full fledged developers are usually fully aware that code can be hard to understand. Making code easy to understand should be an integral part of a software developer’s work. It can be argued that this act — making sure code is understandable — is an instantiation of the golden rule. I write code that is easy to read because I have experienced the pain of trying to understand incomprehensible code. I don’t want others to feel pain when trying to understand my code. A software developer will be able to tell you a variety of different actions she can take to make sure code is understandable. From correct formatting, correct indentation, good naming practices, avoiding duplication and to avoid the code making things unnecessary.
One could say that a good programmer follows the Golden Rule of Software Development:
“You should code in a way that you would like others to have coded.”
The golden rule of software development requires that the code is written for your next of kin. Whether you write for yourself, your colleague, or any unknown person does not matter. You should make an effort to make sure your code makes understanding easy. The majority of code doesn’t need to be optimized to the extent that readability has to be sacrificed. A notable exception might be critical system code — like the Linux kernel. Nevertheless, human understanding should be a high priority even in these circumstances, as the cost of bugs or errors in code may be much larger than any potential speed optimization.
You may of course use “clean code” principles in the process, but don’t forget that the principles are just an aid, never a goal in itself.
While the Golden Rule may be too general to offer specific guidelines in a situation at hand, it offers a point of view which can become a ladder towards increased consciousness and understanding.
As noted at the start of this now long-winding essay, Linus hit too hard in his code reviews. April Wensel has for a long time worked with concepts of “Compassionate coding”, and has some interesting points on how to do a good code review.
The practices of other software developers may feel provocative to some (i.e. the previous incarnation of Linus). To make sure the comments are helpful, ask these questions before commenting on another person’s code:
“Is it true?”
“Is it necessary?”
“Is it kind?
These three questions (often called the sieve of Socrates) will enable the code review to keep a higher level of impartiality.
Linus experienced “the hard way” the importance of knowing how to relate to other people and their feelings. Whether he acquired empathy through attending one of April’s seminars, or simply figured out the golden rules of software development all by himself, we do not know.
The Golden Rule of Software Development was originally published in
Coworkforce on Medium, where people are continuing the conversation by
highlighting and responding to this story.