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, probably best to 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 run on top of a (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 complex, large-scale systems. 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 complex, large-scale systems. 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. I like the C preprocessor very much, find it very useful. It's no coincidence that Python, Perl, PHP, and Linux kernel are 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. However, C++ can be criticized for some poorly designed features. Suitable for making complex, large-scale systems. C++ also uses the C preprocessor. 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 less professional development effort than the other five languages. Also, 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, because much better than 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, has built many real-world applications, and has used the languages listed. Of course, others might have their own reasons for liking / disliking a language. Keep in mind that the programmer, not the language, mainly determines the quality of the source code. It is easy to write bad software in any language. However, some languages (eg, perl) are much more conducive to writing bad (buggy, hard-to-maintain) software. And some languages (eg, C#, Java) are much more conducive to writing good (organized, easy-to-read) software. However, a good (knowledgable, careful) programmer using a "bad" language will typically have a better result than a bad (ill-informed, sloppy) programmer using a "good" language.

In the final analysis, based on my experience, the best languages are C#, JavaScript, C, and bash. I have found C# to be the best-constructed language, even better than Java. I could not function without understanding JavaScript, since it controls the browser. JavaScript is essential, and also a well-constructed language. Instead of writing a Python script, I write a C program or bash script. I do not find writing Python any faster or easier. If you work on UNIX computers, IMO you must become good at bash. However, if you do not work on a UNIX computer, forget about bash, instead consider python and/or PowerShell. I like C because it does just about anything, and I can keep everything about the relatively small language in my mind. In contrast, C# / Java / C++ are very bloated, with lots of "syntactic sugar" and confusing "features". C includes everything needed for procedural programming, and nothing more.

References:

Why Python is Slow: Looking Under the Hood