Java, C++... can't we all just get along!?

Started by
26 comments, last by dmf_king 20 years, 3 months ago
quote:Since you mentioned templates separately, how exactly does C++ have far more powerful polymorphism (counting out templates)?


Java doesn't have multiple inheritance as C++ has.

A class in Java can only inherit from one single class, but implement several interfaces. A class in C++ can inherit from multiple classes.

- Christoph

---
Teamwork Software - Stuff That Does Something

Edit: Quoted stuff.

[edited by - Captain Nuss on January 25, 2004 3:09:09 PM]
Advertisement
That is not necessarily a good thing...
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
quote:Original post by Anonymous Poster
Since you mentioned templates separately, how exactly does C++ have far more powerful polymorphism (counting out templates)? Java and C++ have the same kinds of polymorphism, i.e. inheritance based dynamic polymorphism and static polymorphism of functions with different parameters.


Multiple inheritance as mentioned by the other guy (and as mentioned by the other other guy, not always that desirable), and also private inheritance (very rarely used and of dubious value, but there you have it).

quote:far easier memory management, dynamic garbage collection, elegant dead reference detection system, memory leak prevention mechanism


You just basically said the same thing four times.

WTF, I''m attacking a Java defender and I prefer Java
quote:Original post by Promit
Java and C++ are both good in their own domain.

The problem is that most people have serious problems determining the bounds of those domains.


Java has major strengths:
1) Complete ideal cross-platformed in the sense that code doesn''t even need to be recompiled in order to run on different OSes and architectures (unless the coder pulled some endian dependent BS).
2) Applets. You can''t find anything quite like em.



You forgot multipass compiler, cleaner code, console like guarantions (like you''d more or less know what would be avilable and you are somewhat isolated from OS craziness. You just need to worry about bad graphic drivers and bugs in VM, not too much about the hardware problems.), and of course much less bugs in your code, easier testing, processor independence, easy maintainace of your programs.

ASM
in comparisson has this advantages
Modularity, possibility of ring 0 programming, acess to the memory ANYWHERE, speed (what you programmed that you''ll get), direct access to the Hardware, reassemblers (x86 to 64 bit)
~_^

Sometimes that difference is in programmers. Java programmers are less likely to think "just in the local optimum" >_<



quote:Original post by Anonymous Poster
quote:Original post by Promit
C++
Far more powerful in terms of [...] polymorphism

Since you mentioned templates separately, how exactly does C++ have far more powerful polymorphism (counting out templates)? Java and C++ have the same kinds of polymorphism, i.e. inheritance based dynamic polymorphism and static polymorphism of functions with different parameters.
In other words, counting everything out that is different between C++ and Java, C++ and Java are the same. Master of the obvious here...

quote:If you meant templates, then let me tell you Java has far easier memory management, dynamic garbage collection, elegant dead reference detection system, memory leak prevention mechanism and more

He said "more powerful", not "easier". If you want easy, don''t use Java.
quote:of course much less bugs in your code, easier testing, easy maintainace of your programs

Exactly what constructs in Java gives me these things?
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
quote:Original post by Raloth
That is not necessarily a good thing...


Oh, there are many times when muliple inheritance is handy.

... like default/common implementations of an interface, flatting out class hierarchies, and easily adding class functionality without screwing up every other class in the inheritance tree.

I think the main reason some people think multiple inheritance is bad is because people where trying to justify Java''s lack of MI when Jave first came out.

For Java, the user of your app must have the JAVA RUNTIME. Most home users don't. And if your app is a small one (A couple megs or less) then it's a major pain in the butt. Should the users have to download many megabytes just to use your little app.

And, by default, java programs don't have an exe file to start them which is what most Windows users are used to.

DISCLAIMER: If any of the above statements are incorrect, feel free to give me a good hard slap

My game: Swift blocks

[edited by - JohanOfverstedt on January 25, 2004 4:58:06 PM]
DISCLAIMER: If any of the above statements are incorrect, feel free to deliver me a good hard slap!My games: DracMan | Swift blocks
quote:Original post by antareus
quote:of course much less bugs in your code, easier testing, easy maintainace of your programs

Exactly what constructs in Java gives me these things?

More readable guess what.

Multiple entry points and better debugers than C ones. gives you the second.

Class encapsulation that is guaranteed with tools that use Java structure to their advantage gives you third.

removed offtopic xxx

[edited by - raghar on January 26, 2004 5:21:02 PM]
>>Something along the lines of multiple inheritance being not necessarily good...

So what? Allocating 2 gigs of memory to a single pointer isn''t necessarily a good thing. Being able to use pointers to anywhere isn''t necessarily a good thing. Having unchecked buffers isn''t necessarily a good thing.

That doesn''t mean they''re necessarily a bad thing. There are many cases where multiple inheritance is an elegant solution to a problem, and C++ provides reasonably powerful and complete facilities for dealing with multiple inheritance properly.

quote:
You forgot multipass compiler, cleaner code, console like guarantions (like you''d more or less know what would be avilable and you are somewhat isolated from OS craziness.


On the C++ side, I also left out the oh so useful preprocessor that does so much, enums, using more than one public class per file, much more powerful memory management abilities, and other things too. The point is they both have plus and minus sides.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

This topic is closed to new replies.

Advertisement