📜 ⬆️ ⬇️

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 this language, someone does not even think about it. However, this stage of development is very important, as problems may arise from it in the future, and may not arise - depending on how you approach the issue.

Just want to note that this article is simplified, it does not contain 100% accurate schemes, principles of work. Everything is described in a simplified and schematic way for understanding the essence, but not all subtleties. This article is suitable for beginners who do not really want to sort through a lot of complex literature, as well as for those who are only going to step on the path of programming.

Introduction
At the moment there is a huge number of languages ​​for any, as they say, taste and color. There are compiled and interpreted languages, there are very simple and brain sly languages, there are serious and joking languages. A lot of them, in general, there is. And each of them was created with a specific purpose. The choice of programming language during the creation of a program is a very important point, on which very, very much depends - the speed of creating a program, the speed of testing, the ability to transfer to other platforms, the ability to quickly make changes, the speed of the final product and so on. It should be remembered that the ideal language does not exist, they all have their own positive and negative qualities that will somehow influence the development process.
So, by what criteria to choose a language for your project?

  1. The speed of the final product.
    Demands for speed of execution can be programs with a large amount of mathematical calculations, for example, modeling physical systems, calculating a large amount of economic data, deriving three-dimensional graphics, and so on. For these purposes compiled languages ​​are well suited: assembler, C / C ++, Fortran , etc. Why precisely such? After assembly, the program does not require (roughly speaking) anything superfluous and contains machine instructions that are executed without unnecessary delays. The scheme of work 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 those included in the project), therefore, besides executing its own commands, the program calls functions from the 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 by default quickly. As you can see, a maximum of 4 blocks is possible in the scheme: program -> libraries -> drivers -> hardware.
  2. The amount of RAM occupied.
    This requirement appears when the program is developed for embedded systems, mobile platforms, microcontrollers, and so on. In these cases, the less memory a program uses in a given language, the better. Such languages, again, include assembler, C / C ++, Objective-C, and others. The list of languages ​​is similar to the list of item 1, since the smaller the functional blocks in the execution scheme, the less computer memory is involved.
    If this requirement is noncritical, then “true high-level languages” can be used.
  3. The speed of program development.
    This requirement arises when the boss says “the program is needed no later than yesterday!” Or some other urgency. Then the choice falls on high-level languages ​​with the most human-loving 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 very noticeably. Execution scheme for Java:
    Program in the form of byte-code -> virtual machine-analyzer -> system libraries -> drivers -> hardware.
    The analyzer is the slowest operating unit in this scheme - it should transmit the program byte-code “on the fly” to the machine code, while spending a lot of time on the precise definition of the instruction. Therefore, fast development often means slow execution.
  4. Focus on the computer or person
    Who will work with the program 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. Development of the graphic part often takes a lot of time, because differs considerable complexity. Here the difficulty arises in the fact that the output of graphics is a lot of mathematics, which means there is a demand for speed of execution, and because of the complexity of development there is a need for a high-level language. In this case, in my opinion, C ++ / C # fits very well with their simultaneous and high-level, and speed of execution of programs on them. However, if the GUI is not very complicated, but beautiful, it is possible to use Java and Flash , on which creating a beautiful interface is much simpler than in C ++ and, especially, C. If the program is primarily focused on “hidden work” with a minimum interaction with the user, then the choice should go in the direction of fast languages ​​( ASM, C )
  5. Cross platform
    Cross-platform - the ability of the program to work on various platforms in different operating systems with minimal changes. In this area, you can select the following languages: Java, C #, Flash, C ++ with different libraries and other, less used, languages.
    Java was created with 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 where. The situation is similar with Flash, only the list of platforms is much less extensive. With C ++ the situation is more difficult. In pure C ++ it is quite difficult to write a cross-platform program, the code has extensive redundancy, and the advantage in speed of execution is lost. Cross-platform libraries, for example, Qt , make it possible to achieve the principle of “one code for all platforms”, but for each platform you need to build a 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 the scheme of Java / Flash, only the analyzer has become even slower - the half-machine byte code is much easier to analyze on the fly than the human code. It also leads to more memory consumption.
  6. The speed of making changes, the speed of testing
    The project is developing rapidly, changes are constantly being made in it, 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 is much easier to debug the same C ++ than the assembler. And even easier Java. But there are a lot of subtleties that lurk not even in the language, but in the developer with his programming style and compilers. Nevertheless, the language makes its share in this matter, somehow 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 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 that are critical to the speed of work are written in low-level languages, the graphic part is written in high-level and slow ones. The article in almost every paragraph mentions languages ​​C and C ++. These are truly universal languages ​​with a large number of libraries, with a good speed and many more other advantages. But, besides the advantages, they still have a rather big minus - because of this universality, these languages ​​are rather difficult to master, they have a lot of subtleties (C ++ is more, because it contains more paradigms than C). The Java language is also universal, simpler to learn, but in my opinion it has just a huge disadvantage - extremely low speed of work. This greatly limits its use: 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 working in conjunction with other languages. Assembler - generally speaking, this is a group of languages ​​with a similar syntax, but with many different parameters depending on the platform (for example, x86 assembler is not the same as SPARC assembler). An article on the “Comparison of programming languages” wiki can also help you choose the right language.
')
PS I would like to see, first of all, constructive comments that can supplement the article or correct my mistakes (but since I can’t highlight the topic from the sandbox). This article is not based on any sources; it was written solely from its own considerations and from its head.

Source: https://habr.com/ru/post/143556/


All Articles