Choosing a programming language

At the initial stage of creating a program, one way or another, the question of choosing a programming language becomes. Someone chooses a language only from personal preferences, someone just because he knows only that language, someone does not even think about it. However, this development phase is very important, since it may cause problems in the future, but may not arise, depending on how to approach the issue.

I want to note right away that this article is simplified, it does not contain 100% accurate schemes, principles of work. Everything is described in a simplified and schematic way to understand the essence, and not all the subtleties. This article is suitable for beginners who don’t really want to sort out a lot of complex literature, as well as for those who are just going to take the path of programming.

Introduction
At the moment, there are a huge number of languages ​​in any, as they say, taste and color. There are compiled and interpreted languages, there are very simple and just brain-nagging languages, there are serious and comic languages. In general, there are many of them. And each of them was created for a specific purpose. The choice of a programming language during the creation of the program is a very important point, on which very, very much depends - the speed of creating the program, the speed of testing, the ability to transfer to other platforms, the ability to quickly make changes, the speed of execution of the final product, and so on. It is worth remembering that an ideal language does not exist, they all have their positive and negative qualities, which will somehow affect the development process.
So, what are the criteria for choosing a language for your project?

  1. The speed of the final product.
    Programs with a large amount of mathematical calculations, such as modeling physical systems, calculating a large amount of economic data, deriving three-dimensional graphics, and so on, can be demanding on speed of execution. Compiled languages ​​are well suited for these purposes: assembler, C / C ++, fortranetc. Why exactly these? After assembly, the program does not require (roughly) anything superfluous and contains machine instructions that are executed without unnecessary delays. The working scheme of such programs is as follows: 1) the program is executed immediately, so to speak, it is self-sufficient and does not require additional libraries; 2) the program, in addition to its code, contains calls to libraries with machine code (both system and part of the project), therefore, in addition to executing its own commands, the program calls functions from libraries; 3) in addition to cases 1 and 2, the program can work through a layer of drivers that are written in low-level languages ​​and work quickly by default. As you can see, a maximum of 4 blocks are possible in the circuit: program -> libraries -> drivers -> hardware.
  2. The amount of RAM used.
    This requirement appears when a program is developed for embedded systems, mobile platforms, microcontrollers, and so on. In these cases, the less memory a program in a given language consumes, the better. These languages, again, include assembler, C / C ++, Objective-C and others. The list of languages ​​is similar to the list of paragraph 1, since the fewer functional blocks in the execution scheme, the less memory is used on the computer.
    If this requirement is uncritical, then “truly high-level languages” can be used.
  3. Program development speed.
    This requirement arises when the boss says “the program is needed no later than yesterday!” Or some urgency. Then the choice falls on high-level languages ​​with the most humane syntax. This, for example, Java, Flash and the like. In these languages, development time can be significantly reduced due to the abundance of third-party libraries, the most “humanized” syntax, and similar things. The speed of execution of programs written in these languages ​​suffers, and sometimes it is very noticeable. The flowchart using Java as an example:
    A program in the form of bytecode -> virtual machine analyzer -> system libraries -> drivers -> hardware.
    The analyzer is the slowest-running unit in this scheme - it must translate the bytecode of the program on the fly to machine code, while spending a lot of time on the exact definition of the instruction. Therefore, fast development often means slow execution.
  4. Orientation to a computer or a person
    With whom will the program work in the first place? With a man, or with a computer? In the first case, the program should have a powerful graphic part that meets the requirements of design and usability. The development of the graphic part often requires a lot of time, because differs in considerable complexity. Here the difficulty arises in the fact that the output of graphics is a lot of mathematics, which means that there is a demand for speed of execution, and because of the complexity of the development, there is a need for a high-level language. In this case, in my opinion, C ++ / C # is very well suited with their simultaneous and high-level, and speed of execution of programs on them. However, if the GUI is not very complex, but beautiful, it is possible to useJava and Flash , on which the creation of a beautiful interface is much simpler than in C ++ and, especially, C. If the program is primarily focused on “covert work” with a minimum of user interaction, then the choice should fall in the direction of fast languages ​​( ASM, C )
  5. Cross-platform.
    Cross-platform - the ability to run the program on various platforms, in various operating systems with minimal changes. In this area, one can distinguish the following languages: Java, C #, Flash, C ++ with various libraries and other, less used, languages.
    Java was created under the condition that programs in this language should work on any platform where there is a JVM - Java Virtual Machine. Java programs do not require any changes at all - after compilation, you get a .jar file that will work on Windows, Mac OS, Linux, and many more. The situation is similar with Flash, only the list of platforms is much less extensive. With C ++, things are more difficult. In pure C ++ it is quite difficult to write a cross-platform program, the code has extensive redundancy, and its dignity in speed of execution is lost. Cross-platform libraries, for example, Qt , make it easier to achieve the principle of “one code for all platforms”, however, for each platform you need to build the program separately (with different compilers).
    In this section, you can also include interpreted, scripting languages ​​- for their work, you must have a language interpreter in the system. These languages ​​are very convenient in terms of development, but rather slow. The scheme of their work resembles that of Java / Flash, only the analyzer has become even slower - half-machine byte code is much easier to analyze on the fly than human code. It also leads to more memory consumption.
  6. The speed of making changes, the speed of testing.
    The project is developing rapidly, is it constantly being changed, sometimes a lot? Then the choice should fall on high-level languages, where any functional block can be quickly rewritten. To confirm - I think it's much easier to debug the same C ++ than assembler. And even simpler is Java. But there are a lot of subtleties that lurk not so much in the language as in the developer with his programming style and compilers. Nevertheless, the language makes its share in this matter, one way or another simplifying / complicating the work of the programmer.

Conclusion
The topic of choosing a programming language can be inflated to a very large size, listing all the possible and impossible subtleties in this matter. It is also worth considering that large programs can be written in different languages, depending on their functionality. For example, parts critical to speed of work are written in low-level languages, and the graphic part in high-level and slow. In almost every paragraph, the article refers to the languages ​​C and C ++. These are really universal languages ​​with a large number of libraries, with a good speed of work and many other pluses. But, in addition to the advantages, they have a rather big minus - because of this versatility, these languages ​​are quite difficult to learn, have a lot of subtleties (C ++ is more, because it contains more paradigms than C). The Java language is also universal, easier to learn, but it has in my opinion just a huge minus - an extremely low speed. This greatly limits its application: it is better not to write large programs on it because of the emerging need for powerful hardware. Script / interpreted languages ​​are well suited for writing "one-time programs", automating some actions, as well as for working in conjunction with other languages. Assembler - generally speaking, it is a group of languages ​​with similar syntax, but with many different parameters depending on the platform (For example, the x86 assembler is not at all the same as the SPARC assembler). Choosing the right language can also help. Script / interpreted languages ​​are well suited for writing "one-time programs", automating some actions, as well as for working in conjunction with other languages. Assembler - generally speaking, it is a group of languages ​​with similar syntax, but with many different parameters depending on the platform (For example, the x86 assembler is not at all the same as the SPARC assembler). Choosing the right language can also help. Script / interpreted languages ​​are well suited for writing "one-time programs", automating some actions, as well as for working in conjunction with other languages. Assembler - generally speaking, it is a group of languages ​​with similar syntax, but with many different parameters depending on the platform (For example, the x86 assembler is not at all the same as the SPARC assembler). Choosing the right language can also help.wiki article "Comparison of programming languages."

PS I would like to see primarily constructive comments that can complement the article or correct my mistakes (but since I can’t highlight the topic from the sandbox, I won’t be able to select comments). This article is not based on any sources, it was written solely from its own considerations and from its own head.

Also popular now: