The Artima Developer Community
Sponsored Link

Java Community News
Kirk Pepperdine: Why Are We Still Dealing with C++ vs Java?

65 replies on 5 pages. Most recent reply: Jun 17, 2006 11:56 PM by Charles Haws

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 65 replies on 5 pages [ « | 1 ... 2 3 4 5 ]
Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Margaritis has been busy (II) Posted: Jun 15, 2006 5:11 AM
Reply to this message Reply
Advertisement
> Entirely my mistake, and am deserving of the criticism. I
> should have known I was asking for it when I made such a
> blanket statement :) What I meant to say was this: C++ was
> designed for speed; there are hardly any safety checks
> (i.e. array bounds checking) that would hamper this speed.
> Nor would there be any security checks to see whether a
> class is trying to circumvent JVM integrity (forged
> pointers etc). Further, C++ is compiled to native
> entirely, unlike the partially interpreted, partially
> jitted approach followed in Java. Under optimal
> conditions, the former should be always faster, simply
> because there is lesser overhead involved.
>
> So the point I was trying to make is, C++ can always
> squeeze out that extra inch of performance. I did NOT mean
> to say that it was impossible to write high performance
> apps in Java. (You can write poor performing apps in C++,
> nothing to stop you., On Java, the upper limit to the best
> performance you can squeeze out is lower than in C++, and
> that's dictated by the design). Of course, how much a
> little bit of extra performance matters over other
> concerns is a matter that must be decided on a
> case-by-case basis.
> I withdraw any statement that might be misconstrued to
> indicate that Java apps cannot have high-performance.

Well, if a project requires so much performance that even such tasks like bounds checking must be turned off, then indeed C++ is faster than Java.

But how important this case is? it is not important at all, because for the majority of cases, even for performance-critical systems, bounds checking is something you wouldn't want to sacrifise in order to get that little bit more performance. Throwing hardware at the problem is cheaper, in the long run.

>
>
>
> Sounds good. Would appreciate more information on your
> experiences.
> a. How much of the code base was written using native
> libraries?

None.

> b. Did you use JOGL? Or some other wrapper?

We used gl4java. No longer supported, though.

> c. Did you spend a lot of time on profiling and
> optimization to get your app to perform well?

Not too much. A couple of tests once the initial video display was up and running.

> d. What hardware did you use? (Did you have to brute force
> your way into performance?)

Linux on Pentium 3 with 128 MB ram, with Geforce 4200, if I recall.

> Whilst your radar console probably warrants a look see, I
> personally think both Swing and SWT apps are sluggish,
> compared to their C++ counterparts.

I agree with that. They feel sluggish. But it is only the UI that it is slow, because Swing implements its own window manager and its own region engine (and region operations produce a lot of rectangle arrays). The underlying application though had very good performance.

The "possibility" of
> good performance is certainly nice. The reality is that
> current java windowing libraries still don't provide
> tolerable performance unless you're willing to expend
> considerable amounts of time tuning performance and
> becoming intimately knowledgeable in the vagaries of
> swing/swt. On the bright side, this performance has been
> getting better and better over the years. This is simply
> my personal experience – personal experiences of others
> I’d like to know (The idea is not to replace truth by
> popular consensus, merely to see how widespread
> high-performing java windowing apps are).

For me it does not matter if the UI is a little on the slow side. The benefits from using Java are enormous.

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Margaritis has been busy (II) Posted: Jun 15, 2006 5:43 AM
Reply to this message Reply
> /* C++ is not a system's programming language. ...
> Initially C++ was meant to be for the business software
> e of AT&T, but they had problems with C, so they proceeded
> to make a new language. C++ was never a system's
> programming language whatsoever.
> */
>
> Stroustrup: "C++ is a general purpose programming
> language with a bias towards systems programming" (
> http://www.research.att.com/~bs/C++.html )

System language my ass. "Bias towards system programming" is a lame excuse for not having garbage collection, bounds checking and limitations in pointer arithmetic. Put those in C++, and suddently C++ is also a business programming language.

It is just that the C++ committee is on the "we know better" boat and they blatantly refuse to see reality, so C++ has been used in very low-level situations.

>
> IBM wrote AIX in C++.

Nope.

> (including the kernel). eCos and other embedded operating
> systems are written in C++. Mac OS X's I/O kit is written
> in C++. But Stroustrup has defined "systems programming"
> to include more than that. Systems programming includes
> compilers, databases, scripting language run-times, or
> other "must be fast, can't fail, can't have large startup
> times other than reading in data, may not have pretty
> interfaes" kind of work. I'm sure you've heard of C++
> projects that fit that definition.

I really like the 'can't fail' part:

1) IT industry suffers billions of dollars from security problems, thanks to the million lines of code written in C++.

2) Can you say "BSOD"?

3) or 'wild pointer'?

4) or 'core dump'?

I have said it before, and I will say it again: the fact that all these programs have been written in C++ does not mean that the programmers did not go through hell to make those programs work.

There is a large percentage of open source written in C++ which is in beta status forever, thanks to C++ and the many possible ways memory can be screwed.

On the other hand, the Java world enjoys millions of LOC written in the last few years, which have their share of problems, but memory mananagement, thank God, is not one of them.

If only C++ had garbage collection...

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Margaritis has been busy Posted: Jun 15, 2006 5:53 AM
Reply to this message Reply
> Hammer, nail, etc. Learn all of your options, so you
> *can* choose the right tool for the job.

"learn all your options" can be viewed as "surrender to the inferior programming languages that are out there with no chance of ever being improved".

No thank you very much. Instead of learning myriads of quirks in every language/library/IDE, I want to use ONE tool. The tool I want to use would cover 100% of my needs, if only it had garbage collection.

> I'm sorry, but that particular argument doesn't quite work
> for me. To my ear, that sounds as if you're saying that
> the fact that he is experienced and *still* dares to
> disagree with you somehow discredits his opinions.
> Experts often disagree because they're coming from
> m different perspectives. Show some respect and you'll
> get more traction.

Or sometimes "experts" are stuck with their own opinion, refusing to see the world evolve.

As for respect...I respect everyone, equally. From the lowest of the lowest to the highest of the highest.

I only do not respect people that are not willing to discuss their view and present their arguments, because they think their view is SO superior that there is nothing to discuss.

In the light of this, has anyone seen Stroustrup participating in this discussion? or reply in many questions/suggestions posted in another topic about the new C++ standard? if they want respect, they can have it by earning it working with us "lesser" mortals.

I am not some kind of sheep to follow Stroustrup's "leadership" as if he is a rock star. Give the man the credit he deserves, but let the negative facts out as well.

>
> Discredit his *argument* instead. Learn it more
> completely first... it sounds like you're not too clear on
> it when you say: "He does not like GC." I haven't
> particularly been paying attention but I know he's got a
> rather more nuanced argument than that.

I have read everything there is, online, regarding GC and C++. If there is something *hidden* that you know and we don't, please share it with us.

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Kirk Pepperdine: Why Are We Still Dealing with C++ vs Java? Posted: Jun 15, 2006 5:58 AM
Reply to this message Reply
> Programming languages are like assholes -- everyone has
> one.

Ehmm...Bright actually has implemented several compilers...unlike some others.

>
> > Excuse me, but do you have any idea about garbage
> > collection? have you ever programmed one? I had...not
> only
> > I have send many versions to mr Stroustrup
>
> Yes, I've written both reference-counting and mark-sweep
> garbage collectors, and spent some time studying the
> subject. But unlike you, I feel no need to pester Bjarne
> Stroustrup by sending him copies of what I've written.

So? what is wrong with that?

>
>
> > Let me tell you this then: GC is much simpler than what
> > most people think.
>
> And much harder to get right, portable, and fast.

No, it is not. Due to its simplicity, it is very easy to be portable, correct and fast.

>
> > And something else: GC in C++ should be
> O-P-T-I-O-N-A-L.
> > How many times do I have to say it?
>
> We're in violent agreement here. And it is "optional"
> (with or without lots of caps and dashes) now.

If you do not like it, then don't read it.

>
> > CMM's 'exact' collection works exactly like mine (I did
> > not know CMM existed before you mentioned it):
>
> I thought CMM was immensely cool for allowing multiple
> collection strategies to cooperate -- I hope you found it
> interesting.

How cool is it to have to declare a mark routine for every class you make? I hope you are only joking.

> Really, if GC is such a time-saver for you, you'll use it
> even if you have to code a bit by hand.

It is not 'a bit'. It is quite a bit. In fact, it is a big effort, that it can easily make one get bored and quit.

Max Lybbert

Posts: 314
Nickname: mlybbert
Registered: Apr, 2005

Re: Margaritis has been busy (II) Posted: Jun 15, 2006 11:13 AM
Reply to this message Reply
> > IBM wrote AIX in C++.

> Nope.

I corrected that one, but thank you. IBM wrote OS/400 for the AS/400 in C++.

However, it looks like we've actually narrowed things down considerably:

(1) you would like compilers with built-in garbage collection because the work you do creates relationships between objects that make manual memory management impossible, and you find library-based garbage collection unacceptable;

(2) I like C++ over Java because C++ allows me several different paradigms to work with (eg., STL's version of functional, object oriented), and in my work the lack of garbage collection isn't a problem.

Java "permits" various paradigms, so long as they're filtered through OOP. I don't really like that, but apparently that's OK for you (just like lack of compiler-provided GC is OK with me).

I don't think we'll change our positions at this point, largely because we're apparently tackling different problems and answering different questions.

Charles Haws

Posts: 24
Nickname: hawscs
Registered: Nov, 2003

Re: Margaritis has been busy Posted: Jun 17, 2006 11:56 PM
Reply to this message Reply
> > Hammer, nail, etc. Learn all of your options, so you
> > *can* choose the right tool for the job.
>
> "learn all your options" can be viewed as "surrender to
> the inferior programming languages that are out there with
> no chance of ever being improved".
>
> No thank you very much. Instead of learning myriads of
> quirks in every language/library/IDE, I want to use ONE
> tool. The tool I want to use would cover 100% of my needs,
> if only it had garbage collection.

Are you saying that what you actually want is C++ with garbage collection? Okay... Try out C++/CLI. Under Mono, it's even portable.

>
> > I'm sorry, but that particular argument doesn't quite
> work
> > for me. To my ear, that sounds as if you're saying
> that
> > the fact that he is experienced and *still* dares to
> > disagree with you somehow discredits his opinions.
> > Experts often disagree because they're coming from
> > m different perspectives. Show some respect and you'll
> > get more traction.
>
> Or sometimes "experts" are stuck with their own opinion,
> refusing to see the world evolve.
>
> As for respect...I respect everyone, equally. From the
> lowest of the lowest to the highest of the highest.
>
> I only do not respect people that are not willing to
> discuss their view and present their arguments, because
> they think their view is SO superior that there is nothing
> to discuss.
>
> In the light of this, has anyone seen Stroustrup
> participating in this discussion? or reply in many
> questions/suggestions posted in another topic about the
> new C++ standard? if they want respect, they can have it
> by earning it working with us "lesser" mortals.
>
> I am not some kind of sheep to follow Stroustrup's
> "leadership" as if he is a rock star. Give the man the
> credit he deserves, but let the negative facts out as
> well.

I'm sorry, but you sound like you're just bitter because he doesn't agree with you.

>
> >
> > Discredit his *argument* instead. Learn it more
> > completely first... it sounds like you're not too clear
> on
> > it when you say: "He does not like GC." I haven't
> > particularly been paying attention but I know he's got
> a
> > rather more nuanced argument than that.
>
> I have read everything there is, online, regarding GC and
> C++. If there is something *hidden* that you know and we
> don't, please share it with us.

Hidden? What? I said that the particular quote which I quoted was not a sound argument. That's all. I suppose you didn't feel it was necessary because you've made the argument elsewhere. Not having seen that because I was new to the discussion, I thought I'd let you know that it sounds like sour grapes.

Flat View: This topic has 65 replies on 5 pages [ « | 2  3  4  5 ]
Topic: Kirk Pepperdine: Why Are We Still Dealing with C++ vs Java? Previous Topic   Next Topic Topic: Gavin King Explains JBoss Seam

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use