<snip>
C++ has the 'problem' of pointers and unchecked casts, a problem that never materializes if you use them appropriately, and use other features of the language intended to avoid the real problems of pointers and unchecked casts.
I'm not very familiar with Java, but as far as I know it offers some native threading support. I can imagine that this offers benefits in situations like on server applications.
I'm working in a division that develops some (soft) realtime telco server applications. Most of the codebase is in C++, but one newer application is written entirely in Java. This team claims much faster development cycles, but that's hard to compare directly.
One thing that struck me though was when we got to test out the newest Sun server with their 32-core T1 processor (codename Niagara). All our apps were running on quad processor UltraSparc machines before, so they are all multiprocess or multithreaded. The C++ apps got something like twice the performance compared to the old boxes. The Java app ran at least 8 times quicker. The Java team claimed this was due to the native threading that allowed them to write the application to scale well from the start. On the other hand they've had to search for a decent third-party garbage collector to avoid heavy load spikes when the standard one kicked in every once and a while.
So I'm not sure whether any language is really superior for server apps, but I'm wondering if anyone has more experience with this native threading support in comparison with C++?
All I have to add to that is that the C++ apps must have been written wrong.
Who says C++ doesn't have native threading support? What do you mean by native?
As jsiv noted, C++ itself has no threading. And strictly speaking, C++ cannot even have threading. The library function strtok is not re-entrant, and errno is useless too if taken literally from the standards definitions in a multi-threaded environment. I know, nitpicking, but the C-standard was not written with multi-threading in mind and C++ inherited that.C++ threading mainly comes from the Posix API. It's workable, but you have to be careful to protect all your data with locks, avoid deadlocks and so on.
The Java collections framework (the equivalent to C++'s STL) has many containers in two versions: a thread-safe version and a non-thread-safe version (HashMap versus HashTable for instance).If you try to apply that to some of the STL containers, you always end up writing wrapper classes, so you must always put your concurrency at a high logical level. I was wondering whether Java has improved on that in some way (or any other language)?
If not yet, I feel like native threading and support for scalable data containers could be a major benefit to any langauge. The first language to get that completely right will be a winner in the serer space. It's much more likely to end up in Java than in C++.
Er? C++ doesn't have threading, that is provided by an operating system API (or a wrapper for that). Threading is very low-level though, so unless the goal is to manually squeeze out every last cycle you can, we're really approaching a point where even lower level languages like C++ require parallelism libraries that let you abstract the dirty work away so that you can just (for instance) call parallel_foreach() and have the iteration split up into several threads and managed automatically.
Er? C++ doesn't have threading, that is provided by an operating system API (or a wrapper for that).
As jsiv noted, C++ itself has no threading. And strictly speaking, C++ cannot even have threading. The library function strtok is not re-entrant, and errno is useless too if taken literally from the standards definitions in a multi-threaded environment. I know, nitpicking, but the C-standard was not written with multi-threading in mind and C++ inherited that.
I do have more to say about ASP.NET. But, this isn't an ASP.NET thread. So, I'm not sure I should respond to that, here, or start a new one. Hmmmm.... I'll decide a little later.
Didn't we just get done pointing out C++ doesn't have multi threading support?A new thread would be awesome. I couldn't get bored debating this.
Didn't we just get done pointing out C++ doesn't have multi threading support?
![]()
This is something I was never able to figure out. A supercoder can be easily 20x more productive than an average programmer and churn out much cleaner code. So what's the secret, and how do you find them? I eventually gave up entirely on interviews, qualifications and experience, and just said "show me your code". The great coders whip out 100,000 lines they wrote at home and the not so great mumble something about 'proprietary'. Unfortunately when you impose this filter employment agencies stop sending you people.A great programmer... [is] ...
enormously more productive than a huge team of average programmers with a few mediocre team leads..
That's how you recognize a moron.I think the most dangerous individual is one that determines that a large, functioning code base, needs to be rewritten in some other language in one go.
There's a problem: it doesn't make sense. For example, a thread-safe implementation of STL map<> in C++ runs 100 times slower than a non-thread safe version. But most of the time you want to perform say 10 operations on a map at any one time, and usually you want to access a couple of related data structures as well. It's much more efficient to lock a mutex once, do your operations, and then release. So 99% it doesn't make sense to make containers thread-safe; it's up to the programmer. And in C++ it's foolproof:I feel like native threading and support for scalable data containers could be a major benefit to any langauge.
I see, sharp reply.
Oh, just go FORTH and COBOL up a new thread.*AWKward silence*
This is something I was never able to figure out. A supercoder can be easily 20x more productive than an average programmer and churn out much cleaner code. So what's the secret, and how do you find them? I eventually gave up entirely on interviews, qualifications and experience, and just said "show me your code". The great coders whip out 100,000 lines they wrote at home and the not so great mumble something about 'proprietary'.
Unfortunately when you impose this filter employment agencies stop sending you people.
Absolutely. A great programmer with a mediocre language & environment is much more productive than an average programmer with a great language & environment.
And enormously more productive than a huge team of average programmers with a few mediocre team leads working to a schedule developed by a marketing group.