For a while, I debated that C is much more efficient than C++ because of it’s compatibility in wide range of systems and no overhead at all unlike Java and C++. I believed that all that object creation and templates in C++ might slow down my program. Even though it is true in some aspects, it is purely based on the compiler and our programming style. I recently started using C++ for my projects and I was amazed with what it can do. With years of C and finally when I started using C++, I was able create code which was maintainable with just few loss of performance and little compatibility which I don’t probably need. I mean why would need my code to run on devices which now only is in a museum. Even though C is faster(just a little) than C++ and supports wide range of devices, in the end of the day it is C++ that gets the work done. I still do many of my projects with C. It’s because most of them are embedded projects and requires C. But when it comes to GUI, I will choose C++ or Java unless I want to spend the rest of my life creating a GUI window in C.
Moreover Java seems to call native functions internally for many of it’s functions. So giving us the same API, it runs on different platforms, promising it’s “Write once, run everywhere” moto. Java still requires JVM to be installed but it is very minimal in size and easily installable.
One could say that assembly is faster, it might be. But compilers optimize code which outperforms human assembly skills. Assembly might be an option if you’re writing Operating System or a compiler. Where writing word processing software or a web browser in Assembly is not. For instance, you don’t want write an app for Android using C/C++, you’ll end up creating up another SurfaceFlinger or HWUI or whatever they call these days. Finally, it all lies in choosing the right abstraction for your software. So, choose wisely. Cheers and Happy Coding!