Should I learn C++ or Java now?

M

mjm

Answer this question: what are your motivations?

Strictly to give my subjective assessment of the relative difficulties
of working with Java and C++.

If someone comes from PHP and HTML would you recommend Stroustrup to him?
 
V

Victor Bazarov

mjm said:
Strictly to give my subjective assessment of the relative difficulties
of working with Java and C++.

Giving your subjective assessment is the means. But what is
the goal? Are you trying to convince somebody that Java is
easier to work with somehow? I'm asking because I can't say
that behind all that "I wrote tons of Java code that worked
the first time and never neede to use a debugger on it" there
is anything informative. And, to be honest with you, I am not
sure you're not exxagerrating. Are you?
If someone comes from PHP and HTML would you recommend Stroustrup to him?

Yes, I would. That's the book I used while learning C++ and
I still think that it's the best book on the subject. The
"Accelerated C++" is a good alternative. It wasn't available
to me years ago, which may have created some bias.

It doesn't matter where they come from. What matters is whether
they are willing to learn or they just "went out to take a piss".
Casual attitude (characteristic to creation of 99% of all WWW
functionality in the form of applets, servlets, CGI programs,
etc.) will often get one nowhere in C++.

Victor
 
M

mjm

"Victor Bazarov"

I did not say I wrote tons of Java code that worked right away.
I said it happened occasionally.
It's never happened in C++.

Stroustrup is not concise enough.
How long did it take you to work through this?
 
V

Victor Bazarov

mjm said:
[...]
Stroustrup is not concise enough.

What's your example of 'concise'?
How long did it take you to work through this?

IIRC, about three months. It was a translation of the first
edition with some errors in examples, too. If I had to do
it in a foreign language and with a later edition, I may have
needed more time.

Considering that a decent C++ course should run two semesters,
I think that Stroustrup's Special Edition is the right book.
It doesn't have all answers, that's why it needs to be
complemented by, say, "The C++ Templates". The main advantage
of both books is that they can just as easily serve later as
references.

Victor
 
M

mjm

Victor Barazov,

I am not exeggerating. I have used the debugger when I started out in
C++ on Code Warrior and not thereafter neither for Java nor for C++.

cerr << ...

was good enough till now.
 
Z

zer0rez

Agent Mulder said:
Eljah> Are there any recommended books on Java or C++ (depending on which
Eljah> language I should learn first) for the beginner who only know PHP and
Eljah> BASIC?
Eljah>
Eljah> Sorry if this post some how offends somebody.

Go to your local second hand bookstore and find the books
on Java and C++. You'll probably find lots of both of them.
Decide on the language by the documentation that you can get.
It is not easy to recognize a good book but some general
guidelines are:

-good books are heavy books
-good books have a good index
-good books have a good Table of Contents at the start (except
for Bjarne Stroustrup's C++ Programming Language, that has a
lousy Table of Content. There is also something with the backside
of it that I must always look twice to find it. But the weight will tell
me I'm right)

Some Java books have a CD-ROM in the back with a compiler and
tools that you need to start programming. If you plan to jump in quickly
with a high level object oriented language, I'd advice Java. With C++,
you'll have to go through a lot of grunch. But it pays of.

-X

Well im 15 and ive been attempting to learn C++ for years now. My
main reason for learning it was to make games. I know a lil bit about
java and for a while i was going to learn it. but anyway, i think u
should learn C++ (or maybe C) and then go to java.

-zer0rez
 
P

Peter van Merkerk

Peter, I think some emotions (perhaps rubbing off from earlier in
the thread) make you jump to conclusions.

Frankly I see nothing is this thread, or even in this entire newsgroup
to get emotional about, but thank you for your concern.
I asked the question.
Why do you need to see some kind of a hidden agenda behind it?
Why do you think it's an attempt to censor anything or a statement
against anything?

To me, your posting looked more like a allergic response. Sentences like
"If you know Java so much better, what are you doing here?" and "You
advocate using Java in a C++ newsgroup." suggest to me that there is
apparently something inappropriate about suggesting Java might be better
for the OP in a C++ newsgroup. Apparently I was wrong, my apologies.
I am in no way against Java or any other language. However, bold
statements indicating superiority of anything over something else,
which usually aren't or cannot be substantiated, lead to agitated
state of the participants of the discussion.

'mjm' did provide (sometimes invalid or at least way to general)
arguments why he believes Java is a better choice for the OP. Again I
don't agree with his assessment, but that does not necessarily make his
posting inappropriate.
If that (agitation)
is _not_ the intention, some kind of calming interruption is needed.

Your postings here are generally good, accurate and usefull for the OP.
But IMHO of all the qualities your postings have, being "calming" is
usually not one of them. On the other end of the cable they appear
sometimes to be a bit harsh.
I simply asked the question to see if 'mjm' had anything to say
that would clear him/her of my suspicion.
Yes, I suspect that 'mjm' is trolling (wilfully or not). But I
can be mistaken and that's why I've asked the question.

If you really think that 'mjm' is trolling, my advice would be don't
feed the troll. If he would be trolling, I would expect him to be the
starter of the thread or at least make a crossposting to one of the
comp.lang.java.* groups. Personally I think 'mjm' is just a Java
programmer struggling with C++, blaming his own inadequacies on the
language.
Take a deep breath. Count to ten. There is no need to jump on
anyone's throat. Yet.

Maybe you should listen to your own advice as well.

Enough said about this...
 
M

mjm

Victor Bazarov said:
What's your example of 'concise'?

I liked Flanagan's Java in a nutshell. The scope is much more limited
but it is very short and fairly complete.

I have a negative view of Stroustrup. The facts are diffuse, spread
all over the place and important topics are not treated exhaustively
in one place.
In addition to that there does not seem to be any desire to elucidate
what abstract principle or quality any given language construct aims
to express.
For example Barton-Nachman do this with EVERY major language
construct.

Some examples of what I could not find:

I could not find a definitive comparison of the notion of a variable
to that of a reference. If you just read the index for the key
"variable":

variable:
constructor for global 252
constructor for local 245
global 200, 228
number of argument 154
temporary 244, 254

There does not seem to be a place where the basic notion of a variable
itself
is treated. On page 200 and 228 there is no elucidation on the notion
of a variable. It is not worth my while to turn to page 244 or 254.


Elaboration on const member functions: page 229 (the anniversary
addition, only item about const member functions in the index).
Explanation by trivial example, there is not even an attempt to
formulate a definition of what a const member function is ("note the
keyword const, the function does not change the onbject") No
elaboration on such question such as

Can a const member function call a nonconst one as long as it does not
modify the object? Can a const member function return a nonconst
reference to data?

This is grossly inadequate. Maybe all these questions are answered
somewhere in the book but topics of that importance need to be treated
exhaustively in one location.

Nested classes: p293 (only reference in the index). There is only an
example. No features are elucidated. Reading this in reference to
nested class is totally useless and should not be included in the
index.

Some questions are treated under the heading of "member class" in the
appendix on page 852. Ie. no access either way but you can grant
access to the enclosing class by declaring the nested class a friend
of the enclosing class.

So, can the constructor of the member class then use data from the
enclosing class? Ie. construction of the member class would be tied to
an object of the enclosing class:

obj.new nested(i);

No elaboration. I am sure you can answer all that drawing on the
totality of the diffuse knowledge presented in this book. But not
posing and answering these questions in a treatise of 1000 pages is a
deficiency.

C++ distilled by Ira Pohl is articulated much better. I think this
author is one to consider.
 
V

Victor Bazarov

mjm said:
"Victor Bazarov" <[email protected]> wrote in message

I liked Flanagan's Java in a nutshell. The scope is much more limited
but it is very short and fairly complete.

Perhaps "C++ in a nutshell" would be similar to what you're looking
for. Stroustrup is definitely not that.
I have a negative view of Stroustrup. The facts are diffuse, spread
all over the place and important topics are not treated exhaustively
in one place.
In addition to that there does not seem to be any desire to elucidate
what abstract principle or quality any given language construct aims
to express.
For example Barton-Nachman do this with EVERY major language
construct.

Some examples of what I could not find:

BTW, what edition are we talking about?
I could not find a definitive comparison of the notion of a variable
to that of a reference. If you just read the index for the key
"variable":

variable:
constructor for global 252
constructor for local 245
global 200, 228
number of argument 154
temporary 244, 254

There does not seem to be a place where the basic notion of a variable
itself
is treated. On page 200 and 228 there is no elucidation on the notion
of a variable. It is not worth my while to turn to page 244 or 254.

"Variable" is one of the base concepts of programming. "TC++PL" is
not supposed to teach programming, only the language. If you take
TC++PL without knowing what "a variable" is, I say, you're not ready
for it.
Elaboration on const member functions: page 229 (the anniversary
addition, only item about const member functions in the index).
Explanation by trivial example, there is not even an attempt to
formulate a definition of what a const member function is ("note the
keyword const, the function does not change the onbject") No
elaboration on such question such as

Can a const member function call a nonconst one as long as it does not
modify the object? Can a const member function return a nonconst
reference to data?

Have you really seen any book that is able to answer _any_ questions
that happen to come to the reader's mind?

If you still need answers to those questions, here they are: no and no.
Both involve conversions that are not allowed implicitly.
This is grossly inadequate.

"Grossly", huh?
Maybe all these questions are answered
somewhere in the book but topics of that importance need to be treated
exhaustively in one location.

I see you have a good understanding what is important to have in
a book. I say you should attempt writing your own.
Nested classes: p293 (only reference in the index). There is only an
example. No features are elucidated. Reading this in reference to
nested class is totally useless and should not be included in the
index.

Index should not be the first place you open when reading a book.
You should attempt reading the book in its normal order or in the
order the author suggests in the preface.
Some questions are treated under the heading of "member class" in the
appendix on page 852. Ie. no access either way but you can grant
access to the enclosing class by declaring the nested class a friend
of the enclosing class.

So, can the constructor of the member class then use data from the
enclosing class? Ie. construction of the member class would be tied to
an object of the enclosing class:

obj.new nested(i);

No elaboration.

You're trying to apply Java concepts to C++. You apparently need
a book "C++ for Java programmers". A person without prejudice should
not have a problem with nested types. Nesting of types does not
presume nesting of objects (unlike in Java). Once you abstract from
what you know in Java and try simply learning C++, you might actually
do better with Stroustrup. Unless you don't have to make an effort,
of course.
I am sure you can answer all that drawing on the
totality of the diffuse knowledge presented in this book. But not
posing and answering these questions in a treatise of 1000 pages is a
deficiency.

Trying to answer them would add more 1000s of pages to that book.
Just imagine looking at a book 3-4 thousands of pages thick. Do you
think you would buy it? Do you think you'd treat it as a normal book
or would you again try to use it as a tome of encyclopaedia, starting
with the Index?
C++ distilled by Ira Pohl is articulated much better. I think this
author is one to consider.

Good. So, you will use Ira Pohl's book. That's why there are more
than two books published on the subject.

One thing I think is important to understand. No book can cover all
topics pertaining to such huge and complex set of concepts and rules
like C++ language to everybody's satisfaction. The Special Edition
already has more than 1000 pages and would probably still not satisfy
such picky critic as yourself. Combine "TC++PL", "C++ Templates",
"C++ Standard Library", "Standard C++ Streams", "Design and Evolution
of C++", "Advanced C++", "Modern C++ Design", "Effective" series,
"Exceptional" series, "Large-Scale C++ Software Design" and you would
probably come close to covering 50% of all the questions you might
have. And we haven't even begun talking platform-specific nonsense.

Perhaps you thought C++ would be easy, once you learned Java. You
grabbed the first book that you heard of, the one that started it all,
and went for the index to see how the syntax is different from Java
so that you could quickly rewrite what you have into C++ and be done
with it. Oops, it doesn't even have those concepts you were used to
while doing some Web server development. And, instead of scrapping
your previous approach and starting with the clean slate, you throw
the book away with disgust and a label of "inadequacy". However, as
shown by countless examples over the past fifteen years, other
programmers successfully used that book to learn the language and
never complained. I am not going to answer it, but a question is
nagging: who's inadequate?

Victor
 
R

Ron Natalie

Victor Bazarov said:
Perhaps "C++ in a nutshell" would be similar to what you're looking
for. Stroustrup is definitely not that.

C++ in a Nutshell has only come out in the past few months or so. It's
roughly along likes of the old ARM (only attempts to be up-to-date with
the latest standard).

I don't use Stroustrup anymore. It's a good book for the concepts, but I hardly
use it as a reference. I pretty much use the standard itself these days and
the two Jostutits books otherwise.
 
B

Bjarne Stroustrup

Victor Bazarov said:
I only put Stroustrup to rest about three years ago, eight years
after first opening it.

We are in 2003, three years ago must have been 2000, eight years
before that must have been something like 1992 - five years before the
current edition was written and five years before we had the final
text of the standard (in 1997).

Actually, the most recent printings of TC++PL3 reflect the 2003
revisions to the standard (fortunately, those are minor).

Yes, the Standard is good enough as a reference to what language contains.

For people who already understand the major programming techniques and
have a reasonable level of professionalism, that's obviously the case.
That's why we wrote the standard. However, it seems to me that many
programmers still suffer misconceptions such as "C++ is C with a few
features added" or "C++ is a somewhat odd object-oriented language".
Both views miss the point badly (leading to ugly, inefficient, and
hanrd-to-maintain code) and very few people would be dissuaded from
their misconceptions by the standard (or by any manual). My impression
is that a large number of people still think that all they need is a
manual/reference/standard.

Books are still needed
to explain the Standard and to provide idioms and patterns,
which are usually missing from references.

Yes, and the underlying assumptions and fundamental programming
concepts tend to be missing also.

To understand a language is to understand the programming techniques
it supports and how it supports them. A manual/reference describe only
the latter, and typically in a bottom up manner.

- Bjarne Stroustrup, www.research.att.com/~bs
 
V

Victor Bazarov

Bjarne Stroustrup said:
We are in 2003, three years ago must have been 2000, eight years
before that must have been something like 1992 - five years before the
current edition was written and five years before we had the final
text of the standard (in 1997).

You better believe it. If I'm not mistaken, I have three editions
-- the first in Russian, then the second and the special in English.
The fact that I don't pick it up for my daily excursions into C++
doesn't mean it lost its attractiveness in general. It just means
that I feel I've outgrown it. Perhaps that feeling is temporary.
Actually, the most recent printings of TC++PL3 reflect the 2003
revisions to the standard (fortunately, those are minor).

And I am sure those are going to be useful to many more programmers
when they decide to set aside some time to study the language.
contains.

For people who already understand the major programming techniques and
have a reasonable level of professionalism, that's obviously the case.
That's why we wrote the standard.

You know what's missing, though? A book on rationales used to put
the Standard together and subsequent discussions on defects and
corrections/additions. Yes, I know of D&E, but it's old and is not
as detailed as I'd like to see such a book. Or, could it be there
is already such a creation and I'm the last one to know about it?
However, it seems to me that many
programmers still suffer misconceptions such as "C++ is C with a few
features added" or "C++ is a somewhat odd object-oriented language".
Both views miss the point badly (leading to ugly, inefficient, and
hanrd-to-maintain code) and very few people would be dissuaded from
their misconceptions by the standard (or by any manual). My impression
is that a large number of people still think that all they need is a
manual/reference/standard.

Well, at some point, I believe, every professional switches from
textbooks to references and codes/standards. What is rather sad
is that some programmers coming from another language believe that
all they need to know is syntax for the constructs they've learned
already. With existing fundamental differences between programming
languages, such approach is, how should I put it?, reactionary, and
unfortunately detrimental to the learning process. Instead of
adding wisdom, expanding the horizon, the new knowledge seems
contradicting to what they've learned to be good practices or only
ways to achieve certain goals. Disappointment follows.

Is there a way to prevent that? It seems that when it happens, the
only way to put them on the right track is to add more trauma by
showing that they've been following the wrong path, which inevitably
produces more negative reaction, denial, antagonism, etc. Have you
noticed something like that? Do you have any suggestions to help us
help them to overcome certain deficiencies in the learning process?
Does it help to be closer to those who are learning intensively,
there at TAMU?

In any way, thank you for participating, I am sure the readers here
appreciate your time.

Victor
 
F

Frank Schmitt

Agent Mulder said:
Eljah> Are there any recommended books on Java or C++ (depending on which
Eljah> language I should learn first) for the beginner who only know PHP and
Eljah> BASIC?
Eljah>
Eljah> Sorry if this post some how offends somebody.

Go to your local second hand bookstore and find the books
on Java and C++. You'll probably find lots of both of them.
Decide on the language by the documentation that you can get.
It is not easy to recognize a good book but some general
guidelines are:

-good books are heavy books

That's so untrue, some of the best books I ever read are small & lightweight
("Accelerated C++", "The Pragmatic Programmer", ...), and most of the
computer / programming books with 1000+ pages are simply crap.

regards
frank
 
A

Alexander Terekhov

Bjarne Stroustrup wrote:
[...]
To understand a language is to understand the programming techniques
it supports and how it supports them.

AFAICS, C++ doesn't support things like: (see TC++PL)

void g(priority_queue<string,String_cmp>& pq)
{
priority_queue<string> pq2(String_cmp(nocase));
pq = pq2; // ok: pq and pq2 are of the same type, pq now also uses String_cmp(nocase)
}

Or am I just missing (e.g. some errata) and/or misunderstanding something?

regards,
alexander.
 
M

mjm

Attacking Stroustrup is somewhat of a blasphemy. The book is a
monumental work
I understand this completely.
BTW, what edition are we talking about?

I am talking about the anniversary addition. This addition comes with
a tasteful white cover. Everything is in flawless Greek proportion.
Width, height and thickness of the book, the size of the letters, the
size of the cover everything.

The cover design is highly artistic. The letters are dark blue and
golden yellow. There is a picture of a wave breaking in an interesting
pattern. In the foreground are the impressive letters

C++

three dimensional and in translucent greenish yellow.
Bound into the book are two clothen bookmarks in blue and golden
yellow.
The paper, printing and page layout are all of the highest quality.

This is the very finest in book binding, the best that Addison Wesley
has to offer flawlessly delivered. This book does not go on your
bookshelf, it goes into a glass display stand on blue velvet.

Victor,

I feel that you are a man which must own a copy of this edition -- my
copy.
In full appreciation of its significance I have always kept it in a
separate
special drawer and in consequence it is in mint condition.
Email me and I will make you an offer you cannot refuse.
 
V

Victor Bazarov

Paul Dubuc said:

The "Books and References" section I see these words:

<<The C++ Programming Language,
by Bjarne Stroustrup (3rd Edition, Addison-Wesley, 1997)

Bjarne Stroustrup is the creator of the C++ programming language,
and this book is the reference that he has written. It is a good
reference book, but not one you would sit down and read to learn
the language. (There is a copy of this book in the Sunlab.)>>

I think the text of this comment needs adjustment. It should say
"It is a good reference book, but not one _I_ would sit down and..."
Whoever wrote this should speak for himself. I learned the language
from that book, and I am not alone.

Also, I strongly recommend the authors of this "tutorial" to visit
www.accu.org, the book review section. Major advances have been
made in the field of sharing the knowledge in book form since this
was created. I do not see recommendations for "The C++ Standard
Library" or for "C++ Templates". A gross miss, IMO.

Further inspection of this "tutorial" shows "pearls" like this:
<<Useless trivia: The order in which the instance variables are
initialized is not the order in which they appear in the
initializer list, but instead the order in which they are listed
in the class declaration.>>

My question is: why is this called "useless"?

IOW, I already think this "tutorial" is useless. No need to look
any further.

Victor
 
A

Alexander Terekhov

Victor Bazarov wrote:
[...]
I think the text of this comment needs adjustment. It should say
"It is a good reference book, but not one _I_ would sit down and..."
Whoever wrote this should speak for himself. I learned the language
from that book, and I am not alone.

All statements are opinions, my fixated friend. Uhmm,

http://www.accu.org/cgi-bin/accu/rvout.cgi?from=0rv_Francis_Glassborow&file=cp003311a

also needs adjustment, I guess.

"This book will help ME achieve that latter objective while educating
ME about general framework design. "

ACE sucks, BTW.
Also, I strongly recommend the authors of this "tutorial" to visit
www.accu.org, the book review section. Major advances have been

Oh yeah. Francis is close to the establish "1K-computer-book" record.

[...]
IOW, I already think this "tutorial" is useless. No need to look
any further.

Hey Bazarov-the-reviewer, you forget to plonk the URL.

regards,
alexander.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top