The Future of C++ ?

N

Noah Roberts

Greg said:
There is no question that programming in C++ requires above average
intelligence. What is very much open to question, however, is whether
that intelligence is needed for programming per se, or whether the
additional intelligence is needed solely to master the complexities of
C++ itself.

What exactly is so damn tough and complex about C++?? Unless you're
writing a parser for it I just don't see the problem.
 
P

Phlip

Actually, I got impression that you suggest that you can build true GC
a library solution for C++. I argue that you cannot (at least not
without special C++ compiler, but that would be equal to adding GC to
language definition).

You can build many quasi-GC systems in C++ (for C++), such as smart
reference-counting pointers. You can also build a few "true" GCs, meaning
"transparent, and operating directly on raw C++ pointers".

You cannot build every conceivable kind of true GC in C++.

The distinction is Java exposes less plumbing, while C++ makes some exposed
plumbing harder to cover-up.
 
N

Noah Roberts

Earl said:
A better analogy would be between building a car in Java or building
one in C++.

In Java, you would get all the components and put them together,
including the wheels.

In C++ though there is no standard for a wheel because there are some
vehicles, i.e .boats, don't have wheels so there is no need for a
standard. So you have to "reinvent the wheel" or fit one from a 3rd
party manufacturer,

Just like you do for a car.

the only problem with that being that getting their
wheels to fit your vehicle is not always an simple matter, at least not
as straightforward as it is to fitting a standard one, because the
diagnostics of the wheels are such that they have side effects on the
rest of the manufacture of your car.

Actually, wheels are very standardized for various independent and
*incompatible* requirements and always made by third parties. Car
manufacturers buy their wheels and tires from some other source, that
sells cars and/or tires made for automobiles and not for wheelbarrows
or boat trailers (and certainly don't try to be "all of the above"),
and that source is not the same as the people that made the injector
components or the brain.

If we used your analogy it would be more akin to using Java you would
buy all the parts to your new car from the same person. This person
would specify not only the standards to your parts at a whim all their
own that you have to live with, they would also specify, and enforce
every detail of their use and limit your car's design even to the point
of the count of threads on each and every bolt (even for those parts
you did design and manufacturer yourself). In the end, by the time you
where done fighting with the people you bought your wheel from (and
every other part in your car), and ending up with a design totally
different than what you originally intended so that now it's this gas
guzzling monolith with 100's of reduntant but technically flashy
components, you could have designed, manufactured, and sold 10
independent car designs using the modular setup provided by using
several independent third parties using parts you need that are
designed specifically for your needs and not those of some acedemic
designer who has only ever worked on cars on paper that also has to
account for boat trailers, wheelbarrows, bicycles, and every other damn
thing that might have a wheel.
 
B

blangela

Alf said:
* Earl Purple:

Except -- for robots specialized control languages are better than
C++. And in the embedded world one uses restricted dialects of C++ that
aren't really C++. For example, when you remove exceptions from the
language you also remove the whole point of constructors, and what's
left isn't much more than a simple syntactical device (writing p->foo()
rather than p->vt->foo( p ) or CALL( p, foo, () )).

A little off topic here, but I just recently was introduced to a
product called LabView. It provides for a graphical form of
programming. Every program has 2 windows. One window shows the GUI
components which you can drag and size at will. The other window shows
a "flowchart like" or "circuit like" description of the program logic (
a while loop for example, is depicted by a rectangular shape, with
every program step in the loop depicted by a "component"). If you add
a graphical component to the "circuit like" window, it shows up
automatically in the GUI window.

This LabView product has been evolving for many years (20+ perhaps?)
and has just recently (version 8.2 I think) added the ability to create
classes and other OOP constructs. It might actually be a good tool for
introducing programming, becuase of it's graphical nature (easier for
students to picture the logic of a program.). I also found out that
the Lego Mindstorms products (a form of robotic toy that users can
program) uses a version of LabView to program the robots. I suspect it
may not include the version of LabView that supports a form of OOP,
since this is a very recent release. The reference to robotic
programming above brought this to mind.
 
N

Noah Roberts

blangela said:
I agree with you on this point. I know of a Java instructor at my
school who feels it is a waste of time to teach students data
structures or sorting algorthms -- Java provides different container
classes and sorting algorthms to select from, so why should the student
need to learn these topics. I disagree. I feel that there is still
room for the "science" in "computer science".

Well, teaching students how to implement ADT's isn't exactly the
"science" in computer science unless at the same time they analyze each
algorithm's speed and space requirements. Most data structures courses
I have seen don't spend much time on this later aspect and simply skim
over O() notation and spend the rest of the time implementing sort and
search methods on lists and binary trees.

Really, the science part of computer science is rarely used in the
workplace. There is almost no real world situations when you need to
use finite automita for instance but I know of no CS degree that
doesn't have a course, at least, on this kind of thing alone. Most of
these "science" parts have to be looked up every time you need them
because they simply aren't used enough to recall in detail. On the ADT
end, once you have programming techniques in general down it is really
quite trivial to implement a linked list, for example, so spending as
much time on implementing them at college might be time better spent
learning to use them well...something you actually can use.

Really, implementing a tree or list...once you've done it once that's
probably the last time you will. Maybe if you work in C you'll
implement an ADT once every 5 years or something but most other places
have them already and there's simply no need to. Knowing how they are
sometimes implemented is a good thing but I don't think it's the end of
the world if you don't learn it at school.

In all honesty, the best thing to come out of courses that implement
data structures from scratch is general programming and problem solving
skills. If the teacher feels that can be better taught using other
aids then it's rather hard to argue with that.
 
G

gn

Noah said:
No. Programming requires a certain thinking type, that is all. There
are plenty of brilliant people out there that can't program and will
never be able to program beyond the very basics.

Actually, for the less bright among us there's language bigotry.

Java programmers are not stupid. If you want to call people stupid you
should have a look at people that purposfully use the least productive
and secure components of a language when not necissary. Those that do
not make use of the tools at their disposal to make themselves more
productive and better programmers.


Well - you're right. Perhaps the best post until now. As I said in my
posts before I prefer C++, but I also think that it depends on the
specific task and at least on the specific preferences of each
programmer! I think a real programmer is generally no stupid person.

Let's have a look on what is learning to program:
1.) You need to learn the syntax and semantics of a specific language
2.) You need to learn thinking like a programmer: conceive a problem /
reduce it to it's basics / develop solutions and translate them to a
good (today mostly object oriented) design / ...

The first point is the easy part, the second is what seperates a high
level programmer from a
I-programmed-my-own-little-game-hobby-programmer.
So if the distribution of the total programming skill is
1.) 5% and 2.) 95% for java it may be
2.) 7% and 2.) 93% for C++

But you will never be good at point 2 if you don't know anything about
the underlying mechanisms of a language. Also for people programming in
higher languages it is therefore also useful to learn a "low-level"
language (that must not be C or C++). For example I have seen many
errors in python programs of people who started with that language
because they just did not realize the concept of having only references
(the typical beginners errors because they don't know when and why
references are copy on write and when not...).

Best regards,
gn
 
N

Noah Roberts

gn said:
Let's have a look on what is learning to program:
1.) You need to learn the syntax and semantics of a specific language
2.) You need to learn thinking like a programmer: conceive a problem /
reduce it to it's basics / develop solutions and translate them to a
good (today mostly object oriented) design / ...

The first point is the easy part, the second is what seperates a high
level programmer from a
I-programmed-my-own-little-game-hobby-programmer.
So if the distribution of the total programming skill is
1.) 5% and 2.) 95% for java it may be
2.) 7% and 2.) 93% for C++

I'm not sure what these invented statistics are supposed to even mean
but whatever. Really, someone good at 2 can work on anything in any
language. Everyone has their preferences but a programmer that is only
able to work in their prefered language isn't very good.
 
A

Alf P. Steinbach

* Earl Purple:
So you are admitting that C++ is effectively dying as an application
programming language but will probably remain for the low-level systems
program for a non-embedded platform.

No, I'm speculating. Of course those speculations aren't worth more
than you've paid for them... On the other hand, speculating again, yes,
that's about the way I see it.

We have a little window right now where introductory languages like
Javascript are in practice too limited, so that there's no Real Easy
path into programming, and C and C++ score points on that (no big
problem being complex when it's all complex no matter the path). E.g.
no common script host environment provides decent graphics capability,
while in the old days any decent Basic except perhaps Bill Gates' own
version would give you graphics capability, and that was the first the
young programmer was exposed to. And languages especially geared
towards learning, like Logo and Alice, while providing simple graphics,
are just too limited in other ways, they're not "real" languages.

However, that's changing fast, with the serious functionality migrating
upwards to simpler languages. Then there will be very few reasons for a
student to dip into C or C++, because almost whatever one wants to do,
there will then be a much easier path. And so very few programmers will
know anything more about C++ than that its syntax is curly braces, and
that it's associated with some vague notion of very complex dark magic.
 
T

Tony

kwikius said:
I don't and more to the point beginners to the language don't or rather
won't. They will and do already use another language where those
libraries are available. Supermarkets are more successful than
specialists. Why, because people havent got the time to go around all
the specialist shops individually. Most things people want in a
supermarket are similar and 'good enough', and there is nothing
stopping them going to a speciailist if they wish. Further in the
supermarket everything is compatible "generic" (e.g barcodes), feedback
on one product can be used for others. cross fertilisation occurs
formally and informally The supermarket is also a meeting place for
people who want different products, so you can usually get advice from
someone in there as to whether some product is good or not.

Go ask in the specialist shop and their particular product is bound to
be marvellous of course.

I consider having a choice of many an asset, but agree that most people
are cognitively lazy.

Tony
 
T

Tony

Earl Purple said:
I would. Collections would be one of the first subjects I would teach.

One of the least important features of C++ is cin. I do not have a
single cin in any of my C++ production code. Yet it seems to be the
first thing programmers seem to learn.


Surely paradigms though must include handling collections.

A good way for students to learn would be to create some of their
own containers. That would lead naturally to templates. I wouldn't
consider "containers" a paradigm like template programming is.

Tony
 
T

Tony

kwikius said:
"Standard". GUI, graphics, dlls, IPC, concurrency.

OK, so you just want them to be standard. That assumes that the proprietary
vendors would give up control of those things though. I can't imagine MS
giving up its cash cow by adhering to a standard GUI API.

Tony
 
T

Tony

For example, when you remove exceptions from the language you also remove
the whole point of constructors, and what's left isn't much more than a
simple syntactical device (writing p->foo() rather than p->vt->foo( p ) or
CALL( p, foo, () )).

That doesn't sound correct at all. Constructor + copy constructor +
destructor
+ assignment operator allow creation of objects that act like built-in
types.
Exceptions just solve the problem of how to handle errors in those
functions.
Constructors weren't created as a result of exception handling, EH was
created as a result of constructors.

Tony
 
S

Steven T. Hatton

Noah said:
Really, the science part of computer science is rarely used in the
workplace. There is almost no real world situations when you need to
use finite automita for instance but I know of no CS degree that
doesn't have a course, at least, on this kind of thing alone.

I think the idea is to teach us to think in terms of state transitions.
Whether we recall the vocabulary and diagram techniques immediately, or
not, we should have integrated the approach into our thinking.
Most of
these "science" parts have to be looked up every time you need them
because they simply aren't used enough to recall in detail. On the ADT
end, once you have programming techniques in general down it is really
quite trivial to implement a linked list, for example, so spending as
much time on implementing them at college might be time better spent
learning to use them well...something you actually can use.

It really depends on what you are trying to design. It's unlikely I will
write a linked list any time soon, however,
Really, implementing a tree or list...

I am currently writing code that implements a tree in order to solve a
real-world problem.
once you've done it once that's
probably the last time you will. Maybe if you work in C you'll
implement an ADT once every 5 years or something but most other places
have them already and there's simply no need to. Knowing how they are
sometimes implemented is a good thing but I don't think it's the end of
the world if you don't learn it at school.

I believe you are using the term ADT the way I learned it in college, which
is not the way it is typically used among C++ language officionatos. The
use of ADT I learned in school has to do with linked lists and binary
trees. To Stroustrup, Koening and the gang, ADT means an interface
that 'looks like' it has/is data.
In all honesty, the best thing to come out of courses that implement
data structures from scratch is general programming and problem solving
skills. If the teacher feels that can be better taught using other
aids then it's rather hard to argue with that.

It really depends on what you are trying to accomplish. I often find myself
struggling with ways of structuring and representing data.
 
C

Chris Thomasson

Kai-Uwe Bux said:
Chris said:
Course in Java: [...]
And we can process concurrently...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Java memory model is so damn strict that it makes it impossible to create
any high-end synchronization algorithms. Period. But then, does the
average Java programmer even know this fact? I bet 99% do not. Simple
example of how learning Java first can, and will, burn you:
C++ teacher: Now we are going to learn about variable length arrays. C++
has
for instance the deque<> template, you see ...

Student: How does C++ actually implement that template?

C++ teacher: That is implementation defined according to the standard. All
I
can tell you for sure are the following guaranteed complexity bounds...

That teacher is crap. Give me a break. A good C++ teacher should make his
students create a vector class from scratch. Heck, the instructor can teach
his students how to implement a vector that meets the C++ Standard. The
instructor can teach the student how to create a memory allocator that meets
the C++ standard to plug into the standard vector the student will be
creating.

The classroom can define a namespace:

myclass_std

And the course would be about actually implementing Standard C++. Then the
students can implement Standard vector, and Standard queue, and use them in
further applications.


Any thoughts on this approach?


Student: I hear the C++ Standard has a nice vector template?

Teacher: Well, yes it does. And you will learn exactly how to create a
Standard C++ vector template from scratch. This class will teach you how to
implement useful parts of the C++ Standard. The class uses the namespace
myclass_std for the minimalist Standard C++ template library you will be
creating.



Sound good to me, no?
 
C

Chris Thomasson

Earl Purple said:
Of course it is. C++ beat all the other OO languages of its generation
because it supported all the company's existing C source. Read
Stroustrup's pages about the history of the language.


And then you'd need to learn assembly too plus deep amounts of
electronics to know how all the hardware works.

What if, however, you are the typical student for whom university is
really only the unfortunately necessary and costly step between school
and getting a job, and that your primary aim of university is to be
trained to get a job afterwards, especially since you'll probably have
a big loan to pay off.

Well, highly skilled C/C++ systems programmers get paid more?



And it's the "private standard" that has allowed them to advance Java
to where it is,
introducing generics (really templates) in the latest
standard, plus the equivalent of a foreach which looks a lot cleaner

I don't care about using normal for. I am a C programmer at heart. No
problems here.
 
C

Chris Thomasson

Chris Thomasson said:
Kai-Uwe Bux said:
Chris said:
Course in Java: [...]

And we can process concurrently...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Java memory model is so damn strict that it makes it impossible to
create
any high-end synchronization algorithms. Period. But then, does the
average Java programmer even know this fact? I bet 99% do not. Simple
example of how learning Java first can, and will, burn you:
C++ teacher: Now we are going to learn about variable length arrays. C++
has
for instance the deque<> template, you see ...

Student: How does C++ actually implement that template?

C++ teacher: That is implementation defined according to the standard.
All I
can tell you for sure are the following guaranteed complexity bounds...

That teacher is crap. Give me a break. A good C++ teacher should make his
students create a vector class from scratch. Heck, the instructor can
teach his students how to implement a vector that meets the C++ Standard.
The instructor can teach the student how to create a memory allocator that
meets the C++ standard to plug into the standard vector the student will
be creating.

The classroom can define a namespace:

myclass_std

And the course would be about actually implementing Standard C++. Then the
students can implement Standard vector, and Standard queue, and use them
in further applications.


Any thoughts on this approach?


Student: I hear the C++ Standard has a nice vector template?

Teacher: Well, yes it does. And you will learn exactly how to create a
Standard C++ vector template from scratch. This class will teach you how
to implement useful parts of the C++ Standard. The class uses the
namespace myclass_std for the minimalist Standard C++ template library you
will be creating.



Sound good to me, no?

That might be a good name for a book...


"Implementing Standard C++"
 
S

Steven T. Hatton

blangela said:
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++.

C++ has one major flaw. #
 
A

Alf P. Steinbach

* Tony:
That doesn't sound correct at all.

I'll try to explain, then.

The purpose of a constructor in C++ is to couple allocation and
initialization in one all-or-nothing operation, a transaction.

After a constructor call you either have an initialized object at hand,
or an exception.

In the case of an exception, if the constructor was invoked via new, the
allocated memory has been automatically deallocated: construction is an
all-or-nothing operation, either allocation+initialization, or nothing.

If you remove exceptions, first of all the all-or-nothing functionality
is removed -- you can and will then have improperly initialized
objects accessible -- which defeats the very purpose of constructors.

Second, to be able to handle initialization failure dialects such as
Symbian C++ require the programmer to use two-phase construction where
the "C++" constructor is just a dummy, with an initialization member
function called afterwards by the client code. And with that technique
not only is the purpose of the constructor defeated, but the constructor
has become just a hindrance that must be overcome by some alternative
initialization scheme. Constructors then just add complexity, no gain.

Consider if, in such a thwarted dialect of "C++", a class Base
constructor fails when called automatically from a class Derived
constructor. Perhaps class Derived has some members of type Mambo. To
signal its failure the Base constructor sets the boolean member
'okSoFar' to false. But since that's a scheme the compiler knows
nothing about, the Mambo members are now automatically constructed,
perhaps causing some side-effects such as windows popping up. Now the
Derived constructor's body is executed and it detectes the failed Base
construction, and must communicate that to the client code, somehow...

Constructor + copy constructor +
destructor
+ assignment operator allow creation of objects that act like built-in
types.

Sort of.

Without exceptions you're limited to types where initialization can't
fail, and/or treating all failures as fatal errors, and/or using the
language in a way ignoring constructors.

This was useful enough that C++ enjoyed a fair degree of success without
exceptions, up till the late 1980's, as a "better C", but the section on
error handling in the first edition of TCPPPL tellingly lists the then
current alternatives and finds fault with them all for ordinary function
calls, without even discussing how to handle failure in constructors.

Exceptions just solve the problem of how to handle errors in those
functions.

No, that problem is not a problem that can be solved by other known means.

Constructors weren't created as a result of exception handling, EH was
created as a result of constructors.

No, that's incorrect. Exceptions were adopted late in the
standardization process, that's true. But first, they weren't invented
to support constructors, nor vice versa, and second, they weren't
invented in C++. Experience with exceptions had been gained from Ada
and other languages, as well as at a low level in e.g. Windows NT. They
fitted the requirements of constructors, and no other scheme did.
 
N

Noah Roberts

Steven said:
I believe you are using the term ADT the way I learned it in college, which
is not the way it is typically used among C++ language officionatos. The
use of ADT I learned in school has to do with linked lists and binary
trees. To Stroustrup, Koening and the gang, ADT means an interface
that 'looks like' it has/is data.

Abstract Data Type. Any data type that can contain, and work with,
generic data. That is the definition used in both cases.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top