What are the strengths of each programming language?
Any generic programming language can be used to solve any problem. However, most languages can be more appropriate for certain tasks.
That being said, if you master one language (truly master, see skill-matrix), stick to it, even if the language is less appropriate for the project.
Additionally, if in the project, you're likely to work with others (in a company or in an open-source project), you have to consider other factors like:
- how easy it is to find contributors / employees
- what do the current contributors want and know
Most reasonably complex projects will actually need more than one programming language. Which languages to choose then?
It's rather simple:
- write down the list of problems and/or domains you need to cover
- for each problem/domain, choose a language which most contributors are comfortable with, and
- minimize the number of languages used (meaning: make compromises at the expense of not choosing the “best language” for each problem)
C is typically used in projects like:
- embedded programming
- kernel and driver development
- creating and extending other programming languages
C is a good first programming language if you want to later go into areas where other compiled languages are typically used.
It's also a good language for learning generally about programming and operating systems. It's a rather small language, but it opens many doors in terms of developing your understanding.
Knowledge you gain with the help of C is many times transferable to other languages. Many teaching materials explain other languages using concepts from C.
C++ is typically used in big but high-performance projects. The reason is that it has the same characteristics like C, but it offers additional abstractions like OOP.
The caveat of choosing a language “meant for performance” is thinking that you'd have a bottleneck in performance. In a huge number of projects, the performance is never a core problem, but rather I/O.
So don't rush to use languages like C++. Being a great programmer at C++ takes 10 years, because it's an old language with a lot of baggage.
Thus, my advice is generally: resort to other languages, if you're not great at C++, until you are really stuck with the performance. And even then, just try to optimize the slow parts by rewriting them in C or C++.
Most of the times though, you get a big boost in performance not from the language, but by using more appropriate algorithms and data structures.
PHP is typically used in web projects.
Scalable applications in PHP require a lot of additional plumbing, but the feedback loop is shorter. PHP is also one of the fastest scripting languages for the web.
The “feedback loop” is the time between when the programmer types a few lines of code, and the time he is able to test/see the end results.
The language has quite some baggage, but modern PHP (version 8, even 7) is much better. Sure, many of the problems outlined in PHP: a fractal of bad design are still true, but I would say that the most pressing problems have been alleviated in modern PHP.
PHP is a good contender for Java. PHP Programmers do tend to be less competent than Java programmers, but they also tend to be less expensive. Use PHP if you have a strong culture for quality.
Java is typically used in:
- app development for android
- enterprise applications
Advantages of Java:
- powerful plugin/module system
- good performance
- enterprise features
- longer development feedback loop
- memory-hungry processes
It can be used in two ways:
- as a browser or scripting language; in this case, JS is used for programming the browser, and it is paired with another language like PHP, Python or Java, for backend programming
- as an universal language, in which case you use it inside nodejs or deno as well as in the browser
The performance is relatively low, and when used as an universal language in an async manner, you typically get messy code.
Python is typically used for:
- prototyping solutions
- machine learning
- as a glue language in areas like DevOps, system administration, etc
- poor performance
- does not offer the means for ensure contracts
- easy to extend
- used in many areas
- great as a first scripting language, because it reads like pseudo-code
- many packages
For prototyping solutions, what you usually end up doing is creating a prototype that works, and the optimizing performance-sensitive parts by rewriting them in C.