A possible explanation of this difference in availability of infrastructure is the approach to standardization in the two languages. C++ standardization aims to make the language as coherent as possible and to give clean support to abstraction paradigms such as object orientation and generic modelling.
The C++ standard defines the tools for object orientation and generic modelling without reference to the problems that they solve. There are no references in the C++ language standard to specific software development problems or how they might best be solved. Defining a language is complex enough without standardizing its applications. It can be equally argued that if a tool is made specific to a specific problem then the tools is less flexible when applied to other problems.
On the other hand, there is Java, where its inventors have standardized architectures for entire classes of problems. J2EE effectively describes how to architect and implement the distributed transactional systems common in the world of web commerce. The standardized architecture means that each system will have similar applicative layers; all offering the possibility of using libraries and framework solutions for subparts of the problem. The frameworks themselves sit on the Java runtime and as this makes them as portable as Java itself, they can be used wherever it makes sense to use them.
A value of C++ is, as much as possible, to be self-consistent on each and every platform. Databases, XML and other libraries do not exist universally and there is an argument that they should not be included in the language standard because they cannot be provided consistently.
Different platforms have different system interfaces and in all likelihood, the libraries used to allow a framework to function will not always be available. However, this apparently fundamental problem doesn’t stand up to analysis; as we said earlier frameworks present interfaces related to what the developer needs to do.
In the worst case, the implementations behind these interfaces will differ dramatically from platform to platform but if it is not possible to implement the interface then that just means that the platform doesn't support the requisite technology and, as such, is not a valid technology choice.
Furthermore, the presence of a standardised interface means that technology providers can design their technology in conformance to the standard; consequently, the variance from platform to platform shouldn’t be so dramatic. So, when porting the framework it may, in the worst case, be necessary to provide a specific implementation for the target platform but afterwards all code using the framework will function normally.
What we tend to see more in C++ is newer and cooler ways to express algorithms. The Standard library, Boost and many others are impressive for the clever use of templates in combination with more traditional techniques. They provide us with algorithms and types that enable us to hide the mundane mechanics of selection and iteration behind template instantiations and to focus the code on concise and generic operations on data.
However, the argument above is that writing loops and if statements are not the things which take up most of the time when writing code. More time is spent working out the interfaces to external systems and transforming data models from one domain to another. So are the library writers of C++ giving too much focus to cool stuff with templates? Is what we need a little more focus on the less cool problem of interfacing with a database or processing XML? If such infrastructure existed, would C++ be an easier language to learn for newcomers? To summarise, why doesn’t C++ have the same free and high quality, solutions to database abstractions and XML processing that exist in Java?
In the next article, we shall take this abstract discussion to a practical level by looking at this Hibernate framework to see if there’s any reason why it shouldn't exist in C++. We're looking forward to incorporating your points of view so please leave feedback so we can develop this discussion further! ®
C++ does give programmers many brushes with which to paint whereas more recent languages restrict programmers by limiting them to standard frameworks and coding standards. That's why the C's are losing popularity. In these days, processors are measured in terms of giga and terraflops. Memory is measured in gigabytes. We no longer need to worry about tweaking the low-level implementation of an algorithm to eliminate a few constant time pointer redirections (or something) from a loop. We can keep track of the size of a list even if we never have to read it without fretting about performance loss. We can use dynamically sized arrays and not cry about all of the memory allocation and copying taking place. The cost of customizing algorithms for specific implementations no longer outweighs the development costs. Java, Hibernate, Struts, JSF, etc. have succeeded because they simplify development with negligible impact on performance.
I think the biggest difference is that Java supplies simple, understandable and re-usable code. It's written in plain English so developers don't have to commit hundreds of obscure function names to memory (strcpy, printf, sprintf, strcat, cout, endl).
C+++ could be even easier to use than Java if its creators understand that other people have to understand the language they create. Microsoft learned that lesson when updating VB. No more remembering lame function names (left, right, cint, cstr, lcase, sgn, rnd)!
You can ask a construction worker to build a house and he will probably be successful at it. Would _you_ ask him to build _your_ own house? Or would you prefer an architect/civil engineer team?
PhD's have all these abstract ideas that most people fail to understand; let's not say appreciate. BSc's are in the trenches day in and day out doing things that most of us are comfortable dealing with. Would you say that the PhD's are full of it and their work is neither useful or wanted? Would you say that just because you don't get it, what they do is worthless?
Everyone who complains about C++ seems to do so because it's hard to master and use well. You say that Java and C# are great because more and more people are able to use it. The people writing things like Boost, _are_ among the very best that the "very hard" C++ has to offer. What can you deduce from that? Do you think that they should wear one of those T-shirts that say "I'm with stupid" and an arrow pointing up? I'm sorry you feel that it's arrogance. Most likely it's just their ability to think more abstractly and grasp more complex systems easily that makes you feel like that.
Finally, answer me this. Why do you think that the JVM and Visual Studio were written in C++? Let me know when the JVM is written in Java and Visual Studio in C#.
And by the way, just so you don't think that I'm a C++ freak, I, like almost everyone above, do believe that Java is best used for some things... Just not _everything_, like the Java community seems to think.
Not arrogance, artistic flair
Regarding the "spectacular arrogance" of the C++ community, I think this a little unfair! I think it's far more a case of artistic flair - writing in C++ is like having a large range of pastels and paintbrushes to choose from - how low-level you might like an algorithm, which libraries to use, how much you might like to fudge pure OO etc. Conversely, writing in Java is like drawing with a fixed set of crayons - you get a certain range of colours, and you can only draw fairly fixed wide lines. Conversely crayons are non-toxic, while some paints are deadly poisons when misused.
There is far more to implementing a solution to a problem than whether it works or not. If we believed that, all our bridges would look identical, as would buildings. There is also a very important requirement for aesthetics - beauty - and C++ for the most part lets you construct beauty. Whenever I have programmed in Java, I can't say I thought the code as beautiful afterwards - it's a language limitation of not being flexible enough. This was also a problem with Pascal back in the day - it wasn't as beautiful as C. However neither C nor C++ are perfect mediums for expression - I always found LISP to be more beautiful than C, and Haskell has its moments as well.
Many of the 'standard' frameworks for Java tend to have at most two alternative implementations to choose from whereas for almost anything, C++ has half a dozen or more. This tends to mean over the long run that C++ frameworks evolve much quicker through competition and idea cloning. I certainly have found many Java frameworks to be annoyingly designed, clumsy and using inefficient algorithms. If you find that in C++, usually you can choose a different toolkit. In Java, you're generally stuck with what you get and if you need better, you have to go off and reimplement code.
I also disagree with "Java or C# are simply far more productive languages than C++ and that is why they are in the ascendance". A master C++ programmer can always vastly outstrip a master Java programmer's productivity, the problem is that they are far more expensive to employ. The reason for the ascendency is much more an economic issue than technical.
In the end, the other posters are quite right in saying that both have their place and indeed there have been many instances when I have chosen Java for a project. However, I can't say I've ever had as much fun nor satisfaction implementing such projects, and in my mind having fun doing your work is as important as putting bread on the table. Isn't that from where the quality of life is ultimately derived?