java vs. C++

Started by
66 comments, last by antareus 19 years, 10 months ago
quote:Original post by dmikesell
quote:Original post by Arild Fines
quote:Original post by dmikesell
Strike two. Still waiting for a serious refutation of what I wrote...

You need to write something serious first. Judging by your history, it seems we are in for a long wait.



Well it was obviously serious enough to get your panties in a wad. You''re just angry because I was right.

Go on thinking that if it makes you feel better.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Advertisement
quote:Original post by dmikesell
Strike two. Still waiting for a serious refutation of what I wrote...

C++ requires discipline or you''ll write code rife with memory errors and leaks. I''d rather not maintain that kind of code, so I''d prefer that undisciplined programmers uses something else. And in most cases I think they do in fact make the switch to something that will help mask their lack of discipline.


I''ll bite

Ever heard of dangling references? In a Java application of any significant size these can easily lead to OutOfMemoryExceptions, are difficult to track down, and very easy to create. A very common mistake made by those with little Java experience.

Ever used Java ByteBuffers? People always forget to flip/rewind, or set them to native order. A very common mistake when writing net code or using a library that makes heavy use of NIO buffers such as LWJGL, and hard to track down for someone who doesn''t know what to look for.

I could go on, but my point is that *programming* requires discipline. A language will never take that away. They can give us safety nets, they can help reduce development time/costs, but there will always be a way for us to shoot ourselves in the foot. Besides, there are plenty of language-agnostic things that require constant attention on a team (coding conventions, CVS merges, etc...), any one of which could cause a stall in the project.

Don''t make the mistake of thinking that programming with Java is easy. I''ll argue that programming with C++ is just as easy. What''s difficult in both languages is programming *well*. And that requires time, experience, and discipline.
quote:Original post by Aldacron
quote:Original post by dmikesell
Strike two. Still waiting for a serious refutation of what I wrote...

C++ requires discipline or you''ll write code rife with memory errors and leaks. I''d rather not maintain that kind of code, so I''d prefer that undisciplined programmers uses something else. And in most cases I think they do in fact make the switch to something that will help mask their lack of discipline.


I''ll bite

Ever heard of dangling references? In a Java application of any significant size these can easily lead to OutOfMemoryExceptions, are difficult to track down, and very easy to create. A very common mistake made by those with little Java experience.

Ever used Java ByteBuffers? People always forget to flip/rewind, or set them to native order. A very common mistake when writing net code or using a library that makes heavy use of NIO buffers such as LWJGL, and hard to track down for someone who doesn''t know what to look for.

I could go on, but my point is that *programming* requires discipline. A language will never take that away. They can give us safety nets, they can help reduce development time/costs, but there will always be a way for us to shoot ourselves in the foot. Besides, there are plenty of language-agnostic things that require constant attention on a team (coding conventions, CVS merges, etc...), any one of which could cause a stall in the project.

Don''t make the mistake of thinking that programming with Java is easy. I''ll argue that programming with C++ is just as easy. What''s difficult in both languages is programming *well*. And that requires time, experience, and discipline.


I agree 1000%, which is why I think Java marketing is so disingenuous. A client where I worked maintained an internal technology page after they switched whole-hog to Java. One of their justifications listed there was that "Java eliminated memory leaks". I got them to modify it and pointed them to an excellent Dr. Dobbs article on the subject.

I think a lot of inexperienced Java programmers have a false sense of security about memory issues.
STICKY

You could do it as ex-infogrames (atari) did on MOO3 boards. Make this sticky and then move all other simillar threads into one big thread. Then again this thread is rather polite.

to DrPizza
Quote:1) JIT is hypothetically superior, but in practice remains broadly inferior (especially when compared to advanced static compilation mechanisms like profile-guided optimization)

I hope you joked in rest of your post.

And there is some benchmark. Are you happy? I think Jeff could be happy too.

Yes JIT in 1.5.0 is still slow, but so is VC 7.1 compiler.
1.5 client / ASM memtest-1953 stacktest-2403 java memtest-2103 java array-6579 1.5 server /ASM memtest-1862 stacktest-2454 java memtest-60 java array-1462 memtest-1883 stacktest-2413 java memtest-0 java array-1433 All data were in L1 processor cache so no problem with memory access.It took 60 ms to eliminate the loop out. That 1433 ms is interesting as well.


Quite funny thread.
What's more interesting than Java vs. C++ is Java vs C#...especially since C# is going to take a solid crack and knocking Java's head off.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Yes JIT in 1.5.0 is still slow, but so is VC 7.1 compiler.

What the fuck are those numbers meant to demonstrate? The VC++ 7.1 compiler is in general the fastest purpose compiler (either static or JIT) for x86 integer code (it seems to beat or level icl, though I've not tried the new icl).

Quote:I hope you joked in rest of your post.

About what? And why?
char a[99999],*p=a;int main(int c,char**V){char*v=c>0?1[V]:(char*)V;if(c>=0)for(;*v&&93!=*v;){62==*v&&++p||60==*v&&--p||43==*v&&++*p||45==*v&&--*p||44==*v&&(*p=getchar())||46==*v&&putchar(*p)||91==*v&&(*p&&main(0,(char**)(--v+2))||(v=(char*)main(-1,(char**)++v)-1));++v;}else for(c=1;c;c+=(91==*v)-(93==*v),++v);return(int)v;}  /*** drpizza@battleaxe.net ***/
There is no comparison between Java and C++. For example Java has multipass compiler. Code maintaince is much better in Java. And so on. Most of major quirks of C++ will appear lately when it's late.

Perhaps this thread should be used for talks about code maintaince, game development, or fast prototyping. Or code recompilation at the runtime. Aka let AI change some code and recompile it.

to DrPizza

I had problem with that expressivnes, and better library words.
From view of ASM programmer both languages have roughly same expressivnes, but C++ forces programmer to type more. ASM, or and possibly halfcript is more expressive.
Talk about library could be pretty long. But this would be pretty boring and lengthly.
I should go back to viewing some anime and don't abuse my Internet connection too much.
Quote:Original post by Raghar
There is no comparison between Java and C++.

We'll see.
Quote:For example Java has multipass compiler.

Okay, but how does this help me?

Quote:Code maintaince is much better in Java.

Or any other language without header files.

Quote:And so on.

So there is "no comparison" between the two languages and now its a hand-waving proof?

Quote: Most of major quirks of C++ will appear lately when it's late.

Ahhhhh, okay. What?

Quote:I had problem with that expressivnes, and better library words.
From view of ASM programmer both languages have roughly same expressivnes, but C++ forces programmer to type more. ASM, or and possibly halfcript is more expressive.

So you admit that you've had trouble with the level of expressiveness allowed by C++, then you say C++ is less expressive than ASM and you mistakenly equate expressiveness with terseness. If you're trying to make a point, don't dismantle it in the next sentence. ;) You did all my work for me...
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis

This topic is closed to new replies.

Advertisement