The Artima Developer Community
Sponsored Link

Weblogs Forum
The Positive Legacy of C++ and Java

210 replies on 15 pages. Most recent reply: May 9, 2009 2:50 AM by Daesung Park

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 210 replies on 15 pages [ « | 1 ... 5 6 7 8 9 10 11 12 13 ... 15  | » ]
Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 4:22 AM
Reply to this message Reply
Advertisement
> I remember hearing about
> some efforts to build a CPU that would natively run Java,
> but I believe it ended up in the same place with Java OS,
> Java Office and Java web browser.

And no doubt that's the same place the CPU that was being developed in the 1980s, to natively run Pascal, ended up too.

John Wellbelove

Posts: 72
Nickname: garibaldi
Registered: Mar, 2008

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 4:52 AM
Reply to this message Reply
I vaguely remember some microprocessors back in the 80's that were completely stack based and mapped onto the Forth language fairly well.

Krisztian Sinka

Posts: 30
Nickname: skrisz
Registered: Mar, 2009

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 5:30 AM
Reply to this message Reply
> 4) manual memory management. This is a big huge problem
> for the language, not because manual memory management is
> not feasible, but because it does not scale well. The
> solution here is not optional collection (as some might
> suspect from reading the above), but compile-time struct
> introspection: if the programmer was able to visit struct
> members at compile-time, safe generic precise collection
> could have been introduced as a library.

Taking the capabilities of C++ it should be no hard problem to implement a GC library. Or could even better some memory pool design if the problem suggests it.
(Seems the test code for Java strings represented some comments before especially fits to the memory pool design as all the strings are the same size or at least there is an upper bound; do not know not I am not a Java expert).

For me it is not a problem if it is not included in the language. I think the level of granularity opened a huge range of possibilities for the users of C++ making any kind of memory handling scheme.

I am not an expert of hard real time systems but I guess on that field it is high importance to have a predictable run time of all the components.
Anyone here expert on hard real time and used C++ ever? Please correct me if I am wrong.

Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 5:47 AM
Reply to this message Reply
>
> Taking the capabilities of C++ it should be no hard
> problem to implement a GC library.

http://www.hpl.hp.com/personal/Hans_Boehm/gc/

The design of C++ imposes some limitation on how well this can work. Notably it can't compact memory or use copying designs because it can't guarantee to correctly identify all pointers.

Incidentally, I don't think any good GC is easy to implement.

Krisztian Sinka

Posts: 30
Nickname: skrisz
Registered: Mar, 2009

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 6:12 AM
Reply to this message Reply
> Incidentally, I don't think any good GC is easy to
> implement.

I don't either :)
I meant: it is just not impossible to have some solution.

John Wellbelove

Posts: 72
Nickname: garibaldi
Registered: Mar, 2008

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 7:54 AM
Reply to this message Reply
> Anyone here expert on hard real time and used C++ ever?

Our applications are real time. Deterministic allocation and deallocation of resources is important and fits in well with the constructor/destructor syntax. The usual method of managing memory resources in a deterministic manner is to pre-allocate at the start of the app (via constructors) and destroy on close down (destructors). This means that sometimes temporary workspace will be declared as a class member rather than being declared locally within a member function.

David Vydra

Posts: 60
Nickname: dvydra
Registered: Feb, 2004

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 12:27 PM
Reply to this message Reply
> Where Java succeeded that
> so many fail to acknowledge is in the area of team
> development.

Very nice point! The IDEs have also helped. I miss a decent IDE very much when programming in Scala.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 12:44 PM
Reply to this message Reply
> > Where Java succeeded that
> > so many fail to acknowledge is in the area of team
> > development.
>
> Very nice point! The IDEs have also helped. I miss a
> decent IDE very much when programming in Scala.

I want to say that IDE technology incubated around Java but I think the SmallTalkers might be after my head if I do. Let's just say that Java brought the power-IDE into the mainstream and that some of the aspects of the design of Java made certain types IDE functionality easy to implement.

Todd Blanchard

Posts: 316
Nickname: tblanchard
Registered: May, 2003

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 12:50 PM
Reply to this message Reply
RE: Tagged memory.
>
> I believe its usefullness still depends on the kind of
> application you look at. Certain types of numerical
> application are still heavily penalised by this approach.

That class of applications is tiny and the ones where it matters, that portion would be better written as a C library.

Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 12:53 PM
Reply to this message Reply
> matters, that portion would be better written as a C
> library.

So the people who write such code are to be forever condemned to use ancient languages? Thanks very much.

Todd Blanchard

Posts: 316
Nickname: tblanchard
Registered: May, 2003

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 1:01 PM
Reply to this message Reply
> Stroustrup's main goal was
> performance. Objective-C dynamic dispatch method call will
> never be as fast as a C++ non-virtual/virtual method call.

It can be as fast as non-virtual method calling if you use imp caching on time critical portions. This, of course, unnatural and somewhat inconvenient, rather like giving up polymorphism in an alleged OO language for performance reasons.

More about optimizing objective c: http://www.mulle-kybernetik.com/artikel/Optimization/opti-3-imp-deluxe.html

> The run-time environment of C++ and many of the choices
> make perfect sense from a performance point of view.

I disagree with this. 99% of written code is not time critical and does not need maximum performance. If this were not true, Java, Ruby, Python, etc would be stillborn. As long as there is a means of expending a little extra effort on bottlenecks to get closer to hardware and thus faster code, any language can be used for any real time application.

C++'s problem is it thinks 99% of the time everything must be maximally performant and that just isn't true. Wrong tradeoff.

Todd Blanchard

Posts: 316
Nickname: tblanchard
Registered: May, 2003

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 1:03 PM
Reply to this message Reply
> > matters, that portion would be better written as a C
> > library.
>
> So the people who write such code are to be forever
> condemned to use ancient languages? Thanks very much.

C is a pretty modern language. A few years ago, C would have been too slow and you'd be down in the asm.

Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 1:08 PM
Reply to this message Reply
> > > matters, that portion would be better written as a C
> > > library.
> >
> > So the people who write such code are to be forever
> > condemned to use ancient languages? Thanks very much.
>
> C is a pretty modern language. A few years ago, C would
> have been too slow and you'd be down in the asm.

As it happens, the design choices in Java suit me very well. The alternative choices (e.g. no primitives) might well have resulted in a language that I couldn't use or at least it probably would have taken many more years before the implementations reached a usable state for my purposes.

Dirk Starke

Posts: 2
Nickname: oddparity
Registered: Mar, 2009

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 3:18 PM
Reply to this message Reply
> [...]
> If you have a large undisciplined team, then code quickly
> becomes unfathomable as developers add various operator
> overloads classes to save keystrokes -- with little
> thought to clarity.
>
> Seeing "d = ( a + b ) / c;" could mean an arbitrarily
> complex and deep code path in any language with operator
> overloading. In Java you know "there's nothing funny
> going on on this line", just normal arithmetic.
> [...]

I have seen countless lines of horrific and cryptic Java code which did not use generics and operator overloading. It was just done by using variable names like “flag” and method names like “proof”. Is your argument something like “there should be no cars in the world because when people have the opportunity to drive fast they will do so and possibly hurt other people (by accident).”

Dirk Starke

Posts: 2
Nickname: oddparity
Registered: Mar, 2009

Re: The Positive Legacy of C++ and Java Posted: Mar 20, 2009 3:54 PM
Reply to this message Reply
> [...]
> I suspect the readability of Java's rigid syntax was
> indeed part of its success, but the verbosity that goes
> along with that syntax predictability is now one of the
> main complaints people have about it compared to other
> languages.

Could it be that at the time Java was developed its designers were somehow frustrated, perhaps justified, to see bad C/C++/Smalltalk code and designed their language this rigid? Could it be this was an experiment to see if programmers do code better if the language just does not allow "really bad things" like operator overloading?

Well, that experiment failed. Reutilisation of source code is not done more today than it was done in the early 90s. (Perhaps even less. Think of how fast systems are replaced by newer ones today. Did Investment protection increase in the last years?) And we still all love to write source code but not to read it. Seldomly the beauty of someone elses code urge me to salute. Most of the times I just think “That's not nice.”

Flat View: This topic has 210 replies on 15 pages [ « | 5  6  7  8  9  10  11  12  13 | » ]
Topic: Should I use a netbook as my main development platform? Previous Topic   Next Topic Topic: Social Newsfeeds: The Next Big Thing


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us