Should I learn C++?

R

red floyd

Walter said:
Victor Bazarov wrote: t than in C++.

You do learn to appreciate an auto after learning a stick <g>.

My problem when driving my wife's automatic (I have a stick) is that I
keep reaching for the stick...
 
W

Walter Bright

red said:
My problem when driving my wife's automatic (I have a stick) is that I
keep reaching for the stick...

LOL. Every once in a while, when driving an automatic, I'll step on the
"clutch" when coming to a red light. Stands the car on its nose.

There's no real pleasure in driving an auto, though. But I prefer an
auto in creeping rush hour traffic, as there's no pleasure in that anyway.
 
I

Ian Collins

red said:
t than in C++.



My problem when driving my wife's automatic (I have a stick) is that I
keep reaching for the stick...

You think that's bad, try driving a left hand drive manual after 20
years of driving a right hand drive one. Unfortunately I'm at a loss to
find a C++ analogy for that :)
 
R

Roland Pibinger

I would recommend against learning C++ if your stated goal is to
broaden your horizons. From a language perspective C++ is quite
similar to Java which you already know.

C++ and Java are quite different but anyway ... The main reason to
avoid C++ as teaching language is its enormous but unnecessary
complexity which distracts the student from understanding basic
concepts.
I strongly recommend that you cast your net a bit further. In
particular, I would recommend a LISP variant because it is so easy to
write mini-languages within it. Haskell would be good because it is a
purely functional, lazy language and learning its type system will be
quite insightful.

There has been a trend in recent years for new (non-academic)
programming languages to combine functional and OO concepts
(JavaScript, Python, Ruby, Lua, Scala). BTW, C++ also has a prominent
functional library: STL.
I think there are huge advantages to be able to think in completely
different paradigms (even if you stick with Java professionally),

Definitely. The requirements on the job market change rapidly, the
basic concepts and paradigms not.
I strongly recommend
reading the book "Structure and Interpretation of Computer
Programs" (which uses Scheme): http://mitpress.mit.edu/sicp/. This
book is quite amazing. Talk about broadening your horizons.

MIT apparently switches to Python as teaching language:
http://www-tech.mit.edu/V125/N65/coursevi.html.
 
J

James Kanze

If you want a broad range of useful programming skills, then C++ is a
must to learn, along with Java, Ruby, Lisp, Assembler, and D.

If you're going to be effective, you do have to learn several
languages; no one language does it all. But I'm not sure I
would agree with your list: I've seen no real demand for Ruby,
Lisp or D anywhere (although Lisp, at least, is useful, if only
to force you to think in a different way---and of course, if you
use emacs as your editor, you'll need it). On the other hand,
some sort of scripting language is a must, and as horrible as it
might be, you'll probably have to learn make at sometime.

A lot depends on the goals. If the goal is learning, a language
with a radically different idiom would probably be best: if you
already know Java, for example, you'll learn a lot more learning
Scheme or some other functional language that you will learning
C++. If the goal is to practically prepare for what you'll need
professionally, a lot depends on the type of work you want to do
professionally. In my work (server development), for example,
in addition to C++, I need Unix (and its shells)---I probably
get called on for my expertise in sh and awk as often as I do
for C++. Some knowledge of SQL is also expected. And of
course, no matter what you do, you should learn your basic
toolset: editor, etc. (For that matter, if you can't already
touch type, that should be your first priority. When you're
writing code, you want to be thinking about the code, and not
where the characters are on the keyboard.)

And don't forget about the techniques: things like design,
threading, etc. Independent of the language (more or less), but
if you don't know them, you're programs won't work.
 
J

James Kanze

I would recommend against learning C++ if your stated goal is to
broaden your horizons. From a language perspective C++ is quite
similar to Java which you already know.

It depends on which direction he wants to broaden them:).

IMHO, there is a definite interest in going beyond the language,
and learning programming techniques: functional programming,
design patterns, etc. Your recommendation of:
BTW, if you have not already read this, then I strongly recommend
reading the book "Structure and Interpretation of Computer
Programs" (which uses Scheme):http://mitpress.mit.edu/sicp/. This
book is quite amazing. Talk about broadening your horizons.

is excellent, in this sense, not because of Scheme, per se, but
because of the higher level thought processes it teaches. In
the end, the language is just a tool, you learn Scheme not for
Scheme, but because it is a convenient tool for teaching these
thought processes. Similarly, you might want to learn C++ not
for C++, because a number of recent works on meta-programming
are based on C++.

All of which is a very good, and IMHO very important direction
to broaden horizons. On the other hand, one can take a more
practical approach: SQL or a Unix shell will also broaden your
horizons, in a very different way. (I recently wrote a build
system entirely in GNU make. Talk about broadening horizons.)

Other possible directions: Excel, or LaTeX or HTML. (You'll
need to learn to write documentation. HTML is a good support
for that, since it can be used everywhere, and LaTeX will
produce the most beautiful results.)
 
D

dave_mikesell

On the other hand,
some sort of scripting language is a must, and as horrible as it
might be, you'll probably have to learn make at sometime.

I'll bite - what's so horrible about make?
 
U

Unknownmat

My Ford is similar to my Landrover, but the latter gets me to way more
interesting places.

While I somewhat see the analogy, I'm not sure that I really
understand your point. It's not even clear to me whether you're
agreeing or disagreeing.

I'm not saying that there is never any value in learning C++. I just
personally find that I employ many of the same idioms when using
either C++ or Java, and that there are many interesting programming
techniques that are not idiomatic in either.
 
U

Unknownmat

C++ and Java are quite different but anyway ... The main reason to
avoid C++ as teaching language is its enormous but unnecessary
complexity which distracts the student from understanding basic
concepts.

While I will agree that they are different, I find them much more
similar to each other than they are to languages like LISP, or
Haskell.

I agree that the difficulty of C++ has caused many a student to
prematurely end their CS careers. When I went through school, we
required two full semesters of C++ prior to even getting into basic
data structures and algorithms. Interestingly, my classmate who came
from a Java background had a tremendous amount of difficulty adapting
to C++ (mostly the pointers gave hime trouble). This is one reason
that I like the book SICP so much. It's almost purely about
programming concepts, and the language is almost inconsequential.
There has been a trend in recent years for new (non-academic)
programming languages to combine functional and OO concepts
(JavaScript, Python, Ruby, Lua, Scala). BTW, C++ also has a prominent
functional library: STL.

Yes, functional abstractions can be very useful.

Interesting, I never would have considered STL to be functional. Do
you have any sources that talk about this? Frankly, the more I think
about it, the less I see it. While STL does provide the rudiments of
a "map" routine (for_each), off the top of my head I can't think of
filter / reduce routines. Similarly, iterators don't strike me as
especially functional.

Anyway, I'm hardly an expert on what is "functional". Just based on
things are that common in functional languages (no side effects, first-
class functions, function composiition, higher-order functions, etc.)
STL doesn't seem to embody any of those.
MIT apparently switches to Python as teaching language:http://www-tech.mit.edu/V125/N65/coursevi.html.

Oh interesting. Python is definitely a friendly, powerful language.
They could certainly do worse.
 
U

Unknownmat

is excellent, in this sense, not because of Scheme, per se, but
because of the higher level thought processes it teaches. In
the end, the language is just a tool, you learn Scheme not for
Scheme, but because it is a convenient tool for teaching these
thought processes.

Right, completely agreed. I wouldn't want my comments to be
misconstrued as favoring any one language. I'm a huge supporter of
understanding underlying concepts as the goal, and languages are just
tools. I will say that as far as teaching languages go, Scheme does a
fairly good job of simply getting out of the way.
Similarly, you might want to learn C++ not
for C++, because a number of recent works on meta-programming
are based on C++.

Yes, I also agree that templates are one of the more interesting
contributions of C++ to the programming world. Perhaps "meta
programming" has been adequately categorized elsewhere, but I find
templates to be an interesting combination of parametric polymorphism,
and lisp-style macros.
All of which is a very good, and IMHO very important direction
to broaden horizons. On the other hand, one can take a more
practical approach: SQL or a Unix shell will also broaden your
horizons, in a very different way. (I recently wrote a build
system entirely in GNU make. Talk about broadening horizons.)

Yes, I assumed that an understanding of the underlying architecture
(As well as some database query language) would be part of any decent
Java education. But I do agree that they are important.
 
I

Ian Collins

Unknownmat said:
While I somewhat see the analogy, I'm not sure that I really
understand your point. It's not even clear to me whether you're
agreeing or disagreeing.
C++ can be used anywhere Java can, but the converse isn't true. The
capabilities of Java are a subset of C++.
 
U

Unknownmat

C++ can be used anywhere Java can, but the converse isn't true. The
capabilities of Java are a subset of C++.

Yes, I understood that. But to extend your analogy (assuming the goal
was a mastery of mechanical means of transportation) driving a Lang
Rover would be nothing like flying a helicopter, or piloting a boat.

I'm not even interested in the relative merit of any given approach.
I'm just saying that there are fundamental differences that go beyond
the differences between Java / C++.
 
I

Ian Collins

Unknownmat said:
Yes, I understood that. But to extend your analogy (assuming the goal
was a mastery of mechanical means of transportation) driving a Lang
Rover would be nothing like flying a helicopter, or piloting a boat.
Lang Rover? I was trying to say that if "broaden your horizons"
includes entering new areas of development, say high performance
(games), drivers or embedded, then there is much to be gained by
learning C++ if you already know Java.
 
J

James Kanze

[...]
C++ can be used anywhere Java can,

That's not true. There are contexts where the fact that the
compiled code can run on a machine you've never heard of is an
advantage, or even a necessity, and you don't need a high degree
of reliability.
 
I

Ian Collins

James said:
[...]
C++ can be used anywhere Java can,


That's not true. There are contexts where the fact that the
compiled code can run on a machine you've never heard of is an
advantage, or even a necessity, and you don't need a high degree
of reliability.
If Java can run on it, it has a JVM which is written in ...

Grumble...
 
B

Bo Persson

Ian Collins wrote:
:: James Kanze wrote:
:::
::: [...]
:::
:::: C++ can be used anywhere Java can,
:::
:::
::: That's not true. There are contexts where the fact that the
::: compiled code can run on a machine you've never heard of is an
::: advantage, or even a necessity, and you don't need a high degree
::: of reliability.
:::
:: If Java can run on it, it has a JVM which is written in ...

C++ of course. The most portable language. :)

Java is sometimes easier to use, when someone else has already ported the
JVM for you.



Bo Persson
 
R

Roland Pibinger

Yes, functional abstractions can be very useful.
Interesting, I never would have considered STL to be functional. Do
you have any sources that talk about this? Frankly, the more I think
about it, the less I see it. While STL does provide the rudiments of
a "map" routine (for_each), off the top of my head I can't think of
filter / reduce routines. Similarly, iterators don't strike me as
especially functional.

Conceptually STL algorithms operate on a sequence of immutable values
and 'return' a new sequence of immutable values. Even though the
actual implementations of (mutating) algorithms do not create a new
sequence but overwrite the current sequence the underlying concept is
identifiable. When you search for 'STL functional programming' you'll
find more hints. Actually, the introduction of STL was the attempt to
replace the OO paradigm with the functional paradigm as leading
paradigm in C++.
 
D

dave_mikesell

If you're bringing an off-topic, please mark your posts as such.


I didn't bring it up, I asked a followup question. If you're going
to continue to be a forum cop on a unmoderated forum, at least try to
be consistent.
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top