DEV Community

Cover image for Go ahead, write your code in your native language
Jakob Christensen
Jakob Christensen

Posted on • Updated on

Go ahead, write your code in your native language

Most of us, the developers, probably write our code in English. We name our functions, variables and types in English when we write code, and we write comments, git commit messages and pull request descriptions in English. And it makes perfect sense since English is the number one language spoken by most people in the world. So if we want our code to be read and understood by other people, English is a good choice.

But English is not the number one language in the world when it comes to being the first native language. For many of us, English is a second language used only for communicating with people from other countries. And for writing code. For that reason, many of us learn English in school as part of our education to become citizens of the World.

I have the quite unpopular opionion that in some cases it is perfectly fine to write your code in your native language. I'd even say that it is preferrable for some applications. Not everybody agrees.

Denmark is a small country and there are only about 5.8 million Danes on this planet. We don't even make it on the list of top 100 most spoken languages. Even though Danes have had quite an influence on the English during the Viking Age, you should not expect a whole lot of people to understand your code if you write it in Danish.

So how dare I suggest that we should write code in Danish?

What I am talking about are Line of Business (LoB) applications. That is, applications that you write mostly for internal use to solve some kind of business problem that is specific to your company. I am not talking about libraries you publish on npm or Nuget.

I think in the long run you might be better off if you code LoBs in your native language. You may not agree. I know all my colleagues disagree. We have been discussing this on my team and apparently, I am the only one who thinks it is a good idea. But I stand my ground and let me tell you why:

Everybody on the team are Danish (actually, I'd say that 98% of the entire company are Danish). All our documents including specifications for in-house LoB applications are written in Danish. We speak Danish with each other. Our offices are located in Denmark. The business terms are very specific to Denmark. Some of us are so-so at written English.

So why on Earth would you not write code, git commit messages and pull request descriptions in Danish?

When writing in your native language, there are less misunderstandings and there a is one-to-one relation between the terms used in your specifications and in your code. There are no weird translations between business terms.

The major counter-argument is, that there will be some weird mix of languages at "the boundaries" between your code and whatever framework or 3rd party libraries you use. That is a valid argument. However, overall I believe that the important code, that is the code that implements the difficult business rules, is easier to understand and reason about if it directly relatable to your specifications.

So go ahead, write in your native language for your own good.

Top comments (0)