By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

The Future of C++ ?

P: n/a
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I do believe that C++ is more difficult to learn than many of these
other languages. Despite my best efforts to make them exciting, I see
the eyes of my students start to glaze over when I start explaining
pointers. When I ask them to tokenize an english sentence (using the
strtok() function) and print the token in reverse order (they need to
declare an array of type char * and save the addresses of the tokens in
this array), I experience near panic from many of my students. But
these concepts need to be taught in a responsible C++ course. As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.

The ironic part is there is still a large demand for C++ developers
here in Vancouver. In fact, the company that I believe employs the
most developers here in Vancouver, employs almost entirely C++
programmers. This company, Electronic Arts (if you have not heard of
them, I guarantee that your kids have -- they create video games) is
only one of several gaming companies here in Vancouver that employ
primarily C++ programmers. Other companies like Kodak, MDSA, Nokia,
MDSI, etc. also employ large numbers of C++ programmers. Not
surprisingly, I have talked to several companies here in Vancouver who
are complaining that they are having difficulty finding C++ developers
and are looking at trying to recruit from abroad (eastern Europe
primarily).

I believe that many of these companies will be forced to migrate away
from C++ in the near future, simply because they will not be able to
find C++ programmers in the future. Soon the baby boomer C++
programmers will begin to retire, then the proverbial @@@@ will really
start to hit the fan!

Please tell me I am wrong, and paint me a view of the future which
includes C++.

Nov 18 '06 #1
Share this Question
Share on Google+
190 Replies


P: n/a
* blangela:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I do believe that C++ is more difficult to learn than many of these
other languages. Despite my best efforts to make them exciting, I see
the eyes of my students start to glaze over when I start explaining
pointers. When I ask them to tokenize an english sentence (using the
strtok() function)
There you have it: you're teaching the hard C parts first. Am I right
that these students who're choosing between Java, C# and C++ have no
programming background? I then think learning C# (or even JavaScript!)
first is a good idea wrt. learning programming, and learning Java a good
idea wrt. learning something helpful in getting a job without learning
more first.

and print the token in reverse order (they need to
declare an array of type char * and save the addresses of the tokens in
this array), I experience near panic from many of my students. But
these concepts need to be taught in a responsible C++ course. As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.
Again, teach 'em use of standard library classes first. std::string
isn't fancy. Show that C++ can be a productive language at that level.

After learning "high level" C++, teach them in a separate course about
the C subset.

Course e.g. entitled "The C subset of C++: pointers & other hairy
stuff", where for example you can go into why two-phase initialization
isn't a very bright idea in general, but why it's necessary on some
limited platforms such as Symbian C++ (lacking C++ exceptions).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 18 '06 #2

P: n/a
blangela wrote:
Please tell me I am wrong, and paint me a view of the future which
includes C++.
Modern C++ is a very powerful language, and the existing literature and
corpus of example software lags far behind its capacities.

Java and .NET thrive due to "management by magazine". Because the price of
C++ is a high risk of bugs, marketects can advertise Java (and its direct
clone) as "safer and more robust".

Programmers who actually learn C++ are directly competitive with the VM
languages. Those languages typically _reduce_ their available features, to
make code appear easier to make right. This generally causes you to write
more cruft in those languages.

A C++ programmer will deliberately but _voluntarily_ reduce their set of
working techniques, till they are using ones with matching robustness.

(Note, Java-philes, I did _not_ say smart pointers are the equivalent of
Java references. Each has different robustness profiles.)

The distinction is C++ programmers have the _option_ to get closer to the
metal, when they need it.

Contrarily, the majority of programming these days is high-level; trivially
gluing applications together from large-scale components, such as GUIs and
databases. The GUIs and databases themselves should be slowly written once,
in C++. The high-level code should be rapidly written in a safer and more
flexible scripting language.

There may not always be a world for average C++ coders, but there will
always be a world for the C++ code itself.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 18 '06 #3

P: n/a
I would frame it that way that people are running behind short term
gain.

I am a C++ programmer myself and havent had any training or havent read
any book of C# but I am doing job in C# for 8-9 months now without
facing any real problem and thats because I was good at C++.

When they run for one technology they become lame in a sense that its
temporary and C++ is more or less the base and so its permanent.

As we see now C# has descendant like F# and so you cannot be learning
each of them but if you have the base you can opt for anything anytime
and so still I think C++ is the future.

Thanks
Shabbir
--
www.cfanatic.com - Community discussing C and its derivatives like
Win32, C++, MFC, C# tutorials

On Nov 18, 10:25 am, "blangela" <Bob_Langel...@telus.netwrote:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I do believe that C++ is more difficult to learn than many of these
other languages. Despite my best efforts to make them exciting, I see
the eyes of my students start to glaze over when I start explaining
pointers. When I ask them to tokenize an english sentence (using the
strtok() function) and print the token in reverse order (they need to
declare an array of type char * and save the addresses of the tokens in
this array), I experience near panic from many of my students. But
these concepts need to be taught in a responsible C++ course. As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.

The ironic part is there is still a large demand for C++ developers
here in Vancouver. In fact, the company that I believe employs the
most developers here in Vancouver, employs almost entirely C++
programmers. This company, Electronic Arts (if you have not heard of
them, I guarantee that your kids have -- they create video games) is
only one of several gaming companies here in Vancouver that employ
primarily C++ programmers. Other companies like Kodak, MDSA, Nokia,
MDSI, etc. also employ large numbers of C++ programmers. Not
surprisingly, I have talked to several companies here in Vancouver who
are complaining that they are having difficulty finding C++ developers
and are looking at trying to recruit from abroad (eastern Europe
primarily).

I believe that many of these companies will be forced to migrate away
from C++ in the near future, simply because they will not be able to
find C++ programmers in the future. Soon the baby boomer C++
programmers will begin to retire, then the proverbial @@@@ will really
start to hit the fan!

Please tell me I am wrong, and paint me a view of the future which
includes C++.
Nov 18 '06 #4

P: n/a
[...]
(Note, Java-philes, I did _not_ say smart pointers are the equivalent of
Java references. Each has different robustness profiles.)
Java references (e.g., strong thread-safe reference counting) in C++? No
problem:

http://appcore.home.comcast.net/vzoom/refcount/
This can be used as an alternative to Boost shared_ptr, which is only basic
thread-safe....
Any thoughts?
Nov 18 '06 #5

P: n/a
Chris Thomasson wrote:
Java references (e.g., strong thread-safe reference counting) in C++? No
problem:

http://appcore.home.comcast.net/vzoom/refcount/
Refcounting is not the same as a GC.
Nov 18 '06 #6

P: n/a
blangela wrote:
When I ask them to tokenize an english sentence (using the
strtok() function) and print the token in reverse order (they need to
declare an array of type char * and save the addresses of the tokens in
this array), I experience near panic from many of my students.
Maybe students just don't come because they think your course is bad.
They want to learn C++, not C.
As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.
Thankfully, Microsoft is not the only company where you can do programming.
Plus Microsoft isn't really doing C++ anyway, more like C with classes.
Nov 18 '06 #7

P: n/a
"loufoque" <lo******@remove.gmail.comwrote in message
news:45**********************@news.free.fr...
Chris Thomasson wrote:
>Java references (e.g., strong thread-safe reference counting) in C++? No
problem:

http://appcore.home.comcast.net/vzoom/refcount/

Refcounting is not the same as a GC.
You can get very similar guarantees' wrt strong atomic thread-safety
level... And, as you know, one can always get around cyclic references via.
clean/coherent synchronization scheme, or custom and/or "built-into-details"
weak pointer logic...

http://groups.google.com/group/comp....c94118046142e8
(more on true atomic refcounting... interesting thread indeed... ?)

I would argue that a coupling of clean synchronization interface in which
cyclic references are rare, with some lightweight weak-pointer scheme would
give you strong guarantees' of Java references, in C++, but at a
lower-level... You have more control over the atomic operations and memory
barrier operations, and you don't need to tie yourself to a VM "system"
API...

Humm...
Nov 18 '06 #8

P: n/a
On 17 Nov 2006 21:25:35 -0800, Bob_Langelaan wrote:
>I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++.

I do believe that C++ is more difficult to learn than many of these
other languages.
IMO, that's the main reason. C++ is unnecessarily and unproductively,
sometimes even ridiculously complex (see e.g.
http://www.bookpool.com/ct/98031). There has been no effort in the
last 10 or so years to make it easier and more accessible. Quite the
contrary, an influential group of people even tries to 'boost' C++ by
continuously introducing yet another level of complexity.
>Despite my best efforts to make them exciting, I see
the eyes of my students start to glaze over when I start explaining
pointers.
But
these concepts need to be taught in a responsible C++ course. As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.
C++ is a highly fragmented language. When C++ is discussed one must
always ask: Which C++? Visual C++ (MFC), Embedded C++, Qt C++, C with
classes (the most popular C++), Boost C++, Addison Wesley C++, Game
Programmer C++, ...? This confusing fragmentation is sometimes
reinterpreted as advantage and C++ is touted as 'multiparadigm'
language.
>The ironic part is there is still a large demand for C++ developers
here in Vancouver. I have talked to several companies here in Vancouver who
are complaining that they are having difficulty finding C++ developers
and are looking at trying to recruit from abroad (eastern Europe
primarily).
There is still demand for C++ developers but currently there is higher
demand for developers in other languages, esp. Java (until the bubble
bursts again).
>I believe that many of these companies will be forced to migrate away
from C++ in the near future, simply because they will not be able to
find C++ programmers in the future. Soon the baby boomer C++
programmers will begin to retire, then the proverbial @@@@ will really
start to hit the fan!
AFAIK, you can program games today in any language, preferably C#.

The real solution would be C++2, a new version of the C++ language
(not an extension of the current language). I should avoid the
numerous traps, pitfalls and wrong defaults of the current language.
C++2 could be compatible with (but not a superset of) current C and
C++ (through a compatibility mode). Of course, that's a futile
proposal. That kind of language evolution happens in Python, Ruby,
PHP, ... but not in C++.

Best regards,
Roland Pibinger
Nov 18 '06 #9

P: n/a
Roland Pibinger wrote:
C++ is a highly fragmented language. When C++ is discussed one must
always ask: Which C++? Visual C++ (MFC), Embedded C++, Qt C++, C with
classes (the most popular C++), Boost C++, Addison Wesley C++, Game
Programmer C++, ...? This confusing fragmentation is sometimes
reinterpreted as advantage and C++ is touted as 'multiparadigm'
language.
Looks like you didn't get it at all. They're just frameworks. Libraries.
It's the same C++ but the libraries are designed differently and use
different language features.

Java, for example, also has multiple frameworks, even for one unique
thing (GUI, game development...)

The multiparadigm aspect isn't related to that at all. C++ is said to be
multiparadigm because it has supports for various kinds of programming
paradigms : imperative, object-oriented, generic, and possibly more.

AFAIK, you can program games today in any language, preferably C#.
Games is one of the key domains that really need an efficient language
like C++...

The real solution would be C++2, a new version of the C++ language
(not an extension of the current language). I should avoid the
numerous traps, pitfalls and wrong defaults of the current language.
C++2 could be compatible with (but not a superset of) current C and
C++ (through a compatibility mode).
The main traps and pitfalls in C++ are from its compatibility with C.
Nov 18 '06 #10

P: n/a
loufoque wrote:
Refcounting is not the same as a GC.
In terms of language advocacy, C++ gives you the tools to build whatever
quasi-GC system you want (including a true GC). It doesn't bend you over and
stuff the One True Garbage Collector up your butt.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 18 '06 #11

P: n/a


On Nov 18, 7:25 am, "blangela" <Bob_Langel...@telus.netwrote:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.
.. snip ..
Please tell me I am wrong, and paint me a view of the future which
includes C++.
Imho .NET will finally fall, as the open-source will knock it down, but
..NET is making it's final breaths... You just need to wait

Nov 18 '06 #12

P: n/a
blangela:
What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I think that a prerequisite to being a decent programmer is to have above
average intelligence. A minority of people have above average intelligence,
and so a minorty of people aspire to be an actual bonafide programmer
programming in languages such as C and C++.

For the less bright among us, there's Java.

Electronic Arts (if you have not heard of
them, I guarantee that your kids have -- they create video games) is
only one of several gaming companies here in Vancouver that employ
primarily C++ programmers.

Computer games should be fast, and C++ can give performance.

Not
surprisingly, I have talked to several companies here in Vancouver who
are complaining that they are having difficulty finding C++ developers
and are looking at trying to recruit from abroad (eastern Europe
primarily).

We've the same situation with medical doctors here in Ireland.

--

Frederick Gotham
Nov 18 '06 #13

P: n/a

I see a fair amount of responses to my initial post, but very few
people willing to go out on a limb and predict the future of C++.
Perhaps we will just have to wait and see.

In response to those people who were critical of my C++ course (the
post was not meant to get opinions on my course) I will mention the
following facts:

- I use as my primary text "C++ - How To Program" 5th edition by
Deitel & Deitel which is by far the most popular college C++ text in
the world! My favorite C++ text is actually "C++ Primer" 4th edition
by Lippman and company, but it is difficult to use as an introductory
C++ text - I do reference several sections from the text in my courses.

- Students are supposed to have taken the Java BlueJ courses (2 - 12
week courses, 3 hours/week including labs) as a prerequisite to my C++
courses. Thus I can expect that they already have experience with OOP.

- Classes are introduced in the first lecture of my course. So also
is the string class. I do not introduce pointers until the 8th
lecture. I suspect the text does so at that point so we can start
working with dynamically created objects (using the new and delete
operators). I could show how to assign a dynamically created object to
a reference rather than to a pointer, but this might lead students to
think this is the norm, which in my experience is not the case (I
wonder why it is not done more often?).

Cheers,

Bob

Nov 18 '06 #14

P: n/a
blangela wrote:
If you had asked me 5 years ago about the future of C++,
I would have told you that its future was assured for many years to come.
Recently, I have been starting to wonder.
[snip]
Please tell me I am wrong
and paint me a view of the future which includes C++.
The design of Java, C# and other such languages
sacrifice performance and efficiency for simplicity and convenience.
C++ is a larger and more difficult language because Bjarne Stroustrup
refused to compromise performance and efficiency --
he was targeting C programmers.

The Java designers realized that most applications didn't require
the performance and efficiency offered by C (and C++) and very carefully
calculated the trade-offs for simplicity and convenience.
The success of Java (and C#) have vindicated these trade-offs.

The future of C++ appears to be secure
where performance and efficiency count.
According to Bjarne Stroustrup, there are no viable competitors yet.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 18 '06 #15

P: n/a

E. Robert Tisdale wrote:
..
..
..
The future of C++ appears to be secure
where performance and efficiency count.
According to Bjarne Stroustrup, there are no viable competitors yet.
But can there be C++ without C++ programmers?

Nov 18 '06 #16

P: n/a
blangela wrote:
....
>
Please tell me I am wrong, and paint me a view of the future which
includes C++.
C++ is a very large language with many many uses. It will persist for a
considerable time.

The biggest advantage for Java is that they have many useful
standardized libraries as part of the standard distribution. C++ has a
plethora of non standard libraries that do vastly more than Java but it
takes a significant amount of knowledge to navigate.

Boost has been an attempt to consolidate the C++ world and there are others.

The nice thing about some of the stuff I have seen is that the number of
amazing libraries I see showing up in C++ land are significantly better
than the Java or .NET systems and are probably more "robust" than Java
or .NET.

I have also met a number of Java coders who have migrated over to C++
because they're frustrated with Java.

If I was teaching C++ today, I would avoid C-isms in the "101" course
and only introduce the ones that "helped".

I would have a wrapper over main ...
int main( const std::vector< std::string & args )
{
std::cout << "Hello world\n";
return 0;
}
Nov 18 '06 #17

P: n/a
blangela wrote:
E. Robert Tisdale wrote:
.
.
.
>The future of C++ appears to be secure
where performance and efficiency count.
According to Bjarne Stroustrup, there are no viable competitors
yet.

But can there be C++ without C++ programmers?
No, but there is a lot off difference between "go away" and not being the
most popular language at the moment.

Both Java and .NET have large companies behind them, using millions and
millions for promotion. Of course they are popular, "the best thing since
sliced bread".

Bjarne can never compete with that. Even though he is right!
Bo Persson
Nov 18 '06 #18

P: n/a
Roland Pibinger <rp*****@yahoo.comwrote:
>IMO, that's the main reason. C++ is unnecessarily and unproductively,
sometimes even ridiculously complex (see e.g.
http://www.bookpool.com/ct/98031). There has been no effort in the
last 10 or so years to make it easier and more accessible. Quite the
contrary, an influential group of people even tries to 'boost' C++ by
continuously introducing yet another level of complexity.
I don't think that C++ is too large and complex, yet, but
I do see possibly too much feature-creep via the standards process.
Standards activities tend to become spoiled by their own
success. Not to say that those involved aren't doing a
superb job, but standards work is very difficult (much more
difficult than development).

I have known of software managers to move away from C++
due to a concern it is getting too large and uncontrollable.

A better approach, I think, would be to use C++ but impose
some discipline as to what libraries are used (and perhaps even,
what (non-library) language features are routinely used, but
there I think the concern is smaller).

Steve
Nov 18 '06 #19

P: n/a
Steve Pope wrote:
I don't think that C++ is too large and complex, yet, but
I do see possibly too much feature-creep via the standards process.
Oh, totally, a new version once per decade is just blowing us all down.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 19 '06 #20

P: n/a
Bo Persson wrote:
Both Java and .NET have large companies behind them,
using millions and millions for promotion.
Of course they are popular,
"the best thing since sliced bread".

Bjarne can never compete with that. Even though he is right!
Bjarne certainly could compete.
But he has moved on to bigger and better things.

The first big problem with Java and .NET is that
they are not publicly owned standards like C++.
The language definitions can (and do) change without notiece.
This usually isn't a problem because the typical application
written in Java (or the Microsoft equivalent) has a very short life.

A better question is, "What is the future of Java?"
Computer programming languages tend to become more complex
in order to deal with ever more complex applications.
Eventually, Java may be as complex as C++
and the advantages will disappear.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 19 '06 #21

P: n/a

Bo Persson wrote in message <4s************@mid.individual.net>...
>
Both Java and .NET have large companies behind them, using millions and
millions for promotion.
.....and suppression. Buy the competition, and shut it down!
[ goodbye Tex Murpjy. ;-{ ]

Fortunately, GNU ain't for sale.

--
Bob R
POVrookie
Nov 19 '06 #22

P: n/a

"Alf P. Steinbach" <al***@start.nowrote in message
news:4s************@mid.individual.net...
After learning "high level" C++, teach [students] in a separate course
about the C subset.
Ha! As if that was even a possibility considering the first thing they
encounter is main()!

Tony
Nov 19 '06 #23

P: n/a

blangela wrote:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.
Hey, that's great news. Less cheap labor competition makes me a more
expensive commodity. It also makes my life easier when I don't have to
deal with the bozos comming out of college these days. Let them write
horrible crap in C# or Java. I win either way...I can't loose, no way
is C++ going away any time soon, so this can only be good news.

I say make your course tougher. Weed out the idiots for us.

Nov 19 '06 #24

P: n/a
E. Robert Tisdale wrote:
...
The Java designers realized that most applications didn't require
the performance and efficiency offered by C (and C++) and very carefully
calculated the trade-offs for simplicity and convenience.
The success of Java (and C#) have vindicated these trade-offs.
...
I think Java may have become harder to learn than C++
http://tinyurl.com/yaxr9p
So much for simplicity.

--
Paul M. Dubuc
Nov 21 '06 #25

P: n/a

Paul M. Dubuc wrote:
E. Robert Tisdale wrote:
...
The Java designers realized that most applications didn't require
the performance and efficiency offered by C (and C++) and very carefully
calculated the trade-offs for simplicity and convenience.
The success of Java (and C#) have vindicated these trade-offs.
...

I think Java may have become harder to learn than C++
http://tinyurl.com/yaxr9p
So much for simplicity.
That "article" doesn't offer anything but hearsay. It's like an
article quoting Bob Villa saying, "Pine sucks."

Nov 22 '06 #26

P: n/a
gn
Hi,

First of all I have to excuse my very bad english, but I hope
everything comes clear.
In my opinion C++ has a very safe future. Important points like speed
and the possibility of low-level manipulations were already mentioned,
but not the main advantage of C++.
It is the possibility of generic programming using Templates and
Template-Metaprogramming (As an introduction to this topic I read
"Modern C++ Design" by Andrei Alexandrescu -- a book that no C++
Programmer should miss!). People getting used with it will realize that
these programming techniques are just at the very beginning and will
develop over the next years.
A main problem talking about C++ is that still most of todays C++
programmers have started with C and that they still do not understand
that a C++ program using things like makros or printf is a bad C++
programm. There is of course still a need of low-level C-functions but
they should always be capsuled (I don't know the correct term here in
english) in a generic library. Coming from other languages I just
started learning C++ in 2005. But it's my daily work now since one
year and even for trivial little things I am no longer using other
languages. As an introduction I had a course at our university (Marburg
- Germany) together with about 35 other computer scientists. Here in
Germany Java is a mandatory topic in the first semester of each
computer scientist, but all of them who are planning to become a
programmer will take a facultative C++ course. If you ask one of them
why, everybody would answer that java is a nice thing to play around a
little bit, but real programmers use C++.
I think it will take some years until people are really programming C++
(and not C with classes like most people currently do). There is also
much to do in the compiler development (but that is another topic).
Another point is that I absolutely don't think that C++ is a
complicated or hard to learn language. There are of course some things
that seem to be a bit confusing. In that case read Bjarne's book "The
C++ programming language". You will fastly learn to think like Bjarne
thinks and everything will come clear.

Best regards,
gn

Nov 22 '06 #27

P: n/a
gn wrote:
First of all I have to excuse my very bad english, but I hope
everything comes clear.
In my opinion C++ has a very safe future. Important points like speed
and the possibility of low-level manipulations were already mentioned,
but not the main advantage of C++.
It is the possibility of generic programming using Templates and
Template-Metaprogramming (As an introduction to this topic I read
"Modern C++ Design" by Andrei Alexandrescu -- a book that no C++
Programmer should miss!). People getting used with it will realize that
these programming techniques are just at the very beginning and will
develop over the next years.
The part of template-metaprogramming that will never go away is the
incredible optimizations it provides.

However, template-metaprogramming should never be considered a programmer
convenience. A program often must use templates to achieve "duck typing" -
if it waddles like a duck and quacks like a duck, it's a duck.

Other languages provide that in their basic object model, without the need
for a whole new syntax superimposed on top of the existing system. So
template's edge in optimization only represents the compilers for these
languages catching up to C++.
...If you ask one of them
why, everybody would answer that java is a nice thing to play around a
little bit, but real programmers use C++.
And Java is not the "other languages" I have in mind. Java was invented to
take market share from C++ class libraries - such as MFC. So the language's
marketing pitch is it's safer than C++ - you can't run off the end of an
array, for example.

Actually, it's just harder to run off the end of the array. It's also harder
to get work done, because Java takes much away from C++ while adding almost
nothing back.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 22 '06 #28

P: n/a
gn

Phlip schrieb:
gn wrote:
....
The part of template-metaprogramming that will never go away is the
incredible optimizations it provides.

However, template-metaprogramming should never be considered a programmer
convenience. A program often must use templates to achieve "duck typing" -
if it waddles like a duck and quacks like a duck, it's a duck.

Other languages provide that in their basic object model, without the need
for a whole new syntax superimposed on top of the existing system. So
template's edge in optimization only represents the compilers for these
languages catching up to C++.
Yes, you are absolutely right if you say that the template concept
could be realized with a much easier synthax. But that kind of
programming can only be done by a language using a real compiler (the
thing with templates is to be generic without loosing speed --
therefore the costs of being generic are shifted to compile time). So I
would agree that a language providing these powers with an easier
synthax might be the language of the future.
But the other languages discussed here were java and .net languages
which can principly not provide this feature.
And Java is not the "other languages" I have in mind. Java was invented to
take market share from C++ class libraries - such as MFC. So the language's
marketing pitch is it's safer than C++ - you can't run off the end of an
array, for example.
I am just interested -- do you have a special language in mind, that
also maybe a candidate for future standards?
Actually I am not using normal arrays very often. Real C++ is a very
safe language if you have a good design. If I make a mistake I am
realizing it instantly. Things like memory leaks are not possible if
you follow some simple rules. (In had them more often in python than in
C++).

Nov 22 '06 #29

P: n/a

"Phlip" <ph******@yahoo.comwrote in message
news:va*****************@newssvr13.news.prodigy.co m...
Other languages provide that in their basic object model, without the need
for a whole new syntax superimposed on top of the existing system.
Now there's something interesting. Would you please expound a bit on that
and offer up the languages you had in mind?
And Java is not the "other languages" I have in mind. Java was invented to
take market share from C++ class libraries - such as MFC.
And I thought it was invented so that application programs could be
delivered
on demand via a web browser! Silly me.

Tony
Nov 22 '06 #30

P: n/a
Tony wrote:
Now there's something interesting. Would you please expound a bit on
that and offer up the languages you had in mind?
See my other post - use one method to pass arguments to functions, not two.
Some arguments are classes.
And I thought it was invented so that application programs could be
delivered
on demand via a web browser! Silly me.
That's the only reason it became popular and got notice. The reason everyone
tries to use it for "enterprise" stuff is the "management by magazine"
effect; defeating the specter of C++'s bugs.

And it doesn't seem dominant in the

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 23 '06 #31

P: n/a
gn wrote:
Yes, you are absolutely right if you say that the template concept
could be realized with a much easier synthax.
I mean an easier syntax can eliminate the need for the entire concept of
generics. If everything is an object, including classes, then you can pass a
class name into a function: foo(MyClass). Then you declare the function as
foo(klass), and to get an object you use MyClass.new(). This provides the
entire Prototype Pattern, built-into the language.

That's a little better than having two different systems to pass arguments
into functions: template<typename aClassint foo(Object & anObject).

That is redundancy and cruft. Why can't we just write int foo(typename
aClass, Object & anObject)?
But that kind of
programming can only be done by a language using a real compiler (the
thing with templates is to be generic without loosing speed --
therefore the costs of being generic are shifted to compile time). So I
would agree that a language providing these powers with an easier
synthax might be the language of the future.
We allow our compilers to have an easy time of optimizing because we
over-specify everything, so all static types resolve at compile time. Yet
this is nothing but coddling our compiler. A more powerful compiler wouldn't
need it, and 'template' may someday just get in the way, the same as
'register' just gets in the way now.
But the other languages discussed here were java and .net languages
which can principly not provide this feature.
That's because some people want to compare C++ to other languages and the
first thing they think of is Java and its derivatives. Java may be the
competition with respect to business, but it's not the competition with
respect to technology.
I am just interested -- do you have a special language in mind, that
also maybe a candidate for future standards?
Uh, Python, Ruby, and Smalltalk?

(I think Smalltalk is the language of the future, and it always will be!)
Actually I am not using normal arrays very often. Real C++ is a very
safe language if you have a good design. If I make a mistake I am
realizing it instantly. Things like memory leaks are not possible if
you follow some simple rules. (In had them more often in python than in
C++).
Right. But every programmers' boss you will ever meet has bad memories of
losing millions of dollars, and programmers blaming crufty C++ code that's
full of memory-corrupting bugs. That's where the Java marketing machine
starts. (And .NET is nothing but a clone.)

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 23 '06 #32

P: n/a
Phlip wrote:
gn wrote:
>Yes, you are absolutely right if you say that the template concept
could be realized with a much easier synthax.

I mean an easier syntax can eliminate the need for the entire concept of
generics. If everything is an object, including classes, then you can pass
a
class name into a function: foo(MyClass). Then you declare the function
as foo(klass), and to get an object you use MyClass.new(). This provides
the entire Prototype Pattern, built-into the language.

That's a little better than having two different systems to pass arguments
into functions: template<typename aClassint foo(Object & anObject).

That is redundancy and cruft. Why can't we just write int foo(typename
aClass, Object & anObject)?
I take it that you then have template-classes take a type object as a
parameter during construction?

How would you mimmick partial specialization?
Best

Kai-Uwe Bux
Nov 23 '06 #33

P: n/a
Kai-Uwe Bux wrote:
How would you mimmick partial specialization?
The point: You just don't need to.

Partial specialization fixes a symptom, not the root cause...

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 23 '06 #34

P: n/a
Phlip wrote:
Kai-Uwe Bux wrote:
>How would you mimmick partial specialization?

The point: You just don't need to.
I don't buy that.
Partial specialization fixes a symptom, not the root cause...
And in addition, it open new venues for programming.

Don't get me wrong. I have oftentimes missed being able to do

void f ( type A ) {
A a;
...
}

and I would welcome an extension of C++ in this direction (although
overloading the dot operator should have priority). However, such an
extension would be by and large unrelated to the C++ template mechanism and
by no means a substitute. There are areas where both methods could compete,
but not every use of templates is of that type.
Best

Kai-Uwe Bux

Nov 23 '06 #35

P: n/a
gn
Phlip schrieb:
gn wrote:
Yes, you are absolutely right if you say that the template concept
could be realized with a much easier synthax.

I mean an easier syntax can eliminate the need for the entire concept of
generics. If everything is an object, including classes, then you can pass a
class name into a function: foo(MyClass). Then you declare the function as
foo(klass), and to get an object you use MyClass.new(). This provides the
entire Prototype Pattern, built-into the language.
So far -- yes.
But again --- Each type of language may have a easy syntax providing
the ability to be generic, but the point is to be generic without
loosing speed and that is only possible with a compiler language not
with interpreters or just in time compilers. Of course there are
examples where templates are just used to compensate the insufficiency
of C++. First a popular example for that. For vectors a,b,c,d you may
write: a = b + c + d
The main reason why e.g. Fortran is faster on that than C++ (without
templates) is that Fortran is just summing up the vector components and
assigns them to a. In contrast C++ creates an object for c+d and then
adds the components of this temporary object to b leading to a new
temporary object whose components are assigned to a. Using templates it
is possible to get the same behavior for C++ as in Fortran and in fact
to get the same speed (there are publications on that). So this is as I
said an example where templates are used to cure insufficiencies of
C++, but thats not always the case. Also a simple example for that: In
my daily work I am often using a class for n-dimensional grids (with
variable size for each dimension), where I need several different
iterator-classes e.g. for iterating over a specific grid-shell. Of
course there are mathematical rules to calculate the step the iterator
must take from one grid-point to the next one depending on the number
of dimensions and the size of each dimension. But these values (the
step-size) are calculated at compile time giving an advantage in speed
that could not be realized by an interpreter. You can't build in
specializations for such specific tasks into a language.

I am just interested -- do you have a special language in mind, that
also maybe a candidate for future standards?

Uh, Python, Ruby, and Smalltalk?

(I think Smalltalk is the language of the future, and it always will be!)
Smalltalk is something I definitly have to try out (I never had a look
on a smalltalk program until now.).
But Python is something I am really used with (I have heard that they
solved the huge bugs in the garbage collection for version 2.5 -- is
this right?). But I encountered the frontiers of python very early that
forced me to switch to C++ (today I am very happy that I have
switched). I still think it's a nice language to do little tasks if you
have not much time. In fact it doesn't take a week to learn Python -
that's a feature. Of course for me it is now principly unsufficient,
because I am doing scientific programming and there speed matters. My
programs that I ported from Python to C++ are faster by a factor
between 160 and 220. So for me it's just a 2 days calculation what
needs one year in python.

Best regards,
gn

Nov 23 '06 #36

P: n/a
gn

Kai-Uwe Bux schrieb:
And in addition, it open new venues for programming.
I'd just like to say it again here. I think we are just at the
beginning to understand what is possible with the template concept.
"Modern C++ Design" broadened my horizon concerning this topic :)

Best regards,
gn

Nov 23 '06 #37

P: n/a

E. Robert Tisdale wrote:
>
The first big problem with Java and .NET is that
they are not publicly owned standards like C++.
The language definitions can (and do) change without notiece.
This usually isn't a problem because the typical application
written in Java (or the Microsoft equivalent) has a very short life.
Not necessarily.

And most applications written in C++ more than 5 years ago look very
dated. Especially anything written pre-1998.
A better question is, "What is the future of Java?"
Computer programming languages tend to become more complex
in order to deal with ever more complex applications.
Eventually, Java may be as complex as C++
and the advantages will disappear.
No I will tell you a problem I have had that is not a problem in Java.

I have an application that has to link with a 3rd party library, and
this 3rd party produces binaries for C++ in the form of shared object
libraries or DLLs. For Java they produce .jar files.

Now their .jar files work anywhere. The shared objects and DLLs do not,
so they have to build for each platform.

If that's not enough, their build for Solaris requires your own client
code to be compiled with the Sun Solaris compiler. Which is a problem
because it's non-standard - certain amounts of my code failed to
compile due to their disabling of template member functions in STL, a
major problem with std::pair's constructors for one thing. I had to
replace a (probably more efficient) vector.insert() with a std::copy
using back_inserter. (vector.insert is far more likely to optimise).

Then of course I need slightly different makefiles when we finally port
this to Linux where I will be using gnu compiler because that's the
standard there.

Even if everyone builds for GNU only (unlikely to happen) it still
means that you might have a problem keeping up with the versions.

Nov 23 '06 #38

P: n/a
Earl Purple wrote:
>
No I will tell you a problem I have had that is not a problem in
Java.

I have an application that has to link with a 3rd party library, and
this 3rd party produces binaries for C++ in the form of shared
object libraries or DLLs. For Java they produce .jar files.

Now their .jar files work anywhere. The shared objects and DLLs do
not, so they have to build for each platform.

If that's not enough, their build for Solaris requires your own
client code to be compiled with the Sun Solaris compiler. Which is
a problem because it's non-standard - certain amounts of my code
failed to compile due to their disabling of template member
functions in STL, a major problem with std::pair's constructors for
one thing. I had to replace a (probably more efficient)
vector.insert() with a std::copy using back_inserter.
(vector.insert is far more likely to optimise).
So you are telling us that Sun's Java works better than Sun's C++? :-)

And that that is a language problem?
Bo Persson
Nov 23 '06 #39

P: n/a

Bo Persson wrote:
>
So you are telling us that Sun's Java works better than Sun's C++? :-)

And that that is a language problem?
So you're suggesting that Solaris are refusing to change their C++ to
be compliant by default to push more people into Java? Wouldn't put it
past them.

It's the issue that library vendors only need to make one build of a
..jar and it runs anywhere that has a VM.

Anyway, where I work, which is actually a fairly big company that
you've probably heard of, most of the development has switched from C++
to Java over the last few years, particularly servers, and with the
issues I have had I can clearly see why.

Nov 23 '06 #40

P: n/a

"gn" <gn******@web.dewrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
>
Kai-Uwe Bux schrieb:
>And in addition, it open new venues for programming.

I'd just like to say it again here. I think we are just at the
beginning to understand what is possible with the template concept.
I hope not. Sigh.

Yes, I believe templates are overused and cause a lot of "bad" programming.
Because, very few people know how to use templates judiciously and
sparingly. I guess that's because the STIL isn't very good at teaching good
template usage. Many view it as a mechanism as common as the 'for loop'.
I wouldn't teach anyone templates until they've programmed a few years.
(Just a tad facetious to make the point in that last sentence).

Tony
Nov 23 '06 #41

P: n/a

"Phlip" <ph******@yahoo.comwrote in message
news:K2*****************@newssvr14.news.prodigy.co m...
gn wrote:
>Yes, you are absolutely right if you say that the template concept
could be realized with a much easier synthax.

I mean an easier syntax can eliminate the need for the entire concept of
generics. If everything is an object, including classes, then you can pass
a class name into a function: foo(MyClass). Then you declare the function
as foo(klass), and to get an object you use MyClass.new(). This provides
the entire Prototype Pattern, built-into the language.
Better to keep the syntax as ugly as possible to disuade usage of it as much
as
possible (IMO).

Tony
Nov 23 '06 #42

P: n/a
gn
Earl Purple schrieb:
No I will tell you a problem I have had that is not a problem in Java.

I have an application that has to link with a 3rd party library, and
this 3rd party produces binaries for C++ in the form of shared object
libraries or DLLs. For Java they produce .jar files.

Now their .jar files work anywhere. The shared objects and DLLs do not,
so they have to build for each platform.

If that's not enough, their build for Solaris requires your own client
code ...

Even if everyone builds for GNU only (unlikely to happen) it still
means that you might have a problem keeping up with the versions.
Well - The problem here is that there is one java against many
different C++ compilers. Normally one should think that if you are
programming C++ conform to the standard (and of course capsulating (I
still don't know the right word here in english) system functions) your
programs should compile at every platform where you have a C++
compiler. In reality thats not the case because many compilers are not
conform with the standard, especially concerning templates.
Additionally people who are using things like visual C++ or Borland C++
Builder are often not aware of using non standard libraries. You are
also right with the different GNU versions where I had some problems
with my template syntax.
But all this is not a problem of C++, but of the compiler developers
(let's see what the next standard brings and how fast they are in
implementing it to all compilers). There are also many other things
that I am missing in current compilers (e.g. return value optimization
for recursive functions). I really think that C++ will become much
faster in the future because there are many such things to optimize
that is to complicated for todays compilers.

In the end everything depends on the specific tasks. For my field of
work (computational chemistry) it's simply no question to use anythingh
else than C++ or Fortran, because those quantum chemical calculations
are still to slow even on huge clusters and even for small molecules. I
also think for bigger projects in the software companies it should be
no problem to have C++ and java programmers working on the same
project. It's no problem if you have a good design.

Best regards,
gn

Nov 23 '06 #43

P: n/a
gn

Tony schrieb:
"gn" <gn******@web.dewrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...

Kai-Uwe Bux schrieb:
And in addition, it open new venues for programming.
I'd just like to say it again here. I think we are just at the
beginning to understand what is possible with the template concept.

I hope not. Sigh.

Yes, I believe templates are overused and cause a lot of "bad" programming.
Because, very few people know how to use templates judiciously and
sparingly. I guess that's because the STIL isn't very good at teaching good
template usage. Many view it as a mechanism as common as the 'for loop'.
I wouldn't teach anyone templates until they've programmed a few years.
(Just a tad facetious to make the point in that last sentence).
Ok - perhaps I don't have the right to talk about this because I'm
definitly no expert on programming and relativly new to C++. But in my
projects the template part is perhaps 0.5%. I'm only using them for
speed critical parts as libraries for matrix calculations and for those
parts I'm spending much more time than for other parts in planning and
implementing it, to be sure that it really works in an optimal way. So
I really don't think I'm overusing this concept. Of course, if you also
count the usage of the STL then I am overusing it.

Best regards,
gn

Nov 23 '06 #44

P: n/a
Actually the C library we have to link against has no such issues. We
can link against that with any C++ code we like. If they provided a C++
wrapper it would mean we didn't have to write our own but at least we
didn't have the same issues.

One solution would be a standard C++ runtime library (per machine), so
that vendors can write C++ libraries which would simply link against
the standard C++ runtime library installed on the system, the same way
that C code links against the native C runtime library.

On UNIX machines this should include any POSIX extensions (which were
often in the headers like <time.hand are now in <ctime>).

Standard name-mangling (per platform) would also help.

Nov 24 '06 #45

P: n/a

Kai-Uwe Bux skrev:
[snip]
Don't get me wrong. I have oftentimes missed being able to do

void f ( type A ) {
A a;
...
}

and I would welcome an extension of C++ in this direction
Am I the only one failing to see whats wrong with

template<typename A>
void f() {
A a;
...
}

What problems does the above function have which your solution solves?

/Peter

Nov 24 '06 #46

P: n/a
gn
peter koch schrieb:
Kai-Uwe Bux skrev:
[snip]
Don't get me wrong. I have oftentimes missed being able to do

void f ( type A ) {
A a;
...
}

and I would welcome an extension of C++ in this direction

Am I the only one failing to see whats wrong with

template<typename A>
void f() {
A a;
...
}

What problems does the above function have which your solution solves?
There is no problem with the above function!
But for constructs like:

template<template<class foo1class foo2>
class foo3 : public foo2<inst1>
{...};

and more complicated expressions I'd really like to have a more
readable syntax. In fact I have no good idea how to simplify this in
the best way.

Best regards,
gn

Nov 24 '06 #47

P: n/a
Tony wrote:
Yes, I believe templates are overused and cause a lot of "bad" programming.
Because, very few people know how to use templates judiciously and
sparingly. I guess that's because the STIL isn't very good at teaching good
template usage. Many view it as a mechanism as common as the 'for loop'.
I wouldn't teach anyone templates until they've programmed a few years.
(Just a tad facetious to make the point in that last sentence).

Tony
I believe that developers are using templates too few.

The book I suggest to C++ beginners is Accelerated C++. I didn't
actually read it because by the time I found out about it I didn't need
it anymore. But I had a quick look through it to evaluate whether it's
good for my less experienced [ex]colleagues. And I think that Bob
Langelaan could use it to improve the course too, following the
suggestion of Alf P. Steinbach to start with standard library classes.

One of the more remarkable facts about the book is that template
functions are introduced in chapter 8 while classes are left for the
chapter 9. I think it's not because they are more important than
classes, but rather because they are easier to learn and they can
simplify your code.

In your OOP orientation you fail to see that you often need helper
functions to simplify the code and improve its readability. Otherwise
you end up with the classic spaghetti code. If these functions do not
use the object's data, making them private member functions seems
wrong to me as this exposes the class's implementation details to the
user of the class and introduces unwanted dependencies. (And the Pimpl
idiom is not suitable for all situations.)

Template functions have the additional advantage of avoiding the
copy-paste bugs and reducing the amount of code in general.
Less code means less opportunities to make bugs, doesn't it?
And template classes are even better in this regard, you don't
need to rewrite std::vector for each type you use it with. And
that's just the beginning.

Bluntly put, if you avoid using templates, you avoid one of the best
features of C++. You can work around that to some degree using
inheritance and virtual function overriding, but this introduces
unwanted dependencies, some (usually unimportant) performance
hit and you also lose some advantages of the static typing in the
process.

Regards,
Vladimir Marko

Nov 25 '06 #48

P: n/a
Earl Purple wrote:
Bo Persson wrote:
>>
So you are telling us that Sun's Java works better than Sun's C++?
:-)

And that that is a language problem?

So you're suggesting that Solaris are refusing to change their C++
to be compliant by default to push more people into Java? Wouldn't
put it past them.
I suggest that Sun puts a lot more effort into their Java implementation
than into their C++.

At the same time, they seem to have to resort to using an amazing amount of
C++ code in their HotSpot VM.

https://openjdk.dev.java.net/

Wonder why? How do they manage to port that to new machines?
Bo Persson
Nov 25 '06 #49

P: n/a

blangela wrote:
I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years.
I think it is important to note that because a C++ course is becoming
smaller in Vancouver, Canada does not mean that the C++ language as a
whole is dying. Who knows, it could be that the University has less
students as a whole. Also, this is an introductory course so people
may be taking other languages to start out and then moving up to C++
later.

Nov 26 '06 #50

190 Replies

This discussion thread is closed

Replies have been disabled for this discussion.