The Artima Developer Community
Sponsored Link

Weblogs Forum
The Positive Legacy of C++ and Java

210 replies on 15 pages. Most recent reply: May 8, 2009 11:50 PM 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 2 3 4 5 6 7 8 ... 15  | » ]
Kirk Pepperdine

Posts: 5
Nickname: kcpeppe
Registered: Jun, 2003

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 1:24 AM
Reply to this message Reply
Advertisement
Wow Bill, you wrote a book! ;-)

> I remember asking this Gosling
> in one of my interviews of him why he left out operator
> overloading

Why didn't you ask him why he included operators in the first place. With no operators this problem goes away ;-)

> Bill Venners: Why are there primitive types in Java? Why
> wasn't everything just an object?

Great question!
>
> James Gosling: Totally an efficiency thing. There are all
> kinds of people who have built systems where ints and that
> are all objects. There are a variety of ways to do that,
> and all of them have some pretty serious problems. Some of
> them are just slow, because they allocate memory for
> everything. Some of them try to do objects where sometimes
> they are objects, sometimes they are not (which is what
> the standard LISP system did), and then things get really
> weird. It kind of works, but it's strange.
>
> Just making it such that there are primitive and objects,
> and they're just different. You solve a whole lot of
> problems.

This is a complete coupling between representation and implementation which we all know is a bad idea. More over, there were good examples of where primitives as objects compiled to primitives worked very well and were not strange at all. Smalltalk compiled Integer to a primitive which was known as an immediate direct. Smalltalk out performed Java back then so the performance argument is questionable. What isn't questionable is the hacks such as autoboxing that we've had to resort to in order to work around the limitions imposed by a non-normalized langauge. I'm glad to see that Scala got this one right.

Carfield Yim

Posts: 32
Nickname: carfield
Registered: Sep, 2002

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 1:31 AM
Reply to this message Reply
In fact I like to learn more about "because C++ has both stack allocation and heap allocation and you must overload your operators to handle all situations and not cause memory leaks"

Anyone know more detail about it?

John Wellbelove

Posts: 72
Nickname: garibaldi
Registered: Mar, 2008

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 2:26 AM
Reply to this message Reply
> Java strengths:
> ......
> garbage collection
>

I'm afraid I've never really bought into this one. It often seems to come over as a sort of Java religious chant, in that the implication is that no language can be any good without it.

I've coded in C++ for a good number of years using modern C++ techniques (RAII, smart pointers) and, for me, it just not an issue at all.

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 2:37 AM
Reply to this message Reply
> Stuff like Java's heavy, almost overly forceful, object
> orientation, where encapsulation, inheritiance,
> polymorphism, and design by contract, are heavily enabled
> have caused Java to be great for team development,
> maintainability, and extensibility.

Java has "design by contract"? Have I missed something?

Jeroen Wenting

Posts: 88
Nickname: jwenting
Registered: Mar, 2004

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 3:52 AM
Reply to this message Reply
> > Operator overloading is one of those features that's
> great
> > if you're on a one man project where you can make all
> > these decisions wisely for yourself as the
> > maintainer/reader -- and a horror for a large team.
>
> I think this is excessive worrying. Python has operator
> overloading and I have never heard of a single horror
> story
> about it.

That's because pretty much all Python projects are one man projects :)

Michele Simionato

Posts: 222
Nickname: micheles
Registered: Jun, 2008

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 4:05 AM
Reply to this message Reply
> > I think this is excessive worrying. Python has operator
> > overloading and I have never heard of a single horror
> > story
> > about it.
>
> That's because pretty much all Python projects are one man
> projects :)

I wish! ;)

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 6:44 AM
Reply to this message Reply
> Point is, there is still a lot of life in Java, it's just
> not so exciting as it was.

I wish I could believe that but I see a steady stream of people moving away from Java (including myself.)

Java used to be a language used by people who wanted to get stuff done (I'm ignoring all the EJB nonsense for now.) If you wanted to flex your nerd muscles, Java wasn't really a good choice.

Personally, I've already sunk way too much time into Java generics for little benefit. And there are so many cases where you are fighting with the compiler and screaming (metaphorically) at it "shut up! shut up!" There are probably still some people who believe that you can always get your Java code to compile without warnings and without using @SuppressWarnings("unchecked") but their numbers are dwindling.

It's not something that can be undone. Java generics is a complete disaster and marks the beginning of the end for Java as a dominant language.

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 7:16 AM
Reply to this message Reply
> Java used to be a language used by people who wanted to
> get stuff done

I like Java without Generics. It has a C-like feeling, where void* is used where polymorphism is required. The code is simpler and nicer.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 7:52 AM
Reply to this message Reply
> > > Operator overloading is one of those features that's
> > great
> > > if you're on a one man project where you can make all
> > > these decisions wisely for yourself as the
> > > maintainer/reader -- and a horror for a large team.
> >
> > I think this is excessive worrying. Python has operator
> > overloading and I have never heard of a single horror
> > story
> > about it.
>
> That's because pretty much all Python projects are one man
> projects :)

I tend to think that Python is not a good choice for large projects but I think that part of the reason operator overloading tends to work in Python is the culture around Python. There's lots of good advice about when to overload and when not to and how to overload common operations properly.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 8:06 AM
Reply to this message Reply
> > Java used to be a language used by people who wanted to
> > get stuff done
>
> I like Java without Generics. It has a C-like feeling,
> where void* is used where polymorphism is required. The
> code is simpler and nicer.

Generics could have been a welcome addition if their semantics were consistent with array variance. Really it's quite ridiculous when you think about it. There are millions of lines of Java that work just fine without generics. I think type safety has value but it's a case of diminishing returns. That it was worth creating all the complexity of java generics to ensure type safety (which it doesn't actually achieve, BTW) is insane.

I actually bought into Java generics for a while. I followed it's evolution from before variance was introduced. At some point it just clicked with me that it wasn't worth the trouble.

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 8:31 AM
Reply to this message Reply
> Generics could have been a welcome addition if their
> semantics were consistent with array variance. Really
> it's quite ridiculous when you think about it. There are
> millions of lines of Java that work just fine without
> generics. I think type safety has value but it's a case
> of diminishing returns. That it was worth creating all
> the complexity of java generics to ensure type safety
> (which it doesn't actually achieve, BTW) is insane.
>
> I actually bought into Java generics for a while. I
> followed it's evolution from before variance was
> introduced. At some point it just clicked with me that it
> wasn't worth the trouble.

The only thing Java Generics is good for is that it saves you a little bit of code (casts, instantiation of classes for primitives, etc) and it makes the code a little bit more readable. Not very important in the context of Java.

Jeff Ratcliff

Posts: 242
Nickname: jr1
Registered: Feb, 2006

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 8:35 AM
Reply to this message Reply
I always thought that Java (like many post-C languages) has "hidebound" compatibility with C. In other words, ugly C syntax and idioms were retained to please C programmers and the language is less than it could have been as a result.

I don't know much about the JVM internals or how other languages use the JVM, but I was wondering if Sun's philosophy of backward compatibility at all costs has limited or will limit the ability to implement other languages through the JVM.

Jeff Ratcliff

Posts: 242
Nickname: jr1
Registered: Feb, 2006

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 8:43 AM
Reply to this message Reply
> "Java brought the mainstream of programmers into the world
> of garbage collection, virtual machines and a consistent
> error handling model"
>
> Not to mention, design by contract. Up until then, only
> academic languages carried that flag forward.

Eiffel was the first to use design by contract.

Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 9:37 AM
Reply to this message Reply
> I've coded in C++ for a good number of years using modern
> C++ techniques (RAII, smart pointers) and, for me, it just
> not an issue at all.

There is no shortage of applications where RAII and smart pointers do not suffice. These techniques require a strict singular ownership of data which is sometimes less than convenient.

Carson Gross

Posts: 153
Nickname: cgross
Registered: Oct, 2006

Re: The Positive Legacy of C++ and Java Posted: Mar 17, 2009 10:06 AM
Reply to this message Reply
> Generics could have been a welcome addition if their
> semantics were consistent with array variance.

*ding*

I remember making fun of java for array variance when I was a younger man in school. I was dead wrong, and so were my teachers.

I'm willing to forgive java an awful lot for making every object in the system able to be a key in a Map. That stroke of genius even almost makes up for making every object in the system into a monitor.

Almost.

Cheers,
Carson

Flat View: This topic has 210 replies on 15 pages [ « | 1  2  3  4  5  6  7  8 | » ]
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-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use