Java, or C++?

Pages: 12345... 7
Database systems are most of the time not CPU-bound. And the parts that sometimes are CPU-bound like encryption or compression are trivially isolated and can be coded even in assembly without touching 99% of high level code (however we found no significant difference between Java and C++ implementations of one of the fastest compressors available: Google Snappy).

Therefore, you don't win really any speed going from Java to C or C++, especially that current JVMs are awesome at optimizing code (most of the time almost on par with C++ compilers for low-level number crunching; and much better for loosely coupled code with lots of indirections and virtual calls; which you can't really avoid in a huge system).

In databases world you win performance by:
1. overall well though system architecture
2. smart algorithms for processing your I/O (distributed, parallel and not moving too much data through network)

That's why MongoDB (C++) will probably never be as fast and flexible as Amazon Dynamo (Java).
C++ is faster. Also, you must consider filesize.
What is with you and filesize? It doesn't matter nearly as much as you seem to think it does - even if Java file sizes were several megabytes larger than C++ file sizes I would still not consider it when deciding between the two languages.
Why do you post on here rapidcoder? I don't care if you think Java is better, but do you really have to come crusading over bashing on it? It seems all you ever talk about on here is how Java is easier, Java is more powerful, etc. You don't seem to ever participate in any other kind of conversation on these forums.

You can have good system architecture done in just about any language. (Except something like Brainf**k lol) C++ may not look as nice and neat compared to Java, but it's still not that bad.
2. smart algorithms for processing your I/O (distributed, parallel and not moving too much data through network
Again I don't really see how this works in Java's favour compared to C++. Algorithms can be easier to express in Java perhaps. I think that if you understand the algorithm you should be able to apply it in any language you know.
closed account (S6k9GNh0)
C++, or any language for that matter, has no notion of "fast" or "availability in jobs". Seriously, stop giving invalid answers. Java can be however fast the JVM is. It could also not be based on a JVM at all. To say Java *the language* is slow is fallacious. Saying C++ is fast is as well.

That said, Java and C++ *in practice* are two different beasts. One is for higher level functionality that insanely does everything through a virtual machine in most cases, the other is a shitty wrapper around C that fails miserably at syntax and compiler-vendor convenience. They both suck in my opinion.
closed account (3qX21hU5)
Austin J wrote:
Why do you post on here rapidcoder? I don't care if you think Java is better, but do you really have to come crusading over bashing on it? It seems all you ever talk about on here is how Java is easier, Java is more powerful, etc. You don't seem to ever participate in any other kind of conversation on these forums.


Why do you post on here AustinJ? I haven't really seen you post much on this forum either other then in the lounge on threads like these? Rapidcoder does have a bias towards Java but who cares? He is very knowledgeable when it comes to programming (More so then most users here including you) just because he likes java better doesn't mean he isn't a good programmer and can't help users here.

If you don't like what he has to say don't read it. Simple as that.
Last edited on
Zereo wrote:
If you don't like what he has to say don't read it. Simple as that.
Ignorance is bliss.
Why do you post on here AustinJ? I haven't really seen you post much on this forum either other then in the lounge on threads like these? Rapidcoder does have a bias towards Java but who cares? He is very knowledgeable when it comes to programming (More so then most users here including you) just because he likes java better doesn't mean he isn't a good programmer and can't help users here.


One, I haven't been on these forums as near as long as you or him, so obviously my total posts won't be as large. The majority of my posts are actually out of the lounge. I wasn't trying to assault him through what I said, it was simply a valid question. I agree he does have a good knowledge of programming, I never said he didn't. The point was that his activity here is questionably un-matching for this website. It's about learning C++ and programming in general. If he wants to argue Java over C++ that is perfectly fine, I simply think this isn't the place to do it.
To rapidcoder, I look at what I said and I could have worded that a bit more politely, my apologies, I wasn't trying to be rude.
If you don't like what he has to say don't read it.


If you don't like what you've already read, don't read it? Huh?

A tiny bit hypocritical isn't it? If you didn't like what Austin wrote, why did you read it and respond to it?
closed account (3qX21hU5)
cire wrote:
If you don't like what you've already read, don't read it? Huh?

From the context of Austin's post, you can tell he associates all of rapidcoders posts with something to do about how java is better then all languages

Austin J wrote:
It seems all you ever talk about on here is how Java is easier, Java is more powerful, etc.
(Which isn't to far from the truth but that is besides the point).

So it wouldn't be unreasonable to think that he could just ignore all posts by rapidcoder since he already knows what is coming.

cire wrote:
A tiny bit hypocritical isn't it? If you didn't like what Austin wrote, why did you read it and respond to it?


Ya it probably is hypocritical, but then again I'm not the one that is somewhat telling someone else not to come to these forums and post here because I don't really care for what they are saying ;p.
Last edited on

Again I don't really see how this works in Java's favour compared to C++. Algorithms can be easier to express in Java perhaps. I think that if you understand the algorithm you should be able to apply it in any language you know.


Agreed, but distributed database algorithms / query optimization algorithms are extremely hard. Coding them in Java is hard enough, but coding them in C++ is even much harder, because not only you have to get the algorithm right, but also all those tiny subtle technical details like memory management, thread control, all those copy-constructors, exception safety etc., and it is all quite verbose and easy to screw-up.

Personally I feel like Java is still too low-level for most of this stuff, particularly because this kind of code usually doesn't need to be 100% efficient, but it does need to be 100% correct and reliable. Getting only 50% of the maximum possible speed wouldn't matter, because it would be shadowed by the I/O cost. But getting 0.001% of use-cases wrong or a tiny 10B/request memory leak would be a disaster.


You can have good system architecture done in just about any language


Right, but C++ complicates it. E.g. not really having to think about *ownership* of objects is a great simplification when designing internal APIs, especially if you need lousy coupling of components.


If he wants to argue Java over C++ that is perfectly fine, I simply think this isn't the place to do it.


See the thread-title. What is a better place to discuss Java vs C++ than a Java vs C++ thread? ;)
Last edited on
rapidcoder wrote:
But getting 0.001% of use-cases wrong or a tiny 10B/request memory leak would be a disaster

At one point we dumped Java (in favor of C++) exactly because this kind of correctness was easier to prove with C++ (and on that job, getting a use case wrong meant people got hurt and sued).
Last edited on
closed account (1yR4jE8b)
[citation needed]
Well, I can't really argue with what you said on that rapidcoder lol. I guess at that those 2 it would be a matter of personal preference. You did get me at 3, I probably should have mentioned that I think these threads are generally bad. Mostly seems to get out of control on StackExchange though, it seems to have gone ok on here.
So it wouldn't be unreasonable to think that he could just ignore all posts by rapidcoder since he already knows what is coming.


Yet, people respond to rapidcoder's zealotry. Should he ignore all posts by all people who respond to him as well?


Ya it probably is hypocritical, but then again I'm not the one that is somewhat telling someone else not to come to these forums and post here because I don't really care for what they are saying ;p.


How is telling someone what they should and shouldn't read (thereby also restricting what they should and should not comment on) any better? And, correct me if I'm wrong here, but didn't you make that post because you didn't like what he said?
Guys, I did not mean to start a war. Why does everyone seem to be so religious about the pros/cons of the languages?

Is not the answer to my question fact?

Please save the arguments for what's better. Forget I asked that.

I will ask a more straight forward question:

What are the pros/cons of each language (FACTS, not your opinions)?
What (have you seen)/(are) these two languages used for?



Lets keep calm. :)
Last edited on
Well you should have expected this.
closed account (3qX21hU5)

Rapid coder, you have thrown this entire thread off-topic. If you do it again, I will report you.

Lets keep calm. :)


Lol that made me laugh. Its the lounge.... what do you expect threads never stay on topic here. Eveyone would be banned by now if we all got reported for thowning a thread off topic lol. You also should have expected it to go off topic when you posted this thread.

@cire

It was more meant to be a suggestion then telling him to do something. But you are right both are the same.

I just don't get why people get on rapidcoders case. He posts in the lounge usually which is meant for non C++ related topics but yet if he posts something about java its somehow wrong because its on a C++ forum. Its not like he is going to the beginners section and trying to tell everyone that "Hey this would be so much easier in Java", or at least not that I have seen.
Last edited on
What are the pros/cons of each language (FACTS, not your opinions)

Nearly every significant language feature that is different between the two languages will be described as a "pro" or as a "con" depending on who you're talking to. Their approaches to resource management, to concurrency, to encapsulation, to error handling, even something as basic as expression evaluation or parameter passing: it's all different and opinions differ as well.
It can't really be otherwise: if some feature is a factual "con", it will get removed or replaced, since both languages have been evolving.
If I am not mistaken you asked what language start to learn. I answered you if you want to select a more effective path you should start to learn Java. So it is not clear what are you else awaiting from this thread?
Pages: 12345... 7