The Golden Rule of Software Development

Christoffer Vig
Nov 30, 2018 · 6 min read

Are there any rules that a decent software developer must follow? There is an abundance of guidelines for crafting software, such as the clean code principles, which encompass, for instance, TDD (test-driven development) and SOLID. Following principles can be a good thing, however,
the principles should not be considered to be of value in themselves, but only as means to an end. Lately, “compassionate coding” has come up as a reaction to “clean code.” Compassionate coding tries to move focus to the human aspect of coding. Having a well functioning team and satisfied end-users are considered more important than the clean-code-principles. I suggest there exists a common moral rule that should be a guideline for all human actions — not only software developers but all rational beings.

Image for post
Image for post

Linus’ return

Linus Torvalds was recently (September 2018) 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 an enormous impact on software development over the last 25 years.

A number of embarrassing and painful conflicts in the developer environment led Linus to an acknowledgment of a 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 already has a plan in place for a program that checks outgoing emails and halts sending if an 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 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 sub-standard practices, he now uses the more moderate phrase “Just do not do it.”

IT and empathy

The case of Linus’ missing empathy is not unique. Information Technology is a world dominated by men working on machines, and it may seem that the characteristics of the machine assimilate into the men operating it. Human interaction becomes input and output, pure calculations, and emotions not important.

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 instead 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 law.

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 develops through imitating and performing empathic activities.

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?

The golden rule of Software Development

Code is hard to understand. Not only for those who don’t know how to code, but even full-fledged developers are also 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 making sure the code only does what is necessary.

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 you to write with the good of your colleague in mind. 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. Optimization should not interfere with readability. 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 higher 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 provides a point of view that can become a ladder towards increased consciousness and understanding.

How to do a code review

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, working with concepts of “Compassionate coding,” and has some interesting points on how to do a useful 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.


CoWork hjelper selskaper i å lykkes med strategisk…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store