Mental Models for Software Engineers: Hanlon’s Razor

It is difficult to be sanguine when people around you does something wrong with you. The wrong doing does not have to be extreme it could be as simple as a colleague not replying to your email when you expected them to reply. In many situations like these we tend to assume that other person does not want our good and they are doing it intentionally. The result of these explanations is that we strain our relations with people around us. We can’t read their mind but still we end up assuming what is in their mind. Hanlon’s razor mental model can help us overcome this bias.

Hanlon’s Razor

A razor is a principle or rule of thumb that allows one to eliminate unlike explanations for a phenomenon, or avoid unnecessary actions.

Hanlon’s Razor is named after Robert J. Hanlon. It states that

Never attribute to malice that which can be adequately explained by neglect.

This rule help us overcome the bias which comes when things go wrong. Most of us tend to blame the other person for wrong doing and assume they had malicious intention. When we assume other person has malicious intent we don’t give people benefit of doubt of things happening because of neglect. We all make stupid mistakes but we never think that we made mistakes of bad intent. But, for others we don’t keep an open mind. Life will become much more easier and we will have better relationships if we start giving people benefit of doubt in such situations. More often than not inability or neglect is the cause than malice.

Applications of Hanlon’s Razor in Software Engineering

I am a software engineer so I look at places where I can apply Hanlon’s Razor that can help me work effectively with others in my team.


Like life software development is full of uncertainties and things tend to go wrong even when best of engineers are working on a problem. It is a common practice in most organisations to do retrospectives when things go wrong. Most often these retrospective becomes a blame game and people try to find one (or more ) person who can be held responsible for the screw up.

Hanlon Razor can help us conduct retrospective that err on the side of people. We will start with the shared understanding that things do go wrong because of neglect and not because of bad intentions. When bad intentions are out of the room we accept each other flaws and work collectively to understand why problem happened and how to avoid problem in future. Google mentioned in a book that they do blameless postmortem so that they avoid blame and keep the discussion constructive.

Consulting assignments

Time to time I go for consulting assignments where I need to review source code and software architecture. Many times I find teams lacking the knowledge of following basic code quality practices. There will be no automated tests, no standard coding guidelines, code will fail to compile, no software architecture documentation, no strategy on how to enforce quality attributes, and many other good practices that a software project need to follow. The old Shekhar will assume that the team is unprofessional and they have no intent to write high quality software. This at times tend to negative environment during such assignments.

Since the time I have started apply Hanlon’s Razor I tend to understand the context in which such a mess is created. When you understand the context you will find that there are bottlenecks in many places. Many times I have find that there is no senior developer to mentor junior developers. Junior developers are doing whatever they can but there is no one who can guide them and show them light at the end of tunnel. Rather than thinking team consists of bad developers who don’t want to improve I start to think how we can change the team structure so that junior developers can be mentored.

Again this does not mean nobody is at fault. Someone took the decision to put all junior developers in a project with no guidance so there is someone who has not given due diligence. I apply the same when I meet their manager to understand why this happened. You move up the hierarchy to find the root cause of the problem.

Exception to Hanlon Razor

I strongly believe that you should always start by giving people benefit of doubt. It is far less that people have malicious intent so we should always err on the side of people.

One exception that come to my mind for Hanlon Razor is Indian Prime Minister Narinder Modi. He is one of the few Indian prime ministers who got the complete majority. This gives him all the power and authority to do the things that he talked in his election campaign in 2014. Instead what he did in his 5 years of power is mainly divisive politics. In last 5 years, we have seen more discussion on cows and Hindu-Muslims than on jobs. He came as a messiah of growth but he only blamed opposition. This guy is not stupid or incapable but has bad intentions. It is a sad reality when time has come to answer what he has done in last 5 years he has changed the discourse (with help from India’s biased TV media) to nationalism using the Indian army as his scapegoat. In last 5 years, democratic institutes like court, media, CBI, RBI or bureaucracy have been targeted and they all have become weak. It will take many years to fix the damage done to India’s core democratic institutes. I just hope people understand what is at stakes in 2019 elections and vote accordingly.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: