Is C better than C ++ 1

C ++ vs. Java

Many ask themselves which programming language is the right one for them: Java? Python? C ++? C #? VB? There is a lot of choice and when looking for information you will find a lot of contradicting information, so the resulting confusion is of course understandable. Before you think about which language you want to use, however, you have to ask yourself the following question: What do I want to use the tool I am using?

If you just want to quickly write a nice GUI and a few functions for a run-of-the-mill program to simplify your life, you can save yourself the work of years of programming C ++ and learn the basics of AutoIt within a few days.

In the following comparison I will mainly focus on the differences between Java and C ++, as many of the advantages and disadvantages of the Java programming language are similar or identical to those of .NET languages. Furthermore, there are two of the most popular programming languages.

comparison

The first big disadvantage of Java and all .NET languages ​​like VB, C # and Co. is that you can decompile them. Each attempt at protection only delays this process. You can imagine it like this: You sit 200 hours at innovative software with a brilliant idea, come up with brilliant solutions and every hobby programmer who is able to google can get instructions and your source code in plain text restore. In the same way, competitors and someone looking for a vulnerability can get detailed information about your program in order to exploit vulnerabilities and steal good ideas.

This is not possible with C ++ or C, you can do reverse engineering, but you never get the source code of the program and you need very specific assembler knowledge and many years of experience.

Another disadvantage is that with Java and .NET languages ​​you are dependent on companies and their arbitrariness. Sun or Microsoft could change their terms and conditions at any time, stop further development and always have the financial aspect in mind. C ++ is not developed by a company, but by a well-known developer by the name of Bjarne Stroustrop and is further developed at meetings of global experts.

A plus point that you saw earlier in Java was that Java is a cleaned up C ++, because you had to manage memory yourself in C ++, had no garbage collection, had to work with raw pointers and many other things were much more demanding. In the meantime, however, with C ++ 11 and 14 you can also produce very clean and easily maintainable code with C ++ that is in no way lagging behind Java, on the contrary, many features that Java does not yet support have been implemented.

The most important advantage of C ++ (and C) is the proximity to the machine and the associated speed. Hardware drivers, high-performance programs and graphics-intensive 3D games are hardly conceivable with other languages, it is not for nothing that Steam, the largest game platform, always installs the C ++ toolkits for every game and only offers a C ++ API for the integration of the stream service. The disadvantage here, however, is that C ++ can quickly become more extensive and complex. It is often not advisable to start programming with C ++, as Java and .NET languages ​​simply lead to results more quickly.

Undefined behavior in the event of errors, memory leaks, extensive exception handling and complex compiling of libraries are not foreign words for C ++ developers, whereas C ++ 11 now almost completely relieves the problems of someone who programs with modern methods and cleanly. Nevertheless, especially here there is the risk of drifting off with classes in C, since many examples on the Internet are out of date and should not be used unless you know exactly what you are doing.

Java cannot offer the advantage of being close to the machine, since it allows bytecode to run over a virtual machine, but this has the advantage that it can be used without problems on any platform without having to make adjustments. C ++ is in principle also for all platforms such as Linux, Windows, Mac, etc. Compatible, but some platform-specific adaptations have to be defined. Another factor that is involved in terms of speed is the JIT Java Compiler, which is in some cases faster than C ++ because it adapts to the CPU type every time it is started and C ++ only offers a general solution, at this point it is the Implementation of the C ++ program is important, as the language offers the developer many possibilities for optimization, which of course is associated with more complexity and effort. Current benchmarks of maximally optimized programs in both languages ​​give in most cases a 2-3 times better result with C ++.

Furthermore, GUI programming can quickly become a Herculean task without a very good library like QT in C ++ and the results are often as beautiful as a car accident. Java and .NET languages ​​can benefit from simple engines integrated directly into the language, which simplify visualization for the programmer with "click-together tools", but are now also possible in C ++ without compromising on quality thanks to QT.

So far, most of the points speak in favor of using C ++, but Java can score points with app programming, among other things. If you do not use the native languages ​​of the mobile operating system, you have to make compromises in many ways, especially in terms of design. Since Android is based on Java, Java programmers can use the SDK to develop and test apps very easily, while the few C ++ libraries that are available for apps have to use the NDK for Android and are therefore of limited use. Here, too, QT provides a C ++ solution to the problem, but the license with full functionality is expensive fun and usually only of interest to companies with commercial projects. Apple's iOS has an in-house language that is very similar to the syntax of C ++.

Conclusion

In conclusion, it can be said that .NET languages ​​and Java score above all for their simplicity and user-friendliness, C ++ is more time-consuming and complex, but can take the longer, especially when it comes to speed, security and sovereignty.

In terms of syntax, neither takes too much, but personally, as someone who does everything depending on the area of ​​application and mainly C ++ programmer, I would say that the latter, once you have understood the context, can be very understandable and beautifully implemented.