Comparison of Programming Languages


Introduction:

This page compares and contrasts six popular programming languages: C, C++, C#, Java, JavaScript, and Python. The comparisons are based on my (Daniel Goldman) extensive study and use of all six languages.

Results:

Crierion C C++ C# Java JavaScript Python
Compiled to machine language?     Y         Y         -         -         -         -    
Supports object-oriented?     -         Y         Y         Y         Y         Y    
Supports procedural?     Y         Y         -         -         Y         Y    
Declares variables?     Y         Y         Y         Y         Y         -    
Static variable types?     Y         Y         Y         Y         -         -    
Static parameter types?     Y         Y         Y         Y         Y         -    
Includes preprocessor?     Y         Y         -         -         -         -    
Must be compiled?     Y         Y         Y         Y         -         -    
Pass parameters by value?     Y         Y         Y         Y         Y         -    
C syntax for functions?     Y         Y         Y         Y         Y         -    
Uses C { } syntax?     Y         Y         Y         Y         Y         -    
Case statement?     -         -         Y         Y         Y         Y    
Supports multi-threading?     Y         Y         Y         Y         -         -    
Garbage collection?     -         -         Y         Y         Y         Y    
Runs inside browser?     -         -         -         -         Y         -    
For large-scale development?     Y         Y         Y         Y         -         -    
For large-scale development?     Y         Y         Y         Y         -         -    
Fastest execution?     Y         Y         -         -         -         -    
Slowest execution?     -         -         -         -         Y         Y    
Class privacy model?     -         Y         Y         Y         -         -    
Easier to learn?     -         -         -         -         Y         Y    
Hardest to learn?     -         Y         -         -         -         -    
Uses pointers?     Y         Y         -         -         -         -    
Whitespace matters?     -         -         -         -         -         Y    


JavaScript - highly recommended to learn

JavaScript is a unique language, because the only one to run inside a browser. Also, it is not that difficult to learn. Therefore, it is highly recommended to learn JavaScript. Now, please keep in mind that to use JavaScript effectively, you need to also understand DOM (Document Object Model). But that is a function of the browser, not of JavaScript itself. Be careful programming in JavaScript, beause variables are untyped. Just be consistent. For example, do not initially store an int, and later a string, in the same variable.

Java or C# - highly recommended to learn

Java and C# are basically the same thing. Each is object-oriented, professional, and high-quality. Both required to run on top of JVM or .NET virtual machine. Neither language is compiled to machine language. So not used for producing something like Microsoft Word (not fast or secure enough). Both are very suitable for making a complex, large-scale system. Java improved on C++, got rid of some problematic aspects. In turn, C# improved on Java, got rid of some problematic aspects. Either Java or C# would be very useful to learn.

C - useful to learn

C is unique in the list, since really only procedural. Along with C++, has the best performance. Suitable for making a complex, large-scale system. Does require understanding pointers, which is a stumbling block for many. Also, lacks garbage collection, so easy for sloppy programmer to make hard-to-debug bugs. Can do the functionality of any of the others, except JavaScript. It's no coincidence that Python, Perl, PHP, and the Linux kernel is written in C. C would be very useful to learn.

C++ - useful to learn

C++ is compiled to machine language, and either object-oriented or procedural. Along with C++, has the best performance. Can be criticized for poorly designed features. Suitable for making a complex, large-scale system. Can do the functionality of any of the others, except JavaScript. C++ would be very useful to learn.

Python - useful to learn

Python is useful as a scripting language for writing small programs. It is poorly suited for large-scale development, mostly because it lacks variable typing, and also lacks a class privacy model. Python is also crippled by a significantly less professional development effort than the other five languages. Python decided to diverge from C syntax, for no reason at all, damaging the utility of the language. Basically, Python is an inferior, poorly-designed language. However, it but would be useful to learn, as the lesser of scripting language evils (eg, perl), and because currently quite popular. It is not that difficult to learn, but also less capable, and a breeding ground for bugs.

My personal take

The conclusions are those of someone who has been programming many years and used the languages extensively to build real-world applications. Of course, keep in mind that others might have their own reasons for liking / disliking a language. Keep in mind that the programmer, not the language, determines the quality of the source code. It is easy to write bad software in any language. Some languages (perl) are conducive to writing bad (buggy, hard-to-maintain) software. Some languages (C, C#, Java) are more conducive to writing good software. However, a good programmer using a "lousy" language will typically have a better result than a bad programmer in the best language. The main question is not "which language" but instead "which programmer".

References:

In the final analysis, based on my experience, the best languages are C, C#, JavaScript and bash. I have found C# to be the best-constructed language. I could not function with understanding JavaScript. To me, JavaScript is essential. Personally, instead of writing a Python script, I write a C program or bash script. I do not find writing Python any faster, and this way I do not have to keep the odd Python syntax in my mind. The bash scripts work well because all my development work is on Linux computers. I like C because it does just about anything, and I can keep the relatively small language in my mind, or on a few sheets of paper.

References:

Why Python is Slow: Looking Under the Hood