Comparison of programming languages
Programming languages can be compared using several metrics. "Best programming language" has meaning when some metrics are in place to compare. 6 factors here are discusses to compare programming languages. Performance, portability, maintainability, time of development, domain and number of bugs are metrics we consider for reviewing programming languages.
Reviewing programming languages from performance perspective
The difference between compilers and interpreters significantly affect the performance. Moreover not all compiler-based-languages have the same performance. Complier-based-languages (CBL) translate the high level code to final code—either intermediate or machine code– while interpreters keep the original code until runtime. Less process time to decode the produced code of CBL increases the speed of this languages category comparing to interpreter based languages. Depending on the type of final code a CBL produces (machine or intermediate code) the performance may be more or less; Intermediate codes like C# or Java final codes need a virtual machine, JRE for Java and .Net Framework for C#, in order to run and these virtual machines perform much the same interpreters do thus they are slower than a language like C or Assembly. Finally some applications having seemingly the same language may have different performance because of the complexity to decode the final code. To name one Android programs are developed using the JAVA language, but since Android programs need another virtual machine (DELVIK Machine) to run they tend to be slower since Delvik architecture is different than JRE and this causes additional processing.
Programming languages from portability perspective
The type of final code not only influences the performance but also portability. Intermediate codes produced by interpreters are more portable. This means same codes can be run on different platforms without recompilation. The reason is that the code will be once again processed and the virtual machine or interpreter knows how to interpret it for the target platform; C#, JAVA and Python are examples of portable languages. In contrast using C or assembly you have to compile your code in the target platform and publish a version for each platform.
Programming languages and fast development
Putting performance and portability aside one minute, Time of Development (TOD) may be the most important factor that concerns owners. TOD is closely related with cost of ownership; As TOD increases the cost of ownership rises too. Languages usually affect TOD in two ways: ease of usage and tools. Sometimes these factors are to be considered for branches or extensions of a language for example different frameworks of PHP while funded on the same language differ greatly. Ease of usage can buy you a lot of time especially at the first days of development and especially if the time constraint is too tight! For example Symfony web development framework is considered to be harder to learn in contrast to other frameworks like Yii, Laravel and etc. Most companies see the time constraint too tight and because their employees are needed to upgrade their knowledge in order to use these frameworks they simply overlook such a robust powerful platform to use. However when two languages provide the same functionality but one with easier approach it attracts more users. For example while you can do the same with ASP.Net and PHP most novice developers find ASP.NET easier to learn and use it especially because of wizards and drag and drop capabilities.
Figure 3(Time of Development)
In addition to ease of usage, tools play a key role in reducing time of development. A language provides tools through libraries, packages and frameworks. Libraries are the primary tools of language. For instance a math lib with Matrix multiplication functionality can be all one needs and this simple library can buy a lot of time and normally languages such as Python, Perl and Matlab are great in this area. Packages are also one other sort of tools one may use. Examples of packages are Authentication, Search and template switcher for a website project and usually open source languages are more powerful to provide packages for different goals. Last but not the least frameworks are another form of tool one language may provide. Swing for Java, MVC for ASP.Net, Symfony for PHP and even Bootstrap for CSS are great examples of frameworks. For enterprise applications frameworks are essential and the cost to learn one framework and use it is reasonable considering the wide range of capabilities one framework provides. For example although Symfony took more time to learn comparing to a simpler framework like Yii, for a large project the tools it provides justifies learning and using it for development.
Programming Languages' Domains
Although there are no written rules, each programming language is better for a specific purpose. Before jumping to the discussion I want to assert that recommendation of these domains for each language are based on my experience. As a matter of fact results in “A Large Scale Study of Programming Languages and Code Quality in Github” reflect that there is no relationship between the domain of application and the programming language for development in the number of bugs. This means you cannot choose a language for a task because this choice cause fewer number of bugs. Thus here my recommendation is based on the ease of use and the development speed.
C is definitely the best choice when performance is critical. Kernel of operating systems is the best example for usage of C. This is not however the only case study of C. C and C++ are still the leading languages for driver development. Moreover the pointer capability of C makes it the best choice for malware developers. C is also a great language to develop debuggers.
JAVA owes much of his popularity to its portability. Although we mentioned C# and Python as portable languages, the number of stations with installed platform for these languages is limited. On the other hand billions of devices run JAVA. Moreover JAVA is not exclusive to a special operating system as C# does. Long story short, JAVA is the best choice for multi-platform applications. If you want to develop an application for windows, IOS, Linux and even mobile phones then pick up JAVA.
Python is a scripting language and is really handy when it comes to small tasks. Reading a file and producing a new output, piping the output of several programs and executing a command multiple times all can be done easily and quickly by python. These days, python has also gained popularity for hacking. Great number of hackers is attracted to python because of number of helpful hacking libraries in python. Furthermore mathematic and statistical operations in Python is really easy and fast.
C# is the best choice for windows desktop applications. If you’ve ever tried to develop a desktop application for a windows operating system you know how things are simpler with c#. These days ASP.Net MVC also gains popularity. In addition, recently Mono for ANDROID has changed many equations in the software development market. Before Mono C# programmers found themselves limited to develop just for windows but nowadays at least using Mono you can build apps for android devices.
Programming language and number of defects or bugs
The 2015 paper of Devanbu and his colleagues in the University of California, Davis revealed the relationship between languages and the number of reported bugs for the developed applications. The results in this paper first shows that the number of bugs in applications developed with C, C++, PHP, Python and Java scripts are more although the difference is not significant. This is not however the biggest achievement of this paper. According to this paper, bug’s category is more dependent on the language of development. For example C and C++ have greater number of security bugs. C and C++ also count for a high percentage of memory errors. This means if you care for security or you want to develop an application which is highly dependent on memory you may want to avoid C or C++.
Cost is the basic element of every justification in engineering and since programming languages are the foundations of every software development cycle the chosen language for development plays a key role in the final cost. While most of languages can meet the same need the cost which is dependent on factors such as performance, development, maintainability and portability differs. Thus to minimize the cost, the optimum solution is required. I’ve seen many cases during my work experience which team members are just limited to provided solutions of one language. That being said not only being limited to one language blocks their creativity but also leaves a fear in them to be afraid of things they don’t know about other languages. In this article and following ones it’s been tried to gather several factors and case studies to help you choose best programming language for your specific requirement, either you are a project manager or a beginner seeking for a language which suits your needs. One important point to have in mind is that in our comparisons other variables should remain intact while the language of development differs, thus the algorithm and environment are same in our case studies.