Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java for C++ Programmers

2 views
Skip to first unread message

Mark Wilden

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:oo6m4.6707$my1.1...@news4.giganews.com...
> Are there any Java books out there tailored towards the experienced C++
> programmer?...So is there anything out there that fits the description
> of what I'm looking for, or do I have to read a typical beginning Java
book
> like Core Java or Just Java?

As someone in the same position, I recommend Just Java. It's not specific to
people moving from C++, but it's clearly geared toward someone who knows how
to program already. I found it very useful to get up to speed with Java.

Mark Wilden

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:yn7m4.3851$OI1.1...@news5.giganews.com...
> Oh and [Java] wasn't developed "from" C++, it just uses a similar syntax.

That's like saying that Visual Basic wasn't developed from Basic. Clearly,
the goal with Java was to make a better C++, just as C++ was developed to
make a better C. Or are the syntactical similarities (of which there are
more than there are differences) purely coincidental?


Carl Rosenberger

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
The first hint:
Have a good look at the Java-Glossary, especially "Getting Started".
http://mindprod.com/gloss.html
It might make sense, to download the whole Glossary.

> I don't "automatically" know Java since I know C++. I automatically know
> Object oriented programming since I know C++, but I certainly don't
> automatically know an entirely different language. Let me clarify by
> giving a few examples of things that I'd like to know but that your post
did
> not explain to me.

> 1) The syntax of the language.
The best book I know, is "Java in a Nutshell".
But instead, I would suggest, you download a Microsoft VJ++ 30 day
Trial-Version.
Help includes the complete Java specification.
If you fly over that, you`re set.
Intellisense helps you to inspect classes and functionality.
Keep away from wfc to stay platform-independant.

> 2) Java has multithreading built into the language. In C++ an entirely
> different approach is taken to writing multithreaded applications. It
would
> be nice to know how to exploit and take advantage of this aspect of the
> language.
If you really need multithreading, it`s a tough theme.

> 3) Writing COM components from Java. I think this has something to do
with
> JavaBeans, but being that I don't know the language I can't really say.
Now you`re starting to drift off from the *language* to specific libraries
and tools.

With VJ++ you can build COM-components with a few mouseclicks.
VJ++ builds a TypeLibrary for your Java-Classes so you can access any public
method.

The "real" Java-ways of handling distributed objects are CORBA and RMI

> 4) The JDK and the various objects and utilities it provides.
Lots of versions of the JDK are available for download at sun.com
Unfortunately only something like 1.4 runs with VJ++.
But thats perfectly allright for learning and it`s included with VJ++.
"COM" sounds like you prefer the windows platform.
You can get a Windows-Help on the JDK at www.confluent.fr/javadoc.
A good HTML-Help is available at sun.

> 5) What Swing is.
Swing is a visual class library.
Widgets are very nice and advanced.

> 6) What the AWT is and how to design complex UIs using it.
AWT is a more elementary collection of platform-independant window-classes.

> 7) JAR Files
JARs are compressed classes. It`s just like ZIP with a manifest file.
Microsoft uses ZIP and CAB instead.

> 8) How Java implements exception handling.
Very nice:
try{ some code }
catch (Exception l_ex)
{ some more code}

> 9) Java networking.
That`s RMI

> 10) etc...
You`ll get more ideas if you start coding.


Hope this helps

Carl


Andrew R. Thomas-Cramer

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to

Java borrows syntax from C and C++, but it's semantics are from SmallTalk.

I suspect the former was intended at least partly for marketing purposes.
There were more C/C++ programmers than SmallTalk programmers. Java's
similarity to C/C++ makes it more familiar and accessible to C/C++
programmers. The similarity allowed it to appear as a next generation of
the then leading languages. These factors increased its chances for
popularity.

Mark Wilden wrote in message ...

Hydra

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
In article <s9j1i1...@news.supernews.com>, mark_...@yahoo.co.uk
barfed...

> That's like saying that Visual Basic wasn't developed from Basic. Clearly,
> the goal with Java was to make a better C++, just as C++ was developed to
> make a better C.

Tell that to Bjarne and he'll kick yer ass :-)

Niels
--
Mail: hydr...@wxs.nl
Page: http://home.conceptsfa.nl/~hydra/
"One Ring to rule them all, One Ring to find them,
One Ring to bring Them all and in the darkness bind them
In the Land of Mordor where the Shadows lie."

Mark Wilden

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to

Andrew R. Thomas-Cramer <ar...@prism-cs.com> wrote in message
news:3899b275$0$88...@news.execpc.com...

>
> Java borrows syntax from C and C++, but it's semantics are from SmallTalk.

I guess it's just a matter of opinion, but I'd say Java did more than just
"borrow" C++'s syntax.

> I suspect the former was intended at least partly for marketing purposes.

Personally, I suspect that it was mainly intended simply because the C++
syntax is neat and compact. It's clear that C was a language written for
programming in, rather than to teach programming or to be in some way
"pure".


Mark Wilden

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
Hydra <hy...@studenten.net> wrote in message
news:MPG.1303deae2...@news.wxs.nl...

> In article <s9j1i1...@news.supernews.com>, mark_...@yahoo.co.uk
> barfed...
> > That's like saying that Visual Basic wasn't developed from Basic.
Clearly,
> > the goal with Java was to make a better C++, just as C++ was developed
to
> > make a better C.
>
> Tell that to Bjarne and he'll kick yer ass :-)

The designer of the language originally known as C With Classes? I don't
think so...

Zachary Turner

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
> > > That's like saying that Visual Basic wasn't developed from Basic.
> Clearly,
> > > the goal with Java was to make a better C++, just as C++ was developed
> to
> > > make a better C.
> >
> > Tell that to Bjarne and he'll kick yer ass :-)
>
> The designer of the language originally known as C With Classes? I don't
> think so...

It's true that C++ was originall called C with classes, but it soon became
apparent that C++ and C were entirely separate beasts. So yeah maybe it was
ORIGINALLY designed to be "a better C", but is much more than that now. C++
has now evolved to the point where it is _so_ different from C that it
really can be considered an entirely separate language, just as Java and C++
are entirely separate languages. The only thing the two have in common is
basic syntax. The novice programmer might respond "Well, what else is there
besides syntax?", but of course that is what makes that person a novice
programmer. C++ opens the door to a whole new world of complex programming
paradigms that C could never even dream of. I've not the time to go into
any more detail because I've got to run to a meeting, and this isn't the
right newsgroup for a C++ debate anyway, but I just thought I'd throw in my
2 cents.

Zachary Turner
Software Development Engineer
BindView Development Corp.
www.bindview.com
(713) 881-9350

Steve Chapel

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
news:s9jk3u...@news.supernews.com...

>
> Andrew R. Thomas-Cramer <ar...@prism-cs.com> wrote in message
> news:3899b275$0$88...@news.execpc.com...
> >
> > Java borrows syntax from C and C++, but it's semantics are from
SmallTalk.
>
> I guess it's just a matter of opinion, but I'd say Java did more than just
> "borrow" C++'s syntax.

It depends on what parts of the language you're talking about. I think Java
borrowed from C++ slightly in the syntax for OO programming, and the
semantics are significantly different. But Java's operators are almost
exactly the same as C and C++, in syntax and semantics.

Java is so similar to C (in syntax and semantics) that I was able to take a
1000 line C program I'd written, put it inside a Java class, change the
functions to static methods, and make a few other minor changes, and I
suddenly had a working Java program! Converting any of my C++ programs to
Java would be much more painful.

Steve Chapel

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
"Zachary Turner" <ztu...@bindview.com> wrote in message
news:1E83A827820A81A6.C113C346...@lp.airnews.net...

>
> It's true that C++ was originall called C with classes, but it soon became
> apparent that C++ and C were entirely separate beasts. So yeah maybe it
was
> ORIGINALLY designed to be "a better C", but is much more than that now.
C++
> has now evolved to the point where it is _so_ different from C that it
> really can be considered an entirely separate language, just as Java and
C++
> are entirely separate languages. The only thing the two have in common is
> basic syntax. The novice programmer might respond "Well, what else is
there
> besides syntax?", but of course that is what makes that person a novice
> programmer...

It isn't just syntax that's similar between C and C++. A well-written C
program can be compiled as a C++ program with just minor changes, if any,
and will function exactly the same. For this to be the case, the semantics
have to be the same as well. It's true that C++ has a lot of features that C
doesn't, but it remains almost a strict superset of C.

Java and C are also closely related, but it takes perhaps orders of
magnitude more work to port a C program to Java. Java and C++ considerably
more different.

Hydra

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
In article <s9jk4b...@news.supernews.com>, mark_...@yahoo.co.uk
barfed...

> The designer of the language originally known as C With Classes? I don't
> think so...

That's how C++ started out, but C++ is a completely different beasty. And
ofcourse OO can be a pretty different approach if you're used to
functional programming.

Hydra

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
In article <3899b275$0$88...@news.execpc.com>, ar...@prism-cs.com
barfed...

> Java borrows syntax from C and C++, but it's semantics are from SmallTalk.

The fact that ot borrows things from C/C++ does not make it a sucessor to
C/C++. PHP3 does the same but is very much unlike C/C++.

Java borrowed things from C++ that are good (Syntax for example), left
out things that are bad (Pointers IMHO), created good things (Abstract
classes, interfaces) and created bad things (Java threading anyone? ;-).

The fact that something looks like C and smells like C doesn't mean it
_is_ C.

I have a lot of Java experience (1.5 years of Java classes) and we've
just started learning C++. It is HELL!!! :-) I miss my ol' trusty garbage
collector...Among other things (Clear compiler errors, object
_references_, 'easy' GUI building, etc...).

Hydra

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
In article <87cmnu$3h0$1...@news.tis-in.trb>, sch...@breakthr.com barfed...

> Java and C are also closely related, but it takes perhaps orders of
> magnitude more work to port a C program to Java. Java and C++ considerably
> more different.

Typedefs, macro's, header files, source-outside-class-definitions. Just
some things that take lots of time to port. I didn't mention things like
GUI's and multithreading because those parts would probably need to be
completely rewritten.

Zachary Turner

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to

"Hydra" <hy...@studenten.net> wrote in message
news:MPG.130409b65...@news.wxs.nl...

> In article <3899b275$0$88...@news.execpc.com>, ar...@prism-cs.com
> barfed...
> > Java borrows syntax from C and C++, but it's semantics are from
SmallTalk.
>
> The fact that ot borrows things from C/C++ does not make it a sucessor to
> C/C++. PHP3 does the same but is very much unlike C/C++.
>
> Java borrowed things from C++ that are good (Syntax for example), left
> out things that are bad (Pointers IMHO), created good things (Abstract
> classes, interfaces) and created bad things (Java threading anyone? ;-).
>
> The fact that something looks like C and smells like C doesn't mean it
> _is_ C.
Agreed.


> I have a lot of Java experience (1.5 years of Java classes) and we've
> just started learning C++. It is HELL!!! :-) I miss my ol' trusty garbage
> collector...Among other things (Clear compiler errors, object
> _references_, 'easy' GUI building, etc...).

Disagreed. C++ has alot of power and is very flexible in its design. It
has a
steep learning curve but you can do nearly anything with it. Pointers can
be
_extremely_ useful if used correctly, and are vital to some of the most
powerful aspects of the language such as virtual functions and NULL values.
Figuring out compiler errors is a pain in the ass for any new language, but
after you see the same ones over and over, like any language, they'll be as
clear as day. GUI Building is extremely easy, considering VC comes with
a drag and drop resource editor.

Zachary Turner

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to
> I have a lot of Java experience (1.5 years of Java classes) and we've
> just started learning C++. It is HELL!!! :-) I miss my ol' trusty garbage
> collector...Among other things (Clear compiler errors, object
> _references_, 'easy' GUI building, etc...).
Oh yeah, C++ has references. You just declare an object with a &.

i.e.

void SomeClass::SomeFunc(Obj& obj_ref)
{
obj_ref.foo();

Zachary Turner

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to

"Hydra" <hy...@studenten.net> wrote in message
news:MPG.1304080a3...@news.wxs.nl...

> In article <s9jk4b...@news.supernews.com>, mark_...@yahoo.co.uk
> barfed...
> > The designer of the language originally known as C With Classes? I don't
> > think so...
>
> That's how C++ started out, but C++ is a completely different beasty. And
> ofcourse OO can be a pretty different approach if you're used to
> functional programming.
Umm... functional? Do you mean procedural? Functional languages are
languages like LISP and Standard ML. It's very possible that you meant LISP
and such, but I think you were probably referring to C, which is a
procedural language. But, that's just me being technical

Zach

RichWillems

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
I've tried "Java Essentials for C and C++ Programmers" by Barry Boone.

I was more concerned about going from C to Java but the book tries to show how
to do code in all three.

For me, its C to Java comparisons were pretty good.

Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Zachary Turner <ztu...@bindview.com> wrote in message
news:1E83A827820A81A6.C113C346...@lp.airnews.net...
>
> It's true that C++ was originall called C with classes, but it soon became
> apparent that C++ and C were entirely separate beasts.

This is simply an assertion. If they were indeed entirely separate beasts,
then the vast majority of C code wouldn't compile under a C++ compiler. It
does, so the beasts are at least very friendly. :)

> So yeah maybe it was
> ORIGINALLY designed to be "a better C", but is much more than that now.
C++
> has now evolved to the point where it is _so_ different from C that it
> really can be considered an entirely separate language, just as Java and
C++
> are entirely separate languages.

I'd just object to the term "entirely".

Yes, C, C++ and Java are different languages. But certainly not "entirely"
different.

The reason this matters to me is that I've seen precious little
acknowledgment by Gosling that Java built on and improved C++. I think he
owes a debt to Stroustrup, just as Stroustrup owes a debt (which he
acknowledges) to Ritchie.


Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Hydra <hy...@studenten.net> wrote in message
news:MPG.1304080a3...@news.wxs.nl...
> C++ is a completely different beasty.

You (and others) and I will just have to agree to differ on our definition
of "completely different", I guess (and probably on "beasty", too:).

If C and C++ are "completely different", that doesn't leave much room for
describing the truly vast difference between, say, Lisp and assembler.

Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Hydra <hy...@studenten.net> wrote in message
news:MPG.130409b65...@news.wxs.nl...

>
> The fact that something looks like C and smells like C doesn't mean it
> _is_ C.

My newserver is apparently dropping messages. I completely missed the one
where anyone said that C++, Java, or anything else _is_ C.

Hydra

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
In article
<A81A27A837B9BC1C.279D9E67...@lp.airnews.net>,
ztu...@bindview.com barfed...

> Figuring out compiler errors is a pain in the ass for any new language, but
> after you see the same ones over and over, like any language, they'll be as
> clear as day.

Today I got my first coredumps. About 20 of them :-)

It was caused by a typo like:

char c = "---";
c[1] = 'r';

No compiler warning, just a coredump.

Hydra

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
In article <gusm4.5847$OI1.2...@news5.giganews.com>, aipr...@texas.net
barfed...

> Umm... functional? Do you mean procedural?

Yup. I always mix those two up. I indeed ment procedural.

Don Waugaman

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
In article <MPG.1304e82e...@news.wxs.nl>,
Hydra <hydr...@wxs.nl> wrote:

>Today I got my first coredumps. About 20 of them :-)

>It was caused by a typo like:

>char c = "---";
>c[1] = 'r';

>No compiler warning, just a coredump.

Either your compiler is braindead, or your typo has a typo in it. Any
compiler in the world should complain about 1) initializing a char with
a string literal and 2) accessing a scalar using array syntax. This is
not compiler black magic - heck, you should have gotten an error with no
object file created.

Now, if the first line above should have been

char* c = "---";

then that could give you a coredump, without a warning.
--
- Don Waugaman (d...@cs.arizona.edu) O- _|_ Will pun
Web Page: http://www.cs.arizona.edu/people/dpw/ | for food
In the Sonoran Desert, where we say: "It's a dry heat..." | <><
One way to make your old car run better is to look up the price of a
new model.

Zachary Turner

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

"Don Waugaman" <d...@CS.Arizona.EDU> wrote in message
news:87enqa$n...@baskerville.CS.Arizona.EDU...

> In article <MPG.1304e82e...@news.wxs.nl>,
> Hydra <hydr...@wxs.nl> wrote:
>
> >Today I got my first coredumps. About 20 of them :-)
>
> >It was caused by a typo like:
>
> >char c = "---";
> >c[1] = 'r';
>
> >No compiler warning, just a coredump.
>
> Either your compiler is braindead, or your typo has a typo in it. Any
> compiler in the world should complain about 1) initializing a char with
> a string literal and 2) accessing a scalar using array syntax. This is
> not compiler black magic - heck, you should have gotten an error with no
> object file created.
Okay, so I agree with you. perhaps MS could have done a better job in this
particular situation (and others). However, you just click on the first
error in the coredump and it takes you straight to the line, at which point
it should have been obvious that you were initializing a char with a string
literal.


>
> Now, if the first line above should have been
>
> char* c = "---";
>
> then that could give you a coredump, without a warning.

Umm... That's a perfectly acceptable statement in C and C++. Why would
that give you a coredump?

Zach

Zachary Turner

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Umm.. he was referring to your post saying it is a better C. But, nobody
said it IS C, someone just exaggerated your post.

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message

news:s9l80l...@news.supernews.com...

David Bradley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
RC <rhc...@yahoo.com> wrote in message news:3898FBC1...@yahoo.com...
>
> If u know C++, then u automatic know Java. Because Java was developed from
C++
> by

One of the widest misconceptions around. Aside what has already been
mentioned, member initialization is different, base class initialization is
different, still syntax issues. No well defined object lifetimes. And oh,
don't forget to call close on things like contexts and JDBC connections,
other wise you'll have stuff hanging around longer than need be. You have
the streams, beans, and a host of other libraries.

The impact on implementation and design is non-trivial. Sure for simple
stuff it's not a big deal. I've written a few small proof of concept Java
programs. Larger projects it's not so simple. I'm watching a project stumble
and possibly fail for just that reason. They didn't fully understand all the
issue around Java.

--
David Bradley
bradleyd@>REMOVE THIS<digineer.com

David Bradley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

David Bradley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Mark Wilden <mark_...@yahoo.co.uk> wrote in message
news:s9j1i1...@news.supernews.com...

> That's like saying that Visual Basic wasn't developed from Basic. Clearly,
> the goal with Java was to make a better C++, just as C++ was developed to
> make a better C. Or are the syntactical similarities (of which there are
> more than there are differences) purely coincidental?

No, the goal was much different. It was to create a simpler language.
Probably for the compiler as much for the developer. C++ is a pain to parse.
Pointers were seen as evil. My view is that pointers don't kill programs,
people do, but that's another debate.

The similarities are probably more around the C base and the class keyword.
After that the differences pile up.
Interfaces, member and base initialization, access specification on each
member, and the list goes on.

David Bradley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

--

David Bradley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

--

Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:LOBm4.7416$OI1.2...@news5.giganews.com...

> Umm.. he was referring to your post saying it is a better C. But, nobody
> said it IS C, someone just exaggerated your post.

Never a good idea. My posts are exaggerated enough as it is. :)

Really, I was just indirectly commentating on the practice of setting up
straw man arguments that no one really supports. They're easy arguments to
win, but what's the point?


Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:eRBm4.7421$OI1.2...@news5.giganews.com...
> All squares are quadrilaterals, but that doesn't mean all quadrilaterals
are
> squares. Give me a plain 4 sided polygon and all you've got is a piece of
> crap 4 sided polygon. It's an entirely separate beast than that wondeful
> square you've got sitting in the corner.

In object-oriented terms, it's not "entirely separate" in the least, since
the class of one object derives from the class of another. A square is-a
plain four-sided polygon.

Now, my Reading FC scarf and tantric yoga--that's what I call "entirely
separate beasts" :)

Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
David Bradley <brad...@XSPAM.digineer.com> wrote in message
news:5fBm4.3429$oU2.7...@tw12.nn.bcandid.com...

> Mark Wilden <mark_...@yahoo.co.uk> wrote in message
> news:s9j1i1...@news.supernews.com...
> > That's like saying that Visual Basic wasn't developed from Basic.
Clearly,
> > the goal with Java was to make a better C++, just as C++ was developed
to
> > make a better C. Or are the syntactical similarities (of which there are
> > more than there are differences) purely coincidental?
>
> No, the goal was much different. It was to create a simpler language.

Would you not say that "simpler" is also "better"?

> Probably for the compiler as much for the developer. C++ is a pain to
parse.
> Pointers were seen as evil. My view is that pointers don't kill programs,
> people do, but that's another debate.

Frankly, one of the big stumbling blocks I had in Java was to realise that
it's _all_ pointers, not that Java doesn't have them.

> The similarities are probably more around the C base and the class
keyword.
> After that the differences pile up.
> Interfaces, member and base initialization, access specification on each
> member, and the list goes on.

An interface is just the same as a C++ abstract class with no member
definitions. Member and base initialisation are trivial to understand for a
C++ programmer. Access specification was broadened to include packages.

Really, Java isn't as different as you make out, in my opinion. I also feel
that it solves many of C++'s flaws. If that doesn't make it a "better C++",
I don't know what does.

Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:LOBm4.7416$OI1.2...@news5.giganews.com...
> Umm.. he was referring to your post saying it is a better C. But, nobody
> said it IS C, someone just exaggerated your post.

Never a good idea. My posts are exaggerated enough as it is. :)

Really, I was just indirectly commenting on the practice of setting up

David Bradley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

--

David Bradley

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Mark Wilden <mark_...@yahoo.co.uk> wrote in message
news:s9j1i1...@news.supernews.com...
> That's like saying that Visual Basic wasn't developed from Basic. Clearly,
> the goal with Java was to make a better C++, just as C++ was developed to
> make a better C. Or are the syntactical similarities (of which there are
> more than there are differences) purely coincidental?

No, the goal was much different. It was to create a simpler language.

Probably for the compiler as much for the developer. C++ is a pain to parse.
Pointers were seen as evil. My view is that pointers don't kill programs,
people do, but that's another debate.

The similarities are probably more around the C base and the class keyword.


After that the differences pile up.
Interfaces, member and base initialization, access specification on each
member, and the list goes on.

--

Zachary Turner

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
news:s9lu85...@news.supernews.com...

> David Bradley <brad...@XSPAM.digineer.com> wrote in message
> news:5fBm4.3429$oU2.7...@tw12.nn.bcandid.com...
> > Mark Wilden <mark_...@yahoo.co.uk> wrote in message
> > news:s9j1i1...@news.supernews.com...
> > > That's like saying that Visual Basic wasn't developed from Basic.
> Clearly,
> > > the goal with Java was to make a better C++, just as C++ was developed
> to
> > > make a better C. Or are the syntactical similarities (of which there
are
> > > more than there are differences) purely coincidental?
> >
> > No, the goal was much different. It was to create a simpler language.
>
> Would you not say that "simpler" is also "better"?
Whoa. Not just no, but HELL NO. Simpler is DEFINITELY not synonmous with
better. Otherwise, I'd be programming in VB because it was a better
language than anything else. However, VB is garbage and it offends me that
people who write nothing but VB code for a living call themselves Software
Engineers.

> Really, Java isn't as different as you make out, in my opinion. I also
feel
> that it solves many of C++'s flaws. If that doesn't make it a "better
C++",
> I don't know what does.

That doesn't make it "a better C++", because it's simply not C++. It just
isn't. It's Java. Perhaps in your mind it makes it better THAN C++, but it
certainly isn't a better C++. We've seen better C++'s popping up all the
time, and they're still called C++, with new language features and whatnot,
such as exceptions, namespaces, member templates, etc. but to call Java a
better C++ is simply wrong.

- Zach

Hydra

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
In article <tMBm4.8422$d61.2...@news6.giganews.com>, aipr...@texas.net
barfed...

> Okay, so I agree with you. perhaps MS could have done a better job in this
> particular situation (and others). However, you just click on the first
> error in the coredump and it takes you straight to the line, at which point
> it should have been obvious that you were initializing a char with a string
> literal.

I was talking about a Solaris coredump. It's a (In my case) 700+ kB file
names 'core' which contains a snapshot of your program at the moment that
it did something illegal. Windows will give you a GPF instead.

Hydra

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
In article <87enqa$n...@baskerville.CS.Arizona.EDU>, d...@CS.Arizona.EDU
barfed...

> Either your compiler is braindead, or your typo has a typo in it. Any
> compiler in the world should complain about 1) initializing a char with
> a string literal and 2) accessing a scalar using array syntax. This is
> not compiler black magic - heck, you should have gotten an error with no
> object file created.
>
> Now, if the first line above should have been
>
> char* c = "---";
>
> then that could give you a coredump, without a warning.

Hmm. I can't really remember. It could be that I used a pointer.

Mark Wilden

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Zachary Turner <ztu...@bindview.com> wrote in message
news:39E69265D4819ADA.51C53A01...@lp.airnews.net...

>
> "Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
> >
> > Would you not say that "simpler" is also "better"?
> Whoa. Not just no, but HELL NO. Simpler is DEFINITELY not synonmous with
> better. Otherwise, I'd be programming in VB because it was a better
> language than anything else.

But VB isn't simpler than C++ or Java. The language syntax is, of course,
but we've already established that syntax isn't the same thing as language.

Let me put it this way: The Java designers didn't make Java simpler because
they thought that would make it worse, obviously. They thought C++ was too
complex, so they threw out a lot of the stuff that makes it so (templates,
header files, typedefs, conditional compilation). They kept the parts of C++
that they liked. My opinion is that they did so in order to make a better
language.

> However, VB is garbage and it offends me that
> people who write nothing but VB code for a living call themselves Software
> Engineers.

It doesn't bother me...

> That doesn't make it "a better C++", because it's simply not C++.

I think I see the problem. To you, "a better C++" means that Java is a
dialect of C++. That's not what I was implying. For example, it's common to
say that C++ can be used as "a better C" because of things like more
flexible variable definition (instead of only at the top of blocks). That's
not my usage--it's the usage that's common in the C++ world.

> to call Java a better C++ is simply wrong.

When in doubt, assert! :)


Steve Chapel

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
news:s9m8pb...@news.supernews.com...

> I think I see the problem. To you, "a better C++" means that Java is a
> dialect of C++. That's not what I was implying. For example, it's common
to
> say that C++ can be used as "a better C" because of things like more
> flexible variable definition (instead of only at the top of blocks).
That's
> not my usage--it's the usage that's common in the C++ world.

But C++ *can* be used as a "better C" because a C program can also be
compiled by a C++ compiler. In short, you can just compile with a C++
compiler instead of a C compiler, and more errors will be caught at compile
time. You can then start using features of C++ one by one.

But you can't simply run a C or C++ program through a Java compiler and
expect anything useful to happen. I think nearly everyone would agree that
Java is truly a totally different language from C or C++. If Java isn't C++,
it follows that it can't be a *better* C++!

Zachary Turner

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Oh, well allow me to insert my foot in my mouth. I assumed you were
referring to MSVC for some reason. I assumed coredump meant those times
where something like forgetting a semicolon can give you like 17,000 errors.
The compiler you're using sucks because that's an obvious syntax error..
MSVC catches both errors with no problem.

- Zach

"Hydra" <hy...@studenten.net> wrote in message

news:MPG.1305344d1...@news.wxs.nl...


> In article <tMBm4.8422$d61.2...@news6.giganews.com>, aipr...@texas.net
> barfed...
> > Okay, so I agree with you. perhaps MS could have done a better job in
this
> > particular situation (and others). However, you just click on the first
> > error in the coredump and it takes you straight to the line, at which
point

> > it should have been obvious that you were initializing a char with a
string


> > literal.
>
> I was talking about a Solaris coredump. It's a (In my case) 700+ kB file
> names 'core' which contains a snapshot of your program at the moment that
> it did something illegal. Windows will give you a GPF instead.
>

Zachary Turner

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

> But VB isn't simpler than C++ or Java. The language syntax is, of course,
> but we've already established that syntax isn't the same thing as
language.
>
> Let me put it this way: The Java designers didn't make Java simpler
because
> they thought that would make it worse, obviously. They thought C++ was too
> complex, so they threw out a lot of the stuff that makes it so (templates,
> header files, typedefs, conditional compilation). They kept the parts of
C++
> that they liked. My opinion is that they did so in order to make a better
> language.

Personally, I think templates and typedefs are a godsend. I've eliminated
thousands of lines of code from our product's codebase by making use of the
C++ Standard Template Library which, while extremely complex to understand,
can be so beneficial that it's just crazy. I can literally do 200 lines of
code in 1 line of code using the standard template library, and it actually
compiles down to only a few lines! But it's simply not possible without the
use of templates. Yes, C++ has alot of very complex features, but it is the
mastery of these features that makes the language so incredibly powerful and
flexible.

Don Waugaman

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
In article <tMBm4.8422$d61.2...@news6.giganews.com>,
Zachary Turner <aipr...@texas.net> wrote:

>"Don Waugaman" <d...@CS.Arizona.EDU> wrote in message
>news:87enqa$n...@baskerville.CS.Arizona.EDU...

>> Now, if the first line above should have been

>> char* c = "---";

>> then that could give you a coredump, without a warning.

>Umm... That's a perfectly acceptable statement in C and C++. Why would


>that give you a coredump?

A compiler could store the string literal "---" in read-only memory.
This initialization statement then points the pointer variable c to that
literal. The next line was
c[1] = 'r';
which would be an attempt to store the character 'r' into the second
location in the literal, which would be an attempt to write to read-only
memory, which would give you a coredump when the program runs.

Modifying a string literal is undefined behavior in C.


--
- Don Waugaman (d...@cs.arizona.edu) O- _|_ Will pun
Web Page: http://www.cs.arizona.edu/people/dpw/ | for food
In the Sonoran Desert, where we say: "It's a dry heat..." | <><

Microsoft should abandon the funny looking Windows logo and just hoist
the Jolly Roger. Blackbeard was a piker by comparison. - Robert G. Brown

Zachary Turner

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Oh i didn't realize you were referring to the c[1] = 'd' statement. I
thought you were talking about the char* c = "---"; statement. Yeah,
assigning to a string literal is definitely incorrect. For this reason,
it's best to always make string literals of type const char*.

"Don Waugaman" <d...@CS.Arizona.EDU> wrote in message

news:87fh4n$8...@baskerville.CS.Arizona.EDU...

Paul Singleton

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to
Zachary Turner wrote:

> Personally, I think templates and typedefs are a godsend.

Wasn't C++ originally implemented as source-to-source transformation,
ultimately fed into existing C compilers?

Java supports the same sort of thing, perhaps better (by being
more cleanly and accurately defined).

I've no experience of any of them, but there are several supersets
of Java which add abstractions, and allow common constructions to be
"factored out" or generated mechanically. Java's designers were
right to avoid C's lexical macros, and right not to replace them
with something more syntax- and semantics-aware, and anyway they
left scope for generating Java source (or bytecode?) from more
abstract, higher-level languages. One of them's called "Pizza"
I think (although I think this has its own compiler to bytecode)

Paul Singleton

Zachary Turner

unread,
Feb 4, 2000, 3:00:00 AM2/4/00
to

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
news:s9l801...@news.supernews.com...

> Zachary Turner <ztu...@bindview.com> wrote in message
> news:1E83A827820A81A6.C113C346...@lp.airnews.net...
> >
> > It's true that C++ was originall called C with classes, but it soon
became
> > apparent that C++ and C were entirely separate beasts.
>
> This is simply an assertion. If they were indeed entirely separate beasts,
> then the vast majority of C code wouldn't compile under a C++ compiler. It
> does, so the beasts are at least very friendly. :)

All squares are quadrilaterals, but that doesn't mean all quadrilaterals are
squares. Give me a plain 4 sided polygon and all you've got is a piece of
crap 4 sided polygon. It's an entirely separate beast than that wondeful
square you've got sitting in the corner.

Dont' you just love my analogies? :)

- Zach

Hydra

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
In article <87fh4n$8...@baskerville.CS.Arizona.EDU>, d...@CS.Arizona.EDU
barfed...

> A compiler could store the string literal "---" in read-only memory.

YES! That was it! The problem was that cout<<buffer[1]<<endl; worked just
fine. However, buffer[1] = 'd' caused the core to be dumped. Bugged the
hell outha me for about half an hour before I discovered the obvious. :-)

Hydra

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
In article
<A28CCFDC6761533A.68B77E9C...@lp.airnews.net>,
ztu...@bindview.com barfed...

> Oh, well allow me to insert my foot in my mouth. I assumed you were
> referring to MSVC for some reason. I assumed coredump meant those times
> where something like forgetting a semicolon can give you like 17,000 errors.
> The compiler you're using sucks because that's an obvious syntax error..

Just plain vanilla GNU C.

can't say it sucks though, although it could be a bit clearer on it's
errors. GCC has its strong points, makes it easyer to take my schoolwork
home.

Patricia Shanahan

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to

Zachary Turner wrote:
...
> Disagreed. C++ has alot of power and is very flexible in its design. It
> has a
> steep learning curve but you can do nearly anything with it. Pointers can
> be
> _extremely_ useful if used correctly, and are vital to some of the most
> powerful aspects of the language such as virtual functions and NULL values.

Of course, Java has pointers in this sense.

Mark Wilden

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
Zachary Turner <ztu...@bindview.com> wrote in message
news:63971693445ACEC3.0331201A...@lp.airnews.net...

>
> Personally, I think templates and typedefs are a godsend. I've eliminated
> thousands of lines of code from our product's codebase by making use of
the
> C++ Standard Template Library which, while extremely complex to
understand,
> can be so beneficial that it's just crazy.

I do know what you mean. I used STL on Red Baron II, and I like it a lot (I
wrote a cute generic function for standard deviation that can be applied to
any container).

I have to admit that I don't find myself missing STL in Java all that much,
but maybe that's just my inexperience. I do think that not including
templates and typedefs in Java was a conscious design decision (possibly, in
the former case, to be revisited), and not just because they couldn't be
bothered. :)


Mark Wilden

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
Steve Chapel <sch...@breakthr.com> wrote in message
news:87f94l$aou$1...@news.tis-in.trb...

>
> But C++ *can* be used as a "better C" because a C program can also be
> compiled by a C++ compiler.

That's true, and I'm not saying that Java is to C++ what C++ is to C. I am
saying that Java was considered to be an improvement over C++ (at least in
many areas).

> I think nearly everyone would agree that
> Java is truly a totally different language from C or C++.

In object-oriented programming, an essential skill is to generalise and
specialise. OOP makes it easy to factor out common parts into superclasses
and extend differences into subclasses. In a OO design, there clearly can be
little if any generalisation between two entities that are "totally
different".

Therefore, it's impossible for me to accept that any two entities with as
many similarities as Java and C++ are truly "totally different". Such a
view, if applied to software design, would involve too much copy and paste
operations for my liking. :)

Hydra

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
In article <389B49DA...@keele.ac.uk>, p.sin...@keele.ac.uk
barfed...
> Paul Singleton

Got a question (And a pretty much off-topic one too). Is that your real
name?

We just had Design Patterns last quarter and the Singleton is my favorite
:-)

Hydra

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
In article
<9C13C4D98E991B8B.2891E53D...@lp.airnews.net>,
ztu...@bindview.com barfed...

> Oh i didn't realize you were referring to the c[1] = 'd' statement. I
> thought you were talking about the char* c = "---"; statement. Yeah,
> assigning to a string literal is definitely incorrect. For this reason,
> it's best to always make string literals of type const char*.

Yup. Now I know.

The problem is: We've been programming in Java for about 1.5 years now
and in the third quarter of this schoolyear we are supposed to 'learn
C++'. We have 3 different classes this quarter. Operating Systems,
Algorithms and C++. Originally the assignments that we have to make for
OS and Alg where done in Java. Due to cutbacks in funding they dropped
the practical part of the C++ classes and let us use C++ to do our OS and
Alg assignments.

Now we have to make pretty complex programs without _any_ C++ knowledge
while we are hampered by a lot of Java knowledge. To make things even
worse: Our 4 C++ theorie hours were skipped this week because the teacher
is ill. (Takeing a late holiday probably).

Another problem is the fact that everyone has different C++ compilers. I
downloaden DJGPP and to my surprice I could just compile and run my
school assignments without modifying them. Others where not so fortunate,
they couldn't compile the programs due to a missing headerfile
(unistd.h).

For us C++ is a big step back. And although I'm starting to like the
language I'd really like to do my assignments in a language I'm familiar
with.

Hydra

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
In article <s9lu85...@news.supernews.com>, mark_...@yahoo.co.uk
barfed...

> > No, the goal was much different. It was to create a simpler language.
>
> Would you not say that "simpler" is also "better"?

Rhetorical: Is Basic better than C++?



> Frankly, one of the big stumbling blocks I had in Java was to realise that
> it's _all_ pointers, not that Java doesn't have them.

Pointers passed bij value are no pointers. They're called references to
make sure you don't make the mistake seeing a Java reference as a C
pointer.

Patricia Shanahan

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
I think you might have had almost as much trouble switching the other
way round, given otherwise similar circumstances.

In some ways one's second programming language is the hardest to learn.
People have few preconceptions when learning the first one. Every
subsequent language gives a better feeling for what things are inherent
to programming vs properties of the particular language you are using.
For the second language, people have neither the completely open mind
nor the range of experience.

Zachary Turner

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
Seems to me that Java actually uses pointers but everyone calls them
references, whereas in C++ the difference is made very clear.

"Patricia Shanahan" <pa...@acm.org> wrote in message
news:389BE9A3...@acm.org...

Mark Wilden

unread,
Feb 5, 2000, 3:00:00 AM2/5/00
to
Hydra <hy...@studenten.net> wrote in message
news:MPG.13062d8d7...@news.wxs.nl...

>
> Rhetorical: Is Basic better than C++?

Yes, but only if it could do what C++ can.

> Pointers passed bij value are no pointers.

Interesting viewpoint.

>They're called references to
> make sure you don't make the mistake seeing a Java reference as a C
> pointer.

There really is no mistake to make. In C++ terms, references are pointers
with different access syntax.

What I meant was that in C++,

Object o;

creates an object. In Java, it doesn't--it just creates a reference to an
object.

Zachary Turner

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
I am missing it right now while I'm learning Java. Here's my situation: I
read a string from the keyboard that can be multiple words, store it in a
String, sort the words, and print out the resulting string. I can do this
in 3 lines of STL code. I am STILL trying to find an elegant solution to
this in Java. Ideas?

Zach

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message

news:s9o1fr...@news.supernews.com...

Hydra

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
In article <389C3A25...@acm.org>, pa...@acm.org barfed...

> I think you might have had almost as much trouble switching the other
> way round, given otherwise similar circumstances.

I know, I know :-)



> In some ways one's second programming language is the hardest to learn.
> People have few preconceptions when learning the first one. Every
> subsequent language gives a better feeling for what things are inherent
> to programming vs properties of the particular language you are using.
> For the second language, people have neither the completely open mind
> nor the range of experience.

C++ is not my second language. :-) I started a long time ago with Qbasic,
did some assembly and then learned Java in school (Which I consider my
2nd language). I then started useing perl and PHP3 for web-scripting.

Mark Wilden

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:308n4.12340$my1.3...@news4.giganews.com...

> I am missing it right now while I'm learning Java. Here's my situation:
I
> read a string from the keyboard that can be multiple words, store it in a
> String, sort the words, and print out the resulting string. I can do this
> in 3 lines of STL code. I am STILL trying to find an elegant solution to
> this in Java. Ideas?

I'm far from a Java expert, but I know this isn't hard to do (using a
StringTokenizer and a sorting collection like Tree). Whether it's "elegant"
or not compared to the STL approach, I don't know.

Could you post the STL code, and we can see how closely we can map it to
Java? I wasn't aware that STL had the capability to sort words in a string
in place.

Hydra

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
In article <308n4.12340$my1.3...@news4.giganews.com>,
aipr...@texas.net barfed...

> I am missing it right now while I'm learning Java. Here's my situation: I
> read a string from the keyboard that can be multiple words, store it in a
> String, sort the words, and print out the resulting string. I can do this
> in 3 lines of STL code. I am STILL trying to find an elegant solution to
> this in Java. Ideas?

Use a Stringtokenizer to chop up the string in seperate words and then
sort 'em? Will need more than 3 lines of code but it's pretty trivial.

Hydra

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
In article <s9oq3j...@news.supernews.com>, mark_...@yahoo.co.uk
barfed...

> There really is no mistake to make. In C++ terms, references are pointers
> with different access syntax.
>
> What I meant was that in C++,
>
> Object o;
>
> creates an object. In Java, it doesn't--it just creates a reference to an
> object.

That was something very shocking to me :-) Since I learned Java before I
learned C++ I really got used to the seperate reference and object
declarations. It's a big mistake to use Java code in a C++ program. GIves
you headaches ;-)

Tom Bigford

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
I highly disagree - Java and C++ are *very* different - I still remember thinking
exactly like you - but the more you look - the more they are different - what about
arrays - what about referneces - what about the fact that you have no controll over
object destruction in Java. I suspect that you are *still* a newbie if you make
this statement!

Tom

RC wrote:

> Zachary Turner wrote:
>
> > Are there any Java books out there tailored towards the experienced C++
> > programmer? I consider myself to be an expert at the C++ language, and so
>
> If u know C++, then u automatic know Java. Because Java was developed from C++
> by
> SUN Microsystem. It only took me two weeks to learn Java. Because I knew C++.
> Some of my classmates (three years ago) didn't know C++, they have hard time to
> understand Java.
>
> Java no multiple inheritance as C++ does, but it add multiple implements
> interfaces.
> Java no template.
> Java no operator override such as -, +, *, /, =, etc.
> Java no pointer, all are passed by reference.
> Java has catch error exception which doing different from C++.
>
> What else? These are all I can think about now. Anyone wants to add to above?
> You are welcome to
> do that.
>
> --
> Why we want to teach our babies to walk and talk,
> then later we tell them "Sit Down"! "Be Quiet"!?

--
Tom Bigford
Sun Certified Java Instructor
ja...@bigford.net
www.bigford.net

Tom Bigford

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
Hi Zachary - I also consider myself to be an expert in C++ (8+ years of teaching
/ consulting) and i used Core Java - which worked fine for me. I *highly*
recommend that you look carefully at *all* aspects of Java as there are subtle
but important differences all over the place. (example - variable types are
*all* fixed length).

btw - I see you have started quite a thread here!

Hope this helps - Tom

Zachary Turner wrote:

> Are there any Java books out there tailored towards the experienced C++
> programmer? I consider myself to be an expert at the C++ language, and so

> I'm really not looking forward to sitting through chapter after chapter of a
> book that is trying to explain concepts like variables and interfaces and
> inheritance, etc. So is there anything out there that fits the description
> of what I'm looking for, or do I have to read a typical beginning Java book
> like Core Java or Just Java?
>
> Zach

Darren Goddard BSc(hons)

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
The only thing that Java and C++ have in common is the Object Orrientation.

Darren

Tom Bigford wrote:

> I highly disagree - Java and C++ are *very* different - I still remember thinking
> exactly like you - but the more you look - the more they are different - what about
> arrays - what about referneces - what about the fact that you have no controll over
> object destruction in Java. I suspect that you are *still* a newbie if you make
> this statement!
>
> Tom
>
> RC wrote:
>

> > Zachary Turner wrote:
> >
> > > Are there any Java books out there tailored towards the experienced C++
> > > programmer? I consider myself to be an expert at the C++ language, and so
> >

> > If u know C++, then u automatic know Java. Because Java was developed from C++
> > by
> > SUN Microsystem. It only took me two weeks to learn Java. Because I knew C++.
> > Some of my classmates (three years ago) didn't know C++, they have hard time to
> > understand Java.
> >
> > Java no multiple inheritance as C++ does, but it add multiple implements
> > interfaces.
> > Java no template.
> > Java no operator override such as -, +, *, /, =, etc.
> > Java no pointer, all are passed by reference.
> > Java has catch error exception which doing different from C++.
> >
> > What else? These are all I can think about now. Anyone wants to add to above?
> > You are welcome to
> > do that.
> >
> > --
> > Why we want to teach our babies to walk and talk,
> > then later we tell them "Sit Down"! "Be Quiet"!?
>

Mark Wilden

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
Tom Bigford <t...@bigford.net> wrote in message
news:389D9CF5...@bigford.net...

> I highly disagree - Java and C++ are *very* different

In which case, I guess Scheme and Perl are very, very, very, very, very
different. :)

I agree that there are significant differences between C++ and Java, and
it's worthwhile to bear those differences in mind (not that you really have
much choice!). But I still think that calling them "very different" ignores
the acres and acres of similarities.

This is best attested by the fact that, knowing C++, I have never found any
language as easy to learn as Java.


Zachary Turner

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
I lied. It's 4 lines because you have to declare a container :)

vector<string> paragraph;

// Copy all words from cin to paragraph. Use a back_inserter so that it
will
// insert onto the end of the vector, rather than assuming that enough space
// already exists. Note that cin reads words separated by whitespace, so it
// copies each word as a separate string into the vector.
copy(istream_iterator<string>(cin), istream_iterator<string>(),
back_inserter(paragraph));

// sort them all, predefined operators already exist for std::string
sort(paragraph.begin(), paragraph.end());

// dump the result to cout, printing each item on a new line.
unique_copy(paragraph.end(), paragraph.end(), ostream_iterator<string>(cout,
"\n"));

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message

news:s9qm53b...@news.supernews.com...


> Zachary Turner <aipr...@texas.net> wrote in message
> news:308n4.12340$my1.3...@news4.giganews.com...

> > I am missing it right now while I'm learning Java. Here's my situation:
> I
> > read a string from the keyboard that can be multiple words, store it in
a
> > String, sort the words, and print out the resulting string. I can do
this
> > in 3 lines of STL code. I am STILL trying to find an elegant solution
to
> > this in Java. Ideas?
>

Zachary Turner

unread,
Feb 6, 2000, 3:00:00 AM2/6/00
to
Well, I pretty much disregarded everybody's post and bought this new book
that JUST got published called Java Black Book. It hasn't arrived from
Amazon.com, but from what I saw, it looked to be right up my alley. I
borrowed Beginning Java 1.1 by Horton for the weekend just so I could have
something to read, and it's not bad, but I find myself skipping over lots
and lots of pages and having to search for the meat. Which sucks because
that makes it so easy to miss some of the good stuff. But hey, most
learning of a language comes from using it on the job and running into
actual problems that must be solved rather than just reading it in a book.
The book just gives you a foundation.

- Zach

"Tom Bigford" <t...@bigford.net> wrote in message

news:389D9C5F...@bigford.net...


> Hi Zachary - I also consider myself to be an expert in C++ (8+ years of
teaching
> / consulting) and i used Core Java - which worked fine for me. I *highly*
> recommend that you look carefully at *all* aspects of Java as there are
subtle
> but important differences all over the place. (example - variable types
are
> *all* fixed length).
>
> btw - I see you have started quite a thread here!
>
> Hope this helps - Tom
>

> Zachary Turner wrote:
>
> > Are there any Java books out there tailored towards the experienced C++
> > programmer? I consider myself to be an expert at the C++ language, and
so

> > I'm really not looking forward to sitting through chapter after chapter
of a
> > book that is trying to explain concepts like variables and interfaces
and
> > inheritance, etc. So is there anything out there that fits the
description
> > of what I'm looking for, or do I have to read a typical beginning Java
book
> > like Core Java or Just Java?
> >
> > Zach
>

Donald R. McGregor

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
>> I am missing it right now while I'm learning Java. Here's my situation: I
>> read a string from the keyboard that can be multiple words, store it in a
>> String, sort the words, and print out the resulting string. I can do this
>> in 3 lines of STL code. I am STILL trying to find an elegant solution to
>> this in Java. Ideas?
>
>Use a Stringtokenizer to chop up the string in seperate words and then
>sort 'em? Will need more than 3 lines of code but it's pretty trivial.

Yeah, probably easiest to read a String from a stream, use a StringTokenizer
to get the parts (by whatever criteria, usually whitespace) store
each component in a list, then sort the list. Strings implement
comparable so you'll get that for free.

--
Don McGregor | The Klingon Prime Directive: "Start shooting."
mcg...@mbay.net |

Steve Chapel

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
"Hydra" <hy...@studenten.net> wrote in message
news:MPG.13062d8d7...@news.wxs.nl...
>
> Pointers passed bij value are no pointers. They're called references to

> make sure you don't make the mistake seeing a Java reference as a C
> pointer.

I see Java references as C pointers, and I don't seem to make any mistakes.
What is the "mistake" you're referring to?

Dale King

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
Zachary Turner wrote:
> Personally, I think templates and typedefs are a godsend. I've eliminated
> thousands of lines of code from our product's codebase by making use of the
> C++ Standard Template Library which, while extremely complex to understand,
> can be so beneficial that it's just crazy. I can literally do 200 lines of
> code in 1 line of code using the standard template library, and it actually
> compiles down to only a few lines!

I take major exception to that last line. You are implying that C++
templates actually save you in compiled code. That is absurd. Extensive
use of C++ templates will actually greatly expand your code. If you for
instance have 10 vectors that are each declared to hold a different type
you will basically duplicate the code for Vector 10 times. The truth is
you are compiling to probably thousands of lines of code.

> But it's simply not possible without the use of templates.

There are better ways than the C++ templates and when Java generics are
added I believe we will have a better solution.

--
--- Dale King

David Bradley

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
Mark Wilden <mark_...@yahoo.co.uk> wrote in message
news:s9lu85...@news.supernews.com...

> Would you not say that "simpler" is also "better"?

Sometimes, depends. Logo is a simpler language than Java or C++. But I
wouldn't consider it better.

> Frankly, one of the big stumbling blocks I had in Java was to realise that
> it's _all_ pointers, not that Java doesn't have them.

Good point. Yes essentially everything is a pointer.

> An interface is just the same as a C++ abstract class with no member
> definitions. Member and base initialisation are trivial to understand for
a
> C++ programmer. Access specification was broadened to include packages.

More like a saner approach to MI.

The syntax is not a big deal. But there are implementation issues. Simple
stuff such as default paramaters and such. In Java, at least the code I've
seen, people have to simulate the default parameters using overloading.
Something a C++ programmer won't be used to. Granted it's not rocket
science, but it's still a conscious switch you have to make that is more
than just syntax.

> Really, Java isn't as different as you make out, in my opinion. I also
feel
> that it solves many of C++'s flaws. If that doesn't make it a "better
C++",
> I don't know what does.

Some other things that were difficult for me. Loosing const. You have no
idea other than a gentlemens agreement that some object you pass to a
function won't get mucked with. This requires a bit mental work. And at
least on several occasions I've been warned to always call this function or
that, else my performance may suffer. Something generally I can deal with in
C++ a little easier. External communications and such, where I need a
specific lifetime for an object, I have no easy way of doing that in Java.
In C++ once an object goes out of scope, it cleans it self up, releases an
external resources. Everything happens in a more well know manner rather
than when ever the GC system gets around to it.

After working in C++ for 8 years, I find there is are a number of such items
that I must give up. This narrows my implementation options and I guess, if
you consider simpler better, then it's easier. I don't I find it restricting
and difficult.


David Bradley

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

David Bradley

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

David Bradley

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

Zachary Turner

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

"Dale King" <Ki...@tce.com> wrote in message
news:389EE753...@tce.com...

> Zachary Turner wrote:
> > Personally, I think templates and typedefs are a godsend. I've
eliminated
> > thousands of lines of code from our product's codebase by making use of
the
> > C++ Standard Template Library which, while extremely complex to
understand,
> > can be so beneficial that it's just crazy. I can literally do 200 lines
of
> > code in 1 line of code using the standard template library, and it
actually
> > compiles down to only a few lines!
>
> I take major exception to that last line. You are implying that C++
> templates actually save you in compiled code. That is absurd. Extensive
> use of C++ templates will actually greatly expand your code. If you for
> instance have 10 vectors that are each declared to hold a different type
> you will basically duplicate the code for Vector 10 times. The truth is
> you are compiling to probably thousands of lines of code.
Have you ever looked at the source code to the STL? It is extremely small.
Obviously the compiler produces new versions of the class for each template
parameter, but in reality if you've ever looked at the executable size for a
typical
large scale STL project, it is a very trivial size increase. Who cares if
it's 2000
lines of code? The point is it looks like 20 lines of code in my source
file, which
makes it 1) easier to read, 2) easier to write, and 3) easier to maintain.

>
> > But it's simply not possible without the use of templates.
>
> There are better ways than the C++ templates

What are these better ways? You refer to "Java Generics", which of course
don't exist.
So tell me a better way that does exist.

- Zach

Zachary Turner

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
news:s9ra7is...@news.supernews.com...

> Tom Bigford <t...@bigford.net> wrote in message
> news:389D9CF5...@bigford.net...
> > I highly disagree - Java and C++ are *very* different
>
> In which case, I guess Scheme and Perl are very, very, very, very, very
> different. :)
Like I keep saying, just because a language looks more different doesn't
mean it IS more different. The syntax is only the most basic element of a
language. It's easy to look at a language and say "oh boy these two
languagse are WAY different", based on syntax. But it's only when you know
the true details of a language's internals that you can make an actual
comparison. Java and C++ are VERY different. The ONLY thing they have in
common is a couple of keywords. For starters, Java wasn't even designed to
be compiled!! It uses a VM which is translated at runtime. That's not to
say that some compiler manufacturers haven't taken it upon themselves to
MAKE it compiled, but technically it's not a compiled language. That alone
is enough to make it VERY different.

- Zach

Tom Bigford

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

Mark Wilden wrote:

> Tom Bigford <t...@bigford.net> wrote in message
> news:389D9CF5...@bigford.net...
> > I highly disagree - Java and C++ are *very* different
>
> In which case, I guess Scheme and Perl are very, very, very, very, very
> different. :)

Maybe ... I was only comparing C++ and Java ;-)


>
>
> I agree that there are significant differences between C++ and Java, and
> it's worthwhile to bear those differences in mind (not that you really have
> much choice!). But I still think that calling them "very different" ignores
> the acres and acres of similarities.
>

Yes - Java *did* lift a lot of syntax from C++. By the same token C++ lifted a
lot from C - would you say those languages are the same. The reason I jumped
in here is that when i *first* started looking at Java I made the same
pronouncement - "Oh, this is just C++ in disguise. Well after teaching the
language for a while I found just how much i needed to learn...


>
> This is best attested by the fact that, knowing C++, I have never found any
> language as easy to learn as Java.

I am happy for you - I hope you have learned well ...

Tom

Steve Chapel

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
"Tom Bigford" <t...@bigford.net> wrote in message
news:389F2818...@bigford.net...

>
> Yes - Java *did* lift a lot of syntax from C++. By the same token C++
lifted a
> lot from C - would you say those languages are the same. The reason I
jumped
> in here is that when i *first* started looking at Java I made the same
> pronouncement - "Oh, this is just C++ in disguise. Well after teaching
the
> language for a while I found just how much i needed to learn...

The relationship between C and C++ is much different than between C and Java
and C++ and Java. Namely, you can compile a C program with a C++ compiler.
You cannot compile C or C++ with a Java compiler. C++ does not just "lift a
lot" from C; it is nearly a superset of C.

Dale King

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to Zachary Turner
Zachary Turner wrote:
>
> "Dale King" <Ki...@tce.com> wrote in message
> news:389EE753...@tce.com...
>
> Have you ever looked at the source code to the STL? It is extremely small.
> Obviously the compiler produces new versions of the class for each template
> parameter, but in reality if you've ever looked at the executable size for a
> typical
> large scale STL project, it is a very trivial size increase. Who cares if
> it's 2000
> lines of code? The point is it looks like 20 lines of code in my source
> file, which
> makes it 1) easier to read, 2) easier to write, and 3) easier to maintain.

First off, the STL is probably a very efficient template implementation,
but that is only one instance of templates. Other uses of templates are
not so efficient. Still it increases the size of the program even for
the STL.

Now imagine how this could be implemented so you don't duplicate the
code. Imagine that each instance of a generic class contains a reference
to its parameterized type. So the type used to instantiate the template
is a data member of the object created. Whenever the template code
needed to use that template parameter it just accessed that objects data
member. There would of course be support in the compiler for type
checking on this.

> > > But it's simply not possible without the use of templates.
> >
> > There are better ways than the C++ templates
> What are these better ways? You refer to "Java Generics", which of course
> don't exist.
> So tell me a better way that does exist.

Actually Java generics DO exist in a couple of different forms. There is
a JSR to add them to Java. If you really must have generics you can get
them right now using the GJ compiler. The nice thing about the GJ
approach is that it is completely compatible. Old classes can use your
template class in the same way we use containers today. The disadvantage
is that it does not differentiate container types. Therefore a Vector<
JButton > is actually just a Vector. There are other proposals that
require more of a tear-up and don't have the backwards compatibility.
--
--- Dale King

Mark Wilden

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
Tom Bigford <t...@bigford.net> wrote in message
news:389F2818...@bigford.net...
>
> Yes - Java *did* lift a lot of syntax from C++. By the same token C++
lifted a
> lot from C - would you say those languages are the same.

Sigh. No one has said that C++ and Java are the same. No one has even said
anything close enough to make your statement a valid exaggeration.

> The reason I jumped
> in here is that when i *first* started looking at Java I made the same
> pronouncement - "Oh, this is just C++ in disguise. Well after teaching
the
> language for a while I found just how much i needed to learn...

Since I never made any such pronouncement, I had a great deal less work
ahead of me.

I think people who have such a difficult time recognising similarities
should not be using OOP. I'd hate the see how such people would design a
class hierarchy of languages. I suppose C++ and Java's closest ancestor
would be Algol, for God's sake.

Mark Wilden

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to
Zachary Turner <ztu...@bindview.com> wrote in message
news:2E0480485E9FDFB8.A4162032...@lp.airnews.net...

> "Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
> news:s9ra7is...@news.supernews.com...
> > Tom Bigford <t...@bigford.net> wrote in message
> > news:389D9CF5...@bigford.net...
> > > I highly disagree - Java and C++ are *very* different
> >
> > In which case, I guess Scheme and Perl are very, very, very, very, very
> > different. :)
> Like I keep saying, just because a language looks more different doesn't
> mean it IS more different.

Waitaminute. Are you saying that Scheme and Perl _aren't_ very, very, very,
very very different??

My point was simply that by calling C++ and Java "very" different, you don't
leave yourself a lot of room for comparing languages that truly are _very_
different.

> The ONLY thing [Java and C++] have in


> common is a couple of keywords.

I'm sorry, but that's just nonsense. When 90% of the syntax is the same,
that's more than "a couple of keywords". When converting many C++ programs
to Java is trivial, that's not what I call a "very" different language.

How many languages have you actually used? I've used plenty, and I can't
think of any two of them that are _less_ different than C++ and Java. Let's
hear your choices.


Zachary Turner

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
news:s9uef0...@news.supernews.com...

> Zachary Turner <ztu...@bindview.com> wrote in message
> news:2E0480485E9FDFB8.A4162032...@lp.airnews.net...
> > "Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
> > news:s9ra7is...@news.supernews.com...
> > > Tom Bigford <t...@bigford.net> wrote in message
> > > news:389D9CF5...@bigford.net...
> > > > I highly disagree - Java and C++ are *very* different
> > >
> > > In which case, I guess Scheme and Perl are very, very, very, very,
very
> > > different. :)
> > Like I keep saying, just because a language looks more different doesn't
> > mean it IS more different.
>
> Waitaminute. Are you saying that Scheme and Perl _aren't_ very, very,
very,
> very very different??
No. I'm just saying that C++ and Java are very, very, very, very, very
different
also.


>
> My point was simply that by calling C++ and Java "very" different, you
don't
> leave yourself a lot of room for comparing languages that truly are _very_
> different.

And my point is that you're saying Scheme and Perl are _very_ different
because
they *look* _very different.

>
> > The ONLY thing [Java and C++] have in
> > common is a couple of keywords.
>
> I'm sorry, but that's just nonsense. When 90% of the syntax is the same,
> that's more than "a couple of keywords". When converting many C++ programs
> to Java is trivial, that's not what I call a "very" different language.

No, it's actually just a couple. class, new, private, protected, public,
and the name of
type types. I can't think of any others but i'm sure there are two or three
more.


>
> How many languages have you actually used? I've used plenty, and I can't
> think of any two of them that are _less_ different than C++ and Java.
Let's
> hear your choices.

I've used 9. I've used basic, pascal, C, C++, Java, Lisp, Perl, Assembly,
Fortran
Two that are less different are Fortran and Pascal. Two more that are less
different are C and Pascal.

Zachary Turner

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message
news:s9uef8a...@news.supernews.com...

> Tom Bigford <t...@bigford.net> wrote in message
Nobody is saying that there aren't syntatical similiarities. We're just
saying
that syntatical similarities don't necessarily mean two languages have alot
inc ommon.

Patricia Shanahan

unread,
Feb 7, 2000, 3:00:00 AM2/7/00
to

I see C pointers are pointers with some address-like extra baggage to do
with C's assembly language tendencies, and Java "references" as being
far more purely pointerish than C pointers.

mjfg...@my-deja.com

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
In article <s9uef0...@news.supernews.com>,

"Mark Wilden" <mark_...@yahoo.co.uk> wrote:
> How many languages have you actually used? I've used plenty, and I
can't
> think of any two of them that are _less_ different than C++ and
Java. Let's
> hear your choices.

Oooh, can I play?

It depends on whether you're talking about keywords or structure, of
course. If you mean "different in structure," then C and Pascal are
closer than C++ and Java. Remember that "Obfuscated C Contest" entry a
few years back, that consisted of a header file with macros that would
allow a C compiler to successfully compile most Pascal programs? I
don't think it could handle local functions, but everything else could
have been made to work.

For keywords... it's a little harder. Both C++ and Java have "class,"
where C doesn't-- but C++ and C have "const," where java has "final"
which means completely different things. Best to say that C++, C, and
Java all have fairly similar grammars, and leave it at that.

Note that I'm not arguing against the idea that C++ and Java are
similar; they ARE, in both structure and keywords. "Similar" is a
relative term, and C++ and Java are much more like each other than
either of them is like, say, Perl. Or Cobol. Or Applesoft Basic. Or
80486 assembly language, or Pilot, or Lotus 1-2-3 macros, or, or, or...
well, the list goes on for quite a while.

Sent via Deja.com http://www.deja.com/
Before you buy.

Mark Wilden

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
<mjfg...@my-deja.com> wrote in message news:87nnm0$f38$1...@nnrp1.deja.com...

>
> Note that I'm not arguing against the idea that C++ and Java are
> similar; they ARE, in both structure and keywords. "Similar" is a
> relative term, and C++ and Java are much more like each other than
> either of them is like, say, Perl. Or Cobol. Or Applesoft Basic. Or
> 80486 assembly language, or Pilot, or Lotus 1-2-3 macros, or, or, or...
> well, the list goes on for quite a while.

That's really all I'm saying, against those who aver that Java and C++ are
"completely different" languages.

Mark Wilden

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:PZKn4.15966$OI1.4...@news5.giganews.com...

> Nobody is saying that there aren't syntatical similiarities. We're just
> saying
> that syntatical similarities don't necessarily mean two languages have
alot
> inc ommon.

If I'd equated syntactical similarity and language commonality, then that
would be worth saying. However, it's rather difficult to write OOP code in
languages that don't have a "class" keyword (or synonym).

But beyond syntax, there's this: I'm reading a book called Essential Java
Style. I'd say 90% of the implementation patterns in that book are directly
applicable to C++, with just minor adjustments (using : instead of extends,
etc.).

Mark Wilden

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:vWKn4.14863$d61.4...@news6.giganews.com...

> > Waitaminute. Are you saying that Scheme and Perl _aren't_ very, very,
> very,
> > very very different??
> No. I'm just saying that C++ and Java are very, very, very, very, very
> different
> also.

The problem is, by using the same number of "very"s, you're equating the
degree of difference.

> And my point is that you're saying Scheme and Perl are _very_ different
> because
> they *look* _very different.

Not at all. Have you used either language? They do look different, but the
reason is that they're used for very different things. Form follows
function.

> No, it's actually just a couple. class, new, private, protected, public,
> and the name of
> type types. I can't think of any others but i'm sure there are two or
three
> more.

Here's the list of keywords that C++ and Java share: break, case, catch,
char, class, do, double, else, float, for, int, long, new, return, short,
static, switch, this, throw, void, volatile, while, const, continue,
default, goto, if, private, protected, public, throws, try. Is that what you
call a "couple"?

And comparing keyword lists ignores the operators the two languages share,
and the syntax. Not to mention (at a higher level) a whole slew of idioms.
Yet you say that the ONLY thing the two languages share is a couple of
keywords.

> Two that are less different are Fortran and Pascal.

It's been a very long time since I used Fortran, but since it doesn't even
descend from the granddaddy of structured languages--Algol--I don't know
many people who would say they were very similar.

> Two more that are less different are C and Pascal.

I think you have a better case, here, though. But because of the syntax
differences, I would still call them less similar than C++ and Java.

But I've got the easy job here. I'm just arguing against the view that C++
and Java are _completely_ different languages. I would indeed say that C and
Pascal are that, since they share very little syntax and were designed for
completely different reasons. Their inheritance hierarchy does indeed derive
from Algol. I would say that C++ and Java, however, are siblings of a common
superclass (necessarily abstract!).


David Bradley

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Another big issue and how Java is different. Is that it forces you to
consider multi-threaded issues with every application. If GC is implemented
as a thread in the background, an object's finalize method can be called at
any time. This introduces the fun of debugging multi-threaded apps to the
simplest of programs that may not have needed it normally. In C++ I don't
have to introduce multi-thread issues until I need them.

--
David Bradley
bradleyd@>REMOVE THIS<digineer.com

David Bradley

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
> Sigh. No one has said that C++ and Java are the same. No one has even said
> anything close enough to make your statement a valid exaggeration.

Really, the statement below came pretty close, it wasn't made by you, but
another poster and is what started this branch of the thread.

>If u know C++, then u automatic know Java. Because Java was developed from
C++
>by SUN Microsystem. It only took me two weeks to learn Java. Because I knew
C++.
>Some of my classmates (three years ago) didn't know C++, they have hard
time to
>understand Java.

No one's disputing that Java is similiar to C++. It was the falicy that you
can quickly switch with just a few syntax adjustments. It's just not that
simple. It's simpler than moving from BASIC, COBOL, Pascal, etc. to Java.

Dale King

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
<< Long stupid message about differences/similarities between C++ & Java
removed >>

Guys this discussion is getting stupid.

Are there similarities between C++ and Java? Yes, lots.
Are there differences between C++ and Java? Yes, lots.

It is pointless to argue whether they are similar or different since
they are both. I don't think anyone cares except for you guys having a
shouting match. And the trouble is you're all right, it just depends on
your point of view.
--
--- Dale King

Mats Olsson

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
In article <a6Vn4.13704$oU2.2...@tw12.nn.bcandid.com>,

David Bradley <brad...@XSPAM.digineer.com> wrote:
>Another big issue and how Java is different. Is that it forces you to
>consider multi-threaded issues with every application. If GC is implemented
>as a thread in the background, an object's finalize method can be called at
>any time.

Which is why its very, very bad form to use the finalize method for
anything but debugging. It is _not_ a way to get the C++ idiom
http://c2.com/cgi/wiki?ResourceAcquisitionIsInitialization in Java. The
correct way to think is http://c2.com/cgi/wiki?ResourceReleasesResource .

It's an easy trap to fall into for ex-C++ programmers.

>This introduces the fun of debugging multi-threaded apps to the
>simplest of programs that may not have needed it normally. In C++ I don't
>have to introduce multi-thread issues until I need them.

Java also makes it easy to handle threads and synchronization. Too
easy, really, as it fools people into thinking MT programming is easy.
Complex MT programming requires lots of skill, but the rewards are greate
as well.

/Mats

Mark Wilden

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Dale King <Ki...@tce.com> wrote in message news:38A02CDF...@tce.com...

> << Long stupid message about differences/similarities between C++ & Java
> removed >>
>
> Guys this discussion is getting stupid.
>
> It is pointless to argue whether they are similar or different since
> they are both. I don't think anyone cares except for you guys having a
> shouting match. And the trouble is you're all right, it just depends on
> your point of view.

Sorry to annoy you, Dale, but there are a lot of threads in various
newsgroups I just don't bother reading. That option is surely open to you,
as well.

> Are there similarities between C++ and Java? Yes, lots.
> Are there differences between C++ and Java? Yes, lots.

The problem is that these statements are practically tautologous. They
don't, for example, help answer the question "If I know C++, will that help
me learn Java" (the answer is yes--lots), nor "If I know C++, do I know
Java?" (the answer is no, not at all). Some people here have said that the
answer to the first question is no, since they're completely different
languages. At least one person has said that the answer to the second
question is yes, and that's obviously not correct.

Discussing the similarities and differences between the two languages is
useful, I think (hey, be glad we're not arguing about which one is
"better"!). But if you disagree, my advice is to ignore this thread, rather
than contribute to it with content-less statements.

Dale King

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Mark Wilden wrote:
>
> Dale King <Ki...@tce.com> wrote in message news:38A02CDF...@tce.com...
>
> > Are there similarities between C++ and Java? Yes, lots.
> > Are there differences between C++ and Java? Yes, lots.
>
> The problem is that these statements are practically tautologous. They
> don't, for example, help answer the question "If I know C++, will that help
> me learn Java" (the answer is yes--lots), nor "If I know C++, do I know
> Java?" (the answer is no, not at all). Some people here have said that the
> answer to the first question is no, since they're completely different
> languages. At least one person has said that the answer to the second
> question is yes, and that's obviously not correct.

Most of the the things said in this thread are tautologies. To continue
your thought:

If I know C++, will that help me learn Java? yes--lots
If I know C++, will that hinder me learning Java? yes--lots

> Discussing the similarities and differences between the two languages is
> useful, I think (hey, be glad we're not arguing about which one is
> "better"!). But if you disagree, my advice is to ignore this thread, rather
> than contribute to it with content-less statements.

I certainly agree that discussing how they are similar and how they are
different is useful. But this has been a thread trying to decide whether
they are similar or different? The correct answer to that is yes. And I
have been ignoring this thread for the most part. Most of the discussion
has been in the following form:

>>>> C++ and Java are very different.
>>> No they are very similar, they have similar syntax.
>> But they are very different.
> But I was only talking about syntax.

The fact is they are both right because they are very similar, but very
different.

--
--- Dale King

Zachary Turner

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
> > Two more that are less different are C and Pascal.
>
> I think you have a better case, here, though. But because of the syntax
> differences, I would still call them less similar than C++ and Java.

And I'm just saying that you put too much emphasis on syntax. :)

Zachary Turner

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
I think we've all come to somewhat of an agreement, but we're just arguing
different points.

"Mark Wilden" <mark_...@yahoo.co.uk> wrote in message

news:s9vr8u9...@news.supernews.com...


> Zachary Turner <aipr...@texas.net> wrote in message

Mark Wilden

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Zachary Turner <aipr...@texas.net> wrote in message
news:a9Zn4.17568$my1.5...@news4.giganews.com...

>
> And I'm just saying that you put too much emphasis on syntax. :)

But clearly there are other similarities. For example, today's query about
why

double x = 1 / 180;

makes x 0.0 could have appeared on a C++ (or C!) forum unaltered. Knowing
this particular pitfall in those languages helps prevent running into it in
Java. And that has nothing to do with syntax.

Mark Wilden

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Dale King <Ki...@tce.com> wrote in message news:38A05D24...@tce.com...

>
> Most of the the things said in this thread are tautologies. To continue
> your thought:
>
> If I know C++, will that help me learn Java? yes--lots
> If I know C++, will that hinder me learning Java? yes--lots

I disagree with the latter statement. If you've got half a brain and can
recognise both the similarities _and_ the differences in the languages,
you'll have a head start on Java if you already know C++. Surely that's the
reason that Java borrowed so much of C++'s syntax?

Let me put it this way: what is the best prerequisite language for learning
Java? In other words, knowing what one language will help you learn Java
most quickly? I simply cannot believe that anyone who wouldn't answer C++
has ever used either language.

Knowing C++ does not "hinder" learning Java.

> The fact is they are both right because they are very similar, but very
> different.

I'll just have to agree to disagree with you and the others who say the two
languages are very different. Not that it really matters, at the end of the
day, I guess...:)

It is loading more messages.
0 new messages