Tuesday, September 18, 2018

Choose your programming language

C++, Java, C#, Objective C. First we see the differences, hence we can make decisions.

For each language we will try to answer two questions:

  • Performance?
  • Binaries are portable or not.
C++:
  • It is compiled to be executed directly on the machine. That means each machine shall run binaries compiled specifically for it.
  • Hence, the binaries are not portable. And for the same reason, the performance is better.
  • Performance:  😌
  • Portability:     😞
Java, C# and Objective C:
  • Java is compiled to be run on JVM, not to be run directly on the target machine. Hence, the binaries can run on any target, as long as the JVM is installed. For the same reason the performance is less than C++ programs.
  • JVM is available for Windows, Linux and Apple.
  • C# is the same to say like in Java. With the following analogy
    • JVM :: .NET CLR (Common Language Runtime)
    • .NET framework including CLR is primarily supported for windows
      • People may have ported .NET framework to other OSes. But mainly .NET framework is for windows
  • Objective C:
    • Same concept as C#, with the following analogy:
      • .NET CLR :: Othe VM
      • Windows :: Apple OS X
  • Performance:  😞
  • Portability:
    • Java             😌
    • C#                😌 for windows
    • Objective C 😌 for Apple OS X
Also, Java, C# and Objective C giving errors like outofbound and so on, they prevent and diagnose such hard debugging problems. C++ does not do this. Of course this will add overhead to the execution and will degrade performance.

Now we can make decisions:
  • C: use it for small, low level, low sized target codes (Ex: device driver of embedded system).
  • C++, Java, C# Objective C: use it for larger code, for better modularity than C, with reasonable performance degradation.
    • C++: to get the maximum performance of a machine, ex: games, graphics apps that requires high performance.
    • Java: Do not need that high performance? Want to be platform independent and reach all users without installers? Go Java (For all OSes), C#(For windows apps) or Objective C(for Apple OS X apps).

No comments:

Post a Comment