DEV Community

Sunbeom Kweon (Ben)
Sunbeom Kweon (Ben)

Posted on • Edited on

When to use the right programming language?

If you know how to use more than one programming languages, there must be a time where you need to choose which programming language you need to go for. Today, I am going to introduce five languages, that I have used and still using: C++, Java, JavaScript, Python and Node JS, and will discuss when to use which.

1. Intro

Before I begin, I would like to share my thought of learning more than one programming languages, because the post's title might seem like I encourage you to deal with many programming languages as much as you can. The answer is solid "NO." As a person who explored many programming languages, I can definitely tell it is good to build your profession first, and then move on whenever you feel it is needed. So again, if you just started learn how to use a programming language, I recommend you to keep up with learning it in depth, I do not encourage you to read this post. But if you already explored many languages and ever had problem choosing one, you are at the right place!

2. Then why are there so many programming languages?

Even though the programming languages do the same job, there are significant differences between those programming languages about HOW to accomplish the job. And there are trade-off between choosing one or another, otherwise, there would be just one perfect programming language that all developers would use. So again, to become a good software developer, it is NOT important to learn many languages. But it IS important to learn why we need the particular language in this particular situation or project.

3. Standards & conditions to check before to choose the programming language

Project perspective

  • Quantities

    • For the most of the time, it is pretty rare to just stick to one programming language for your entire project.
  • Functionalities

    • It is good to break down the project to several components and decide what each component would do.
    • Depends on the functionalities that your team listed for your project, you can discuss and choose which programming language will be the best choice.
    • This works together with deciding quantities of languages for the project.

Language Perspective

  • Readability

    • The essence of all existing programming languages do the same job - either a mediator or translator that is human readable but interpretable as machine code at the same time. Therefore, the readability of a programming language is very important.
  • Scalability

    • Simply means are you going to write less code when you try to improve or redesign your project.
    • This is typically why people like Object-Oriented Programming friendly languages such as Java. But if the developers are too obsessed with merely maintaining the Object-Oriented feature of the project, unnecessary codes will may make the overall project hard to understand.
  • Adaptability

    • You need to question yourself if the language is completely new to yourselves.
    • Such as, do enough people in my team know how to use the language? If not, is the language easy to learn based on my team's knowledge?

4. Language preference based on my experience

I have never developed a complete application with C++ and Java, only console applications for school assignments. So the information here completely based off of my own thoughts, and it may differ from people to people.

Problem Solving (Algorithm interview)

  • 1️⃣ C++

    • Fast, and typed language. C++ supports all necessary standard libraries to write your code explicitly for problem solving. If you know pointer and how to use vector library, I really recommend to solve problem with C++.
  • 2️⃣ Python

    • Born for this. But since it is untyped language and has too many built in functions, when it comes to choosing variable names you need to be careful (e.g. str, min, max, sum, set ... they are all reserved!). Welp, at least for me it was a little bit annoying. Other than that, Python can be very helpful to solve problems since it provides tons of crazy-handy way to modify your list, do loop, substring, and so forth.
  • 3️⃣ Java

    • I personally think Java is not a very nice language for problem solving. Because it requires function too many times (e.g. string.equals(str1) ...), and since it is strongly typed and OOP based language the function names sometimes can be very wordy, which makes the code a little bit overly descriptive.
  • 4️⃣ JavaScript & Node JS

    • Honestly, I do not understand people solving algorithm problems using JavaScript, no matter how much I love the language. The language has too many crazy behaviors related to numbers. For example, you would get a string "Infinity" if you divide any number by zero instead of getting errors.

Object-Oriented Programming (OOP)

  • 1️⃣ Java

    • Java is made and designed for this.
  • 2️⃣ JavaScript & Node JS

    • JavaScript is not OOP language, and the all attempts to fit the language into OOP looked pretty bad. But, since ES6 patch, surprisingly, its OOP experience has been pretty smooth so far (+ TypeScript). JavaScript's OOP syntaxes are almost the same as Java, and super easy to read.
  • 3️⃣ Python

    • Not bad, not good. when it comes to OOP, I do not see why we need to stick to Python except it provides lots of built-in methods in class(e.g. str, eq, ... ) which makes life much easier. Since it is not strictly typed language, it is easy to get messed up when it comes to bigger project.
  • 4️⃣ C++

    • C++ is great for OOP except for the one thing - multiple inheritance. It causes the Diamond Problem. Also personally, it gets pretty hard to track of what I did in classes compared to Java. Also it is a shame that the language does not support interface, just abstract classes (this may be very controversial, but I don't like using abstract classes when we have interfaces)

Web Application

  • 1️⃣ JavaScript

    • You can never build a frontend service without JavaScript, period.
  • 2️⃣ Node JS

    • HTTP backend server running on top of Node JS will make your life easier. The structure of the language will allow you to handle multiple requests with less downtime, and syntax will let you write less code. Also, integration with caching DB, especially Redis is easy. There are tremendous libraries that support Node JS and you can download it very easily using Node Package Manger(NPM). The codes with popular NPM library express.js for backend server has nice structures, and easy to understand. So far, I love using Node JS for backend projects.
  • 3️⃣ Java

    • If you are familiar with object-oriented, Java backend is not a bad choice. It will let you write less code as your project grows.
  • 4️⃣ Python

    • If you need a backend server for computing many logics that don't need immediate responses, Python can be a good choice since it has many built-in libraries. Also supports many web frameworks such as Django. But it may not be a good choice for web servers that need fast response or realtime communication.
  • 5️⃣ C++

    • C++ is a still good language for server development, but not for a web server. Instead, a lot of game servers rely on C/C++.

5. Conclusion

To choose programming language is the matter of later. Make sure to learn any one of them, study in depth, and if you feel like you need to re-structure your project, consider to learn new language and implement them in the language.

Top comments (1)

Collapse
 
_ben profile image
Sunbeom Kweon (Ben)

Hello Nathan, thank you for the comment! I definitely agree with your thoughts, if one knows what she/he is doing, the language would not matter at all. I stick to node js for most of my project, but it is simply because I am interested in cloud computing, and node js has many supports for it.