16
11 Comments

The language you use matters

This article is entirely based on my own experience and opinion.

In my opinion, for the majority of problems, it does not matter which language you choose. Choosing the right language makes your life a lot easier, and for a minority, you simply can not solve the problem with some of the languages.

Let me share with you 2 cases from my own experiences where language did matter, and in one of them, I made the mistake of going for the language I was comfortable with, and I paid the price for it. (I personally haven't faced the case of minority).

Let's start with the one that went well.

3 years ago I had to create a tool that could spin up a new environment in our k8s cluster. There were many pieces involved like git, helm, kubectl, and many other commands to achieve this.

I could go with Go or Python but because I had to mostly run Shell commands, I decided to go full-on Bash. Once I was done with the project, even though the code was not as easy to read as Go or Python, it still worked amazingly and it was delivered in time. Had I chosen any other language, I would have needed to call Shell from that language and basically would have ended up encapsulating Bash by another language which would have made the whole thing even worse.

Now time for the one that gave me a lot of headaches.

8-9 years ago, a friend of mine reached out to me with a project from the company he was working for.

The project sounded simple. He had implemented a huge parking software with MySQL or PostgreSQL (can't remember which one) for his company.
Now they needed a tool that could interact with the database and some other devices. Communication with the database was easy but with other devices, it had to be done through TCP ports.

Being the inexperienced me I thought the language did not matter, so I went ahead and started writing the code in PHP - the language I was comfortable with.

Boy, was I wrong. Once I got to the part where I had to keep TCP connections open and handle messages back and forth and handle failures, the whole thing became a nightmare. At that time, PHP didn't handle TCP connections very well, and I had to waste many hours trying to do a small feature or get PHP to play well with it.

Then I had to do a WebSocket from the frontend to PHP, and that itself was another nightmare (how easier it would have been with Node.js!). Anyway, I had to go through with it and managed to get the project to a stable point but it took me so long that I could have learned another language and developed the solution comfortably with another language.

What I recommend to others is to try to see if the project you are about to start has any technical requirement (like TCP connections) and check it with your language of choice!
Each language has its own strength and weaknesses. Learn about those and try to evaluate if the language can help or hinder you from building the project.

Here are some of the languages I know:
Go: Provides you great functionality for concurrency using the subroutines and channels
Python: Has a huge amount of libraries for math problems
Node.js: Makes you life easier for IO operations

Hope you enjoyed this post. Any feedback is welcome.
Cheers

on March 12, 2022
  1. 3

    Great post! This is advice IH badly needs. There are so many threads with destructive advice saying it doesn't matter or to always, unthinkingly use what you already know.

    I'd add that beyond just the libraries and ecosystems, consider the level of abstraction. Some languages give far more powerful tools for abstraction than others, and it's worth it to follow pg's advice: choose the highest-level language you can for the task.

    Sometimes you have to use assembly. But if you can use C, pick it over assembly. If you can use Java or .Net instead of C, do it. If an even higher-level language is an option, use it!

    This is moderated by library availability, of course. For example, Ruby is slightly more powerful than Python but Python has much more mature libraries for many domains, so it's a better choice for anything other than web dev or shell scripting.

    1. 2

      Very good point
      Abstraction is definitely an important point to take in account

  2. 3

    I whole heartedly agree.

    At a high level I would say learning a new programming language requires less time investment than reimplementing a tool or framework that already exists in another language.

    At an even higher level I would say, when in Rome do as the Romans do.

    When in data science land use python.
    When in browser land use JS or some language that compiles to JS.
    etc.

    Each language has its own strength and weaknesses

    Yes. Why did the scientific and data science community rally around Python? Python is a language that is extremely familiar to non-programmers and these folks are scientists not programmers.

    But often, language choice is simply an accident of history. Why is Javascript so prevalent today? Mostly just because it's the only option. Why are Go and Python the best languages for Kubernetes? Mostly because that's what Google engineers use.

  3. 2

    For any general purpose application, I'd suggest using the language you are most comfortable with.

    If there are special requirements as in OP, choose the best tool that fits the job, even if that means you are slightly uncomfortable.

  4. 2

    Firstly, in 2004, I learned Java. Then I was PHP, JS, and finally Ruby. For me, also, each new language was easier to learn. The brain used to developing, and some patterns are similar, so this transition was quite easy every time.

  5. 2

    In my experience, each new language is easier to learn than the previous one. Certain patterns of thinking are developed in the brain, there is no turning back)

  6. 2

    Thanks for writing down about specific cases, it is very useful.
    Tech-lang stack choice is a big part of architectural design. You pick up the right tools for the job, same as in life. Being a polyglot coder is an advantage especially if you aim at harder projects. A piece of advice we all hear often "use what you know" makes sense in building mains-stream CRUD apps when you are mostly probing a market.

  7. 2

    Definitely agree! I tend to do a mini trade study while prototyping on the language before jumping in to development full swing for the very reasons you noted. Otherwise you get down the road and realize you're missing a language feature that would fit hand-in-glove with a problem you're facing, and instead you're trying to shoehorn a Cadillac into a doghouse so to speak with all kinds of brittle workarounds and hacks. Good lesson!

  8. 1

    A language has its own merits, but I would argue there are other aspects to consider. If a language is popular, you will get more help online, and you will find talent easily.

    And if a language is aligned with a current trend, it may help you sell the product you are building.

  9. 1

    Sorry to say , but only beginner will chose bash for app that connects many end points . bash is glue that's it . And PHP for tcp . .. it's totally wrong .
    In this case it's supper matter .
    For web app for example asp or php or other web scripts it doesn't matter ...

    For windows gui it's also matter .. what do you pick ? Qt or electron ? Or opengl GUI ?

    You need to to know what you doing .

    1. 1

      I have a feeling either I haven't done a good job writing the post or you skipped many lines 😅

      1. You don't have to be a beginner to make that mistake even though in the post I do mention that I was inexperienced. An enough experienced developer never thinks of themselves so highly, thinking they never make mistakes
      2. The project I did in bash was not to connect endpoints but rather to execute shell commands
  10. 1

    This comment was deleted 4 years ago