Java is particularly like C + +; This naturally leads to the conclusion that C + + appears to be replaced by Java. But I have some doubts about this logic. In any case, C + + still has some features that Java does not have. And despite a lot of guarantees, it is claimed that Java will one day reach or exceed C + + speed. But the breakthrough has not yet been achieved (although Java is indeed growing at a steady pace, it has not yet reached C + +). In addition, there are a large number of C + + enthusiasts in many areas, so I don't think that language will soon be replaced by another language (the power of enthusiasts is negligible.) For example, at a "middle/Advanced Java Seminar" I hosted, Allen Holub claimed that two of the most common languages were REXX and COBOL.
I feel the power of Java is reflected in a slightly different area from C + +. C + + is a language that never tries to cater to a certain mold. In particular, its form can be varied to solve different types of problems. This is mainly reflected in tools like Microsoft Visual C + + and Borland C + + Builder (which I like best). They combine libraries, component models, and code generation tools to develop windowing end-user applications for Microsoft Windows operating systems. But on the other hand, what is the most common use of Windows developers? Is Microsoft's Visual Basic (VB). Of course, we are here to mention the VB grammar is very easy to confuse the fact that even a few page length of the program, the resulting code is very difficult to manage. From the language design point of view, although VB is so successful and popular, but there are still many shortcomings. It is best to have the power and ease of use of VB at the same time and not to have code that is difficult to manage. This is Java's most attractive place: as "the next generation of VB." No matter how you feel when you hear this proposition, think about it anyway: people have done a lot of work on Java to make it easier for programmers to solve application-level problems (such as networking and Cross-platform UI), so it essentially allows people to create very large and flexible code bodies. At the same time, given that Java also has the most robust type checking and error control system I have not yet seen in any other language, Java does greatly improve our programming efficiency. There is no doubt about this!
But for a particular project, can you really replace C + + Java without thinking? In addition to Web patches, there are two issues to consider. First, if you want to use a large number of existing libraries (which can certainly improve efficiency), or if you already have a solid C or C + + code base, then when you switch to Java, the reflection will hinder development progress, rather than speed it up. But if you want to build all your own code from scratch, Java simplicity can effectively shorten development time.
The biggest problem is speed. In the original Java interpreter, the interpreted Java is 20 to 50 times times slower than C. Despite a long period of development, this speed has a certain degree of improvement, but compared with C still very wide disparity. The computer's most attention is speed; If you can't work noticeably faster on one computer, you might as well do it with your hands (it is recommended that Java be used during development to shorten development time.) Then use a tool and support library to convert the code to C + +, which can achieve faster execution speed.
To make Java work for most web development projects, the key is speed improvement. At this point, use what people call "Just-in-time" (just-in time, or JIT) compiler, even consider a lower level of the code compiler (writing this book, there are two published). Of course, a low-level code compiler can make a compiled program not run across platforms, but it also brings speed. This speed is even closer to C and C + +. And in Java, Program Cross compilation should be much simpler than C and C + + (theoretically just recompile, but it is still difficult to implement; Other languages have made similar promises).
In the appendix of this book, you can find a comparison with java/c++. The observation of Java status and the content of coding rules.