Why I Don’t Like Switching the Programming Language

A bit more than 5 months ago I started working at Grammofy, where we use Python a lot. Before, I wrote only a tiny bit of production code in Python. I had a rather hard time starting with it and I came to have a lot of fun with it now. As always, there were people who were congratulating that I finally joined the right side. However, after a couple of months of freely forcing myself to work with a new language, I can say that I don’t like to switch to Python.

Just that you get me right: It isn’t solely Python. I realised that I don’t like switching to any language entirely. Ever. Instead I choose to learn even more languages. And most importantly: to never stick to only a single language.

If you are tempted to do exactly this, may it be because you think you already found your favourite language or because everything else looks not as promising as what you’re using right now – here’s why you better should not settle down.

The Excitement

Six months ago. It was the time were we had this book club at my former work and just finished POODR and the “7 languages in (definitely more than 😉) 7 weeks”-book. And because we were still hungry, we directly started reading a couple of Elixir books afterwards. I had all these new languages in my head, each one touting for my attention. I did mostly Ruby the last years, I was looking into Elixir and a bit into JavaScript, but I had not done too much Python before. So, when I started working in my new job, I was curious to see how I would do, spending most of my time with a – for me rather foreign – language.

Well, it turned out to be a nightmare for the first couple of weeks.

The Pain

If you learn a new programming language, it feels a bit like learning a real language from scratch. You hardly understand the basics, and yet you are asked to build full sentences. You are restarting as a “Junior”, even if your position is not called “Junior”. You love what you’re doing, and you decided a long time ago, that you’ll give a shit on your job title. Still, now you are tempted to beg for being titled “Junior”, just to get even more time to understand things.

But no fear! The good thing is: Learning a new language is just like learning a dialect. You already know a lot about the language from stuff you’ve heard before. Breaking it down, it is just a couple of words, rules, and concepts you don’t know yet. Doesn’t sound too hard to manage, does it?

Nevertheless, my first two weeks were horribly unproductive. Every couple of hours I asked myself why people loved Python. What was so special about it, that I couldn’t achieve the same with Ruby for instance? After my first week of subtle frustration, I decided to get to the bottom of what was so special about it. I searched for Python books and after a while I luckily found “Fluent Python”, that did a great job teaching me the basic principles and specialities of the language. Problem solved.

Not quite. I had a motivation but still no clue and writing code went terribly slow.

I realised that when learning a new programming language, you spend a lot of time thinking about how to do things. If you care (and you should!), you want to write some code that other (more experienced) developers can read and modify without getting a headache.

Of course you know all about clean code, object oriented design, patterns etc. The problem is, you still don’t really know:

  • how to build your architecture
  • where to put things
  • how to name things
  • how to build certain parts like packages, modules, and classes
  • what conventions are followed by your team
  • which of the pythillion different syntaxes you should prefer

Luckily most programming languages come with a community-driven or even in-house style guide. Python has the so-called Python Enhancement Proposal number 8–or shorter PEP08.

Next thing I noticed: Whenever you learn a new language, the first thing you should do is setting up some linting tool for the editor of your choice. It will massively speed you up and leaving you with some really nice aha moments. As painful as a linter sometimes seems if you already know what you’re doing, as helpful it is for starting off. You will learn how things should look like, you will get immediate feedback about what is wrong with your code and it will be right at least syntax-wise and style-wise.

The New

Before I wrote Python there were lots of things I could never understand, like:

  • Why would one ever use 4 spaces for indentation?
  • Why would you not put spaces between keyword arguments and default values?
  • Why that waste of space by putting two blank lines between two functions?

(It absolutely makes sense to me now. I’ll leave it to the kind reader to discover the answers and arguments 😏)

The point is, if you don’t explore other languages, you will never see the different communities and thoughts behind them. Learning another language forces you to think about why other communities are doing some things differently. It forces you to question the approaches you just took to be right, because you knew them long enough and you just have a way with them.

I really like looking into the code of libraries I use. Sometimes it’s needed because of lacking documentation. But even if you have all the information you need, there are some good reasons why you still should read some open source library code. First of all, it helps to judge how well the project is built and maintained. It helps to make a well-informed decision on whether to use it or better just move on. Secondly, it will reveal some patterns how the community likes to structure their code. You will–hopefully–see best practices and–wham-bam–you learned an important piece for your daily work again. Additionally, browsing the code of apps and libraries being built with a certain language will get you an idea about what problems can be solved elegantly using it. You will very soon have a feeling for whether the problem you’re currently working on can be solved easier by using another language.

This brings us to a very important point: You should be open-minded to explore alternative solutions. Sometimes this even means trying another language. I always try to not to be prejudiced by all the rumours out there. Just because someone says: “Nah, don’t use it. It’s bullshit!”, doesn’t mean that you are not allowed to verify it is actual bullshit. Maybe it’s not.

Sometimes there is no way around working with your favourite “worst language in the world”. Who has for instance not dealt with legacy code? If you are forced to work with something you don’t like for the moment, here’s what I’d do:

Find something special about the language. You can’t have fun with something that seems utterly boring and useless to you.

When stumbling upon a new language ask yourself:

  • Which different concepts are used and why?
  • What specialities does it have?
  • What kind of problems does it solve really well?
  • For which problems should it not be used?

I truly believe that once you found something exciting about a language, all the experienced pain and the too-many-new-things will very soon give you small benefits in a lot of fields. Just keep learning!

The Benefit

Unfortunately, there is no language which is perfect for all kind of problems. Every language was built with the goal to solve a certain problem space. This also means knowing about lots of languages will give you the ability to work in different fields. It allows you to solve problems with the fitting problem solver.

I personally can feel a benefit from working with different languages to that effect that it helps me to dynamically choose what to work on. Programming is still a kind of creative work and you can’t always force you into the flow. In case I’m in the mood for doing some fast prototyping I can choose Ruby. Need to solve some Maths? I’ll probably see whether Python can help here. If I like to try some spacy UI stuff, I can leverage JavaScript. If I have to work on some highly available, distributed [put your favourite 🦄 and 🌈 here] loveliness I’ll maybe go and write some Elixir these days. Personally, it helps me to have a more balanced programming experience all day through.

Besides, learning a new language is just a nice challenge. It keeps your head spinning and demands some patience. Sometimes it requires to be more tolerant towards things you’d approach very differently from what you already know. It gives you loads of valuable insights and when you learn together with someone else or you visit some developer meetups while learning, it will even affect your social surroundings.

To start off, you could go and pick a language you could never really stand. Just keep in mind that you don’t have to switch to it. You should learn about its concepts, the reasons why they exist and what the language is used for. If you like what you learned, look at the community behind, understand their approaches, and maybe build something together with them. If you don’t like what you learned, then ask yourself, why people still use it. It’s certainly not because they are stupid.

The Wrap Up

Phew, that was quite a mix of personal stories and insights.

With these, I feel like not sticking to a single language seems to be a rather good idea. So, the question is: Should I learn all the languages out there? How many languages are enough and how could I possibly learn all this and at the same time still have a social life?

I’m totally aware of that it’s nearly impossible to keep up with all the programming languages you already know, much less to fulfill the “Learn a new language each year!”, that some folks are preaching. I think it’s about something else. It’s about developing a mind-set and skills, that allow you to choose interesting projects, move on if it doesn’t fit anymore, and make a living while having fun solving problems.

It’s like with real languages. You don’t have to know every language perfectly but it might help to know some more in-depth to get along in foreign regions. And if you are missing some bits and pieces you can still wave and make some noise to make your point.

So – back to programming languages – these are my final words:

Do not switch! Rather use the language that suits best. Not switching entirely will enlarge your toolset, keeps you open-minded, and will eventually make you a better developer.