Let's start with the common points: all three of them (four of them, if we add Java) use the same principles in syntax: the C way.
C was first, and a history of C will make you understand why C is important. C, however, in its goal to become a portable assembler (a common sense common subset) had other priorities, and wanted to be as close to the metal as possible.
C++ includes all that C has, and adds to that encapsulation, polymorphism, templates and a whole standard library based on templates. Using data containers becomes much easier. The differences between C and C++ are subtle - where you could just assign a void * to a char *, for example, you have to do a proper cast; type checking is more strict in C++. But other than that, C++ is just a cleaner version of C, with OOP and metaprogramming added.
C# and Java discard C for C++. They take C++, throw away the pointer notation, and all variables become hidden pointers (except for the value types, primitive types, due to performance reasons). They add forcibly garbage collection, metadata to your classes, all the objects will be derived from a base class, called object or Object, which adds automatically virtual methods to objects, and they never compile to native code; instead they compile to an evolved machine language called IL for C# and bytecode for Java. This makes them require an interpreter to run said code, and transform it in native code, or just interpret the code and run it like a Virtual Machine. Since probably that was the initial approach, Java's interpreter is called JVM (Java Virtual Machine), while C#'s is called CLR (Common Language Runtime). But in the end, to obtain performance, the interpreters try to actually generate native code, so they all come with a translator of intermediary code to native code. This is the so-called JIT (Just In Time) compilation.
But the interpreted code is a performance issue, and the supporters for the languages create new ways to improve said performance. For example, Microsoft chose to actually run the JIT before even loading some modules, only one time, so when the .NET framework gets an update, you'll see some processes busy for a long time: they will transform your common language code to native code before you even use them, and store a cached version to be available for all programs.
The difference between C#/Java and C is too big, but the differences between C#/Java and C++ are easier to pick and the most important, other than said updates to the language, are the adoption of a pure OOP approach to programming. C# does it less than Java, but Java has these purists that for a lot of time refused to do things non-OOP (and that is usually bad, because OOP is just one paradigm, but it cannot cover everything without huge performance issues).
C# and Java are also 'owned' languages. If you choose C#, you are tied to Microsoft products (although Mono lives on a developers promise from Microsoft and the fact that C# is defined as an ECMA standard). Microsoft drives the language, as well as the .NET framework that actually gives value to C# as a language.
Java used to be owned by Sun, which now has been taken over by Oracle. I won't say more, but as we speak, Oracle has some long standing lawsuit against Google for using Java 'not how we wanted you to use it'. So there's a word of warning there, as well as the fact that Oracle won't be able to drive a language the same way Microsoft does. And C# is really ages ahead of Java.
In the mean time, C++ has this C++11 extension. This extension, and the coming C++14, aims to improve the language, to make it more of a modern language. You can see new smart-pointers, lambdas support, ranged loops and all sort of improvements for the developer that also keep the overhead of not using them to 0. C++ always had this don't pay for what you don't use approach, that makes it a more mature language.
Brajesh KumarPosted Feb 25, 2017, 2:55 AM
C was first, and a history of C will make you understand why C is important. C, however, in its goal to become a portable assembler (a common sense common subset) had other priorities, and wanted to be as close to the metal as possible.
C++ includes all that C has, and adds to that encapsulation, polymorphism, templates and a whole standard library based on templates. Using data containers becomes much easier. The differences between C and C++ are subtle - where you could just assign a void * to a char *, for example, you have to do a proper cast; type checking is more strict in C++. But other than that, C++ is just a cleaner version of C, with OOP and metaprogramming added.
C# and Java discard C for C++. They take C++, throw away the pointer notation, and all variables become hidden pointers (except for the value types, primitive types, due to performance reasons). They add forcibly garbage collection, metadata to your classes, all the objects will be derived from a base class, called object or Object, which adds automatically virtual methods to objects, and they never compile to native code; instead they compile to an evolved machine language called IL for C# and bytecode for Java. This makes them require an interpreter to run said code, and transform it in native code, or just interpret the code and run it like a Virtual Machine. Since probably that was the initial approach, Java's interpreter is called JVM (Java Virtual Machine), while C#'s is called CLR (Common Language Runtime). But in the end, to obtain performance, the interpreters try to actually generate native code, so they all come with a translator of intermediary code to native code. This is the so-called JIT (Just In Time) compilation.
But the interpreted code is a performance issue, and the supporters for the languages create new ways to improve said performance. For example, Microsoft chose to actually run the JIT before even loading some modules, only one time, so when the .NET framework gets an update, you'll see some processes busy for a long time: they will transform your common language code to native code before you even use them, and store a cached version to be available for all programs.
The difference between C#/Java and C is too big, but the differences between C#/Java and C++ are easier to pick and the most important, other than said updates to the language, are the adoption of a pure OOP approach to programming. C# does it less than Java, but Java has these purists that for a lot of time refused to do things non-OOP (and that is usually bad, because OOP is just one paradigm, but it cannot cover everything without huge performance issues).
C# and Java are also 'owned' languages. If you choose C#, you are tied to Microsoft products (although Mono lives on a developers promise from Microsoft and the fact that C# is defined as an ECMA standard). Microsoft drives the language, as well as the .NET framework that actually gives value to C# as a language.
Java used to be owned by Sun, which now has been taken over by Oracle. I won't say more, but as we speak, Oracle has some long standing lawsuit against Google for using Java 'not how we wanted you to use it'. So there's a word of warning there, as well as the fact that Oracle won't be able to drive a language the same way Microsoft does. And C# is really ages ahead of Java.
In the mean time, C++ has this C++11 extension. This extension, and the coming C++14, aims to improve the language, to make it more of a modern language. You can see new smart-pointers, lambdas support, ranged loops and all sort of improvements for the developer that also keep the overhead of not using them to 0. C++ always had this don't pay for what you don't use approach, that makes it a more mature language.
Beyond this, it's all just a big, big flame war.
Anmol ChaudharyPosted Feb 25, 2017, 3:35 AM