 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Francis Glassborow Guest
|
Posted: Mon Aug 16, 2004 2:47 pm Post subject: How is C++ different? |
|
|
I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this :-)
In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
You will get full acknowledgement for any contribution I use.
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Mon Aug 16, 2004 7:54 pm Post subject: Re: How is C++ different? |
|
|
Francis Glassborow wrote:
| Quote: | I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this :-)
In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
|
C++ was my first OO language. When I learned C++, I knew Fortran, C,
Assembly for a couple of processors, PL/I, BASIC, a bit of Prolog. The
main "shock" was to basically undergo that "paradigm shift" known to
accompany switching between procedural approach and OO approach. I do
not remember actually reading something like "from now on you will think
differently" but that's what C++ did for me. Essentially, I discovered
OO through learning the syntax of C++ and reading the examples given.
I can't say I remember any difficulties. Perhaps it's because too much
time has passed since my first foray into C++, perhaps because there were
very few of them. I was a C programmer, going to C++ was basically quite
natural then (not that it has to be for every C programmer, don't get me
wrong).
Another reason why there probably were very few difficulties is that I
did not attempt to grasp the entire language at once. In fact, IIRC, the
first programs I wrote didn't have much of OO. C++ was just a "better C"
to me then. Well, I might have written a class or two, but that was the
extend of it. Overloading operators, templates, came later and more like
an evolution of my knowledge of C++ (however small it was) rather than
a dramatic change. I had the luxury to "take it slow".
Best of luck with your book!
Victor
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Ali Cehreli Guest
|
Posted: Mon Aug 16, 2004 8:05 pm Post subject: Re: How is C++ different? |
|
|
On Mon, 16 Aug 2004 07:47:36 -0700, Francis Glassborow wrote:
| Quote: | I would be interested in contributions from people who
have learnt C++ as a second language.
|
My first language was C, but I think I was at most an intermediate level
programmer in C when I started learning C++.
| Quote: | what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
|
RAII and exception safety:
For me, the single biggest item in switching to thinking in C++ was
realizing that RAII is not just a good thing, but a must in C++. For
some reason, years of following the newsgroups was not enough for me to
realize the importance of that idiom.
I woke up from my ignorance after reading the exception safety section
in Exceptional C++ by Herb Sutter.
Of course RAII (and probably even following the guidelines for exception
safety) is not very difficult to grasp, but is very important for the
learner to understand early on.
Reading:
I am not sure how C++ is different from other languages in this, but
it's not a language to master on one's own. The learner is on a long
journey full of reading articles, books, and newsgroups. I don't think
the reading has an end. :)
No assumptions please:
C++ is probably more different than C as one might think. Related to the
item above, the learner must not make assumptions but read. For example,
one of the fundamental expressions in C++ is not known by far too many
programmers because they assume that if 'malloc' may return NULL, 'new'
might too.
[Before anyone objects, I know that the behavior of new was different in
the past, but I've seen this mistake in fresh C++ code written by new
C++ programmers. And I am not talking about 'new' alone here, but
'writing under assumptions' in general.]
Ali
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Peter Koch Larsen Guest
|
Posted: Mon Aug 16, 2004 8:07 pm Post subject: Re: How is C++ different? |
|
|
"Francis Glassborow" <francis (AT) robinton (DOT) demon.co.uk> skrev i en meddelelse
news:XBaK+1DkmHIBFwM1 (AT) robinton (DOT) demon.co.uk...
| Quote: |
I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this :-)
In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
You will get full acknowledgement for any contribution I use.
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions:
http://www.spellen.org/youcandoit/projects |
Hello Francis
My background is roughly Algol => Pascal => C => C++ (Algol only
"academic"), so I doubt I will be very representative here. I have had very
good mentors so I have not had any serious difficulty understanding the
language per se, but i remember in particular my initial reluctance to place
variables where they are used instead of at the beginning of a function. My
biggest revelation was RTTI which (with templates) is the most important
feature of C++.
Kind regards
Peter
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Maciej Sobczak Guest
|
Posted: Mon Aug 16, 2004 8:07 pm Post subject: Re: How is C++ different? |
|
|
Hi,
Francis Glassborow wrote:
| Quote: | I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this
|
Tons of them. :)
| Quote: | In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
|
I've learnt C++ as my n-th language (having some previous BASIC, C and
Pascal experience).
One of the things that I appreciate most is the ability to (ab)use the
operator overloading and templates in order to "bend" the language to
the extent that it becomes a separate dialect for performing specific
tasks. In other words, the ability to create domain-specific sublanguages.
It caused me some difficulty in the sense that it was not visible at the
beginning, when I was learning the language.
Let me explain this issue.
The obligatory line:
cout << "Hello, World!" << endl;
was taken (at the beginning) as a *way* of doing I/O in C++. OK, I knew
how to print things in other languages, this one looks different, but
still easy enough to remember. Beginners would even use this "look &
feel" to distinguish one language from another. You look at the code,
and you immediately know what language it is.
It took me some time of active language use to discover, that the above
code is not a "C++ way". It is a dialect. One of many possible,
incidentally most popular. I realised then that in languages I knew
before, all programs are similar. There may be different libraries that
provide similar functionality, but the *way* of doing things is always
the same: you call functions in C (and no matter who wrote a library,
you can only call its functions), you use classes and call their methods
in Java (and no matter who wrote a library, you only call methods of
some classes), you call procedures in Pascal (and no matter who wrote
the library...), and so on. The thing that is different with C++ is that
the *way* to do things highly depends (thanks to operator overloading
and templates) on the creativity of the library designer. As a result,
two C++ programs can be much more different (by "look & feel") than in
other languages. Moreover, I'd risk to claim that the two C++ "dialects"
can have more perceptual differences than there are between whole
languages (say, Java and C#).
One of the flagship examples (and my favourite in any debate including
proponents of other mainstream languages) is the Boost.Spirit library.
It is syntax-oriented to the extent that it becomes a separate C++
dialect. In other languages, a library for making parsers would have the
same "look & feel" as the library for I/O, or whatever else. Just
functions all over the place. Or just classes and methods, all over the
place. In C++, the way of using a library is part of its design, which
therefore extends far beyond picking function or class names.
To summarize: C++ is different, because it can be *customized*.
Of course, the above may be taken as a disadvantage, especially from the
point of view of the beginners. In the long run, however, I find it to
be one of the most powerful features that puts C++ high above others.
(slightly off-topic: as a scripting language, I apreciate Tcl for the
same reason - it allows me to redefine its commands or define new ones
to the extent that it is possible to provide complete paradigms, not
only dialects; the example is the library providing generic
object-oriented features)
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Terje Slettebų Guest
|
Posted: Tue Aug 17, 2004 10:00 am Post subject: Re: How is C++ different? |
|
|
"Peter Koch Larsen" <pklspam (AT) mailme (DOT) dk> wrote
| Quote: |
My
biggest revelation was RTTI which (with templates) is the most important
feature of C++.
|
Why do you think that RTTI is one of the most important features of C++? Are
you perhaps instead referring to C++'s support for OO (classes, inheritance,
virtual functions, etc.)? RTTI (Run-Time Type Information) usually means the
facilities for querying type information at runtime, such as using typeid().
Regards,
Terje
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
kwikius Guest
|
Posted: Tue Aug 17, 2004 10:02 am Post subject: Re: How is C++ different? |
|
|
Francis Glassborow <francis (AT) robinton (DOT) demon.co.uk> wrote
| Quote: | I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this :-)
In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
|
I moved onto MSVC1.0 from QuickC both Microsoft.
I remember the weirdest thing was the :: operator.
It appeared all over the place, and this was before namespaces.
I didnt understand what it did at all for a long time.
There wasnt (isnt? ) anything like it in C.
regards
Andy Little
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Thomas Hansen Guest
|
Posted: Tue Aug 17, 2004 6:54 pm Post subject: Re: How is C++ different? |
|
|
Francis Glassborow <francis (AT) robinton (DOT) demon.co.uk> wrote
| Quote: | I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this :-)
In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
You will get full acknowledgement for any contribution I use.
|
Probably many readers of your book will come from either the Java
camp, VB6.0 camp or .Net camp.
Therefor I think that what you should stress as one of the biggest
differences is that you have to take care of memory yourself and
therefor maybe stress the RAII parts of the language.
BUT I think that C++ biggest difference is that it supports so many
different paradigms and ways to solve the same problem.
Write out a "teaser" containing 15 different ways of solving the
"Hello World" application. (to demonstrate how rich C++ is)
One with a stream taking a string, another with a stream taking an
object with an implicit conversion to a std::string another taking an
object with a friend global stream operator etc...
And maybe take in this one (which is really weird for all NON C++
coders since it turns the inheritence tree upside down and gives
possibilities not even thought of by even most C++ coders):
class X
{
};
template<class T>
class Y : public T
{
};
int main()
{
Y<X> myY;
}
I think the main difference between C++ and (most) other languages is
not one single feature but rather the richness of the language and the
many different ways you have of expressing yourself in C++...
Thomas Hansen
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Glen Low Guest
|
Posted: Tue Aug 17, 2004 6:56 pm Post subject: Re: How is C++ different? |
|
|
| Quote: | In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
|
My history is Basic -> Pascal -> C -> C++. Java, C# and Objective-C
have been my post-C++ languages.
Thinking back on the difficulties in transitioning to C++, in no
particular order:
1. The exact syntax of declaring member functions outside of the class
declaration. Especially when interacting with templates.
2. Subtleties with the Big 3: copy constructor, destructor and
assignment operator. When & why they get automatically defined. When &
why they get invoked e.g. copy constructor in function return,
difference between X x = 1; and X x; x = 1; ...
3. From a Pascal background, the inverted way you declare C or C++
variables e.g. X ^CHAR; vs. char* X; especially with the convolutions
you can get with object-oriented C++ (think pointer-to-member). Lack
of sets.
4. Why arrays are treated like pointers and structs are not i.e. why
you don't have a pointer to an array like a pointer to a struct?
Cheers,
Glen Low, Pixelglow Software
www.pixelglow.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Jean-Marc Bourguet Guest
|
Posted: Tue Aug 17, 2004 6:58 pm Post subject: Re: How is C++ different? |
|
|
Francis Glassborow <francis (AT) robinton (DOT) demon.co.uk> writes:
| Quote: | In the introductory chapter I attempt to cover some of the ways that
C++ differs from a wide range of other languages which the reader
might already know. I would be interested in contributions from
people who have learnt C++ as a second language. If you have the
time and inclination could you tell us (I think it might be of
general interest to the readership here) what significant
differences you found in C++, particularly those that caused you
difficulty in understanding C++.
|
Well, C++ is not my second programming language. I already was more
or less familliar with several variants of Basic, several variants of
Pascal (one which was OO), several assembly languages, Algol68, Ada83,
Fortran, Lisp, C, Prolog and SmallTalk. This mean that I already had
been introduced to all the concepts (often in two incarnations)
supported by C++ and I already knew most of the "C traps and
pitfalls".
Obviously, if you start C++ without that knownledge, the major
challenges are the concepts you are not familiar with. I'll not write
about that. I'll try to list what surprises I remember (some of them
from learning C)
1/ char and bool are integral type
2/ some surprising automatic conversions (mainly integral and pointer
types -> bool, enum -> int)
3/ surprising relations between arrays and pointers
4/ typedef does not introduce new type but synonyms
5/ no separate compilation but linking of independantly compiled units
relying on the programmer discipline and/or other tools to ensure
the coherence
6/ use of the macro-processor (main use is to achieve coherence above
but then there are some others). Most of the other languages don't
have macros and those who have have them more integrated (see lisp,
PL/1 or forth immediate words)
7/ declarations everywhere in a block
8/ it is the class which handle visibility rules (in Ada, Modula3, and
some variants of Pascal, it is the module or equivalent)
9/ constructor and especially implicitly called destructor (there is
some kind of equivalent in Ada95 but I don't remember one in
another language) leading to RAII idiom and the possibility to
write exception save code without explicit handling of exceptions
10/ template need to be "macro-expanded". Most other language mandates
a shared implementation (Eiffel, Modula-3, I think the proposal for
Java does as well) and Ada83 has both kind of implementation and
it was a goal of Ada95 to allow to two (I think all the
implementations are "macro-expanded"). This choice along with the
possibility to do (partial) explicit specialisation make of C++ template
the most powerfull genericity mecanism I know of.
Yours,
--
Jean-Marc
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Matthew Collett Guest
|
Posted: Tue Aug 17, 2004 7:09 pm Post subject: Re: How is C++ different? |
|
|
In article <Sl4Uc.1298$191.615 (AT) newsread1 (DOT) dllstx09.us.to.verio.net>,
Victor Bazarov <v.Abazarov (AT) comAcast (DOT) net> wrote:
| Quote: | Francis Glassborow wrote:
I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language).
I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
C++ was my first OO language. When I learned C++, I knew Fortran, C,
Assembly for a couple of processors, PL/I, BASIC, a bit of Prolog. The
main "shock" was to basically undergo that "paradigm shift" known to
accompany switching between procedural approach and OO approach. I do
not remember actually reading something like "from now on you will think
differently" but that's what C++ did for me.
|
Likewise. I knew Fortran, various dialects of BASIC, some Pascal, even
a little assembly; then I read TC++PL (2nd ed.). It was a
mind-expanding experience. (In fact, I found it one of the most
conceptually difficult texts I have ever read; which given that I am by
profession a theoretical quantum physicist is I think a fairly strong
statement . )
Best wishes,
Matthew Collett
--
Those who assert that the mathematical sciences have nothing to say
about the good or the beautiful are mistaken. -- Aristotle
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Chris K. Young Guest
|
Posted: Tue Aug 17, 2004 7:36 pm Post subject: Re: How is C++ different? |
|
|
Francis Glassborow <francis (AT) robinton (DOT) demon.co.uk> wrote
| Quote: | I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language).
|
Yay! Always a fan of Glassborow books. (Expect my next errata report
to come through Real Soon Now....)
| Quote: | If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
|
I came to C++ primarily from C. One of the biggest things to have bitten
me in early days was the placement of cv qualifiers. (The C compiler I
used only warned about const violations, whereas the C++ compiler is a
lot more strict. Therefore getting cv qualifiers placed correctly became
very important.) http://www.xs4all.nl/~carlo17/c++/const.qualifier.html
was of great help here.
Using certain bits of the standard library caused indecipherable error
messages in early days (before I heard of STLfilt). This is, of course,
an implementation issue more than anything else, but can still be a
major putoff for a learner, apt to making mistakes, who has been taught
to use the standard containers for general work.
The exception-handling mechanism was difficult to get my head around,
in regard to when and how the exception object gets copied. For the
application which an acquaintance and I were discussing years ago, this
was a big deal (we needed to be sure we weren't left with a dangling
reference when we threw a dynamically-allocated exception object):
std::auto_ptr<std::exception> except;
// ...
if (something_wrong())
except.reset(new some_exception);
else if (something_else_wrong())
except.reset(new other_exception);
// ...
if (except.get())
throw *except;
Actually, the above wouldn't work: not because of dangling references,
but because the exception object is going to be sliced (15.1/3). But it
was an interesting thought experiment at the time, and just showed (to
me, at least) the unintuitive way exceptions are handled. This will be
a surprise to, say, Java programmers; they can most certainly throw
exceptions of a derived type and expect it not to be sliced:
Exception except = null;
// ...
if (something_wrong())
except = new SomeException();
else if (something_else_wrong())
except = new OtherException();
// ...
if (except != null)
throw except;
The unintuitive operation of operator bool will cane a lot of newcomers,
I think, when all they want is to be able to test an object in a boolean
context. Certainly took me a long time to appreciate why the standard
library has, say, operator void* instead.
While we're on bools, there's also std::vector<bool>. This will cane C
coders who have been advised to ``use a std::vector like an array''.
That's all I've come up with so far. I'll try to think up more....
Cheers,
---Chris K.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Peter Koch Larsen Guest
|
Posted: Tue Aug 17, 2004 7:46 pm Post subject: Re: How is C++ different? |
|
|
[snip]
| Quote: | My
biggest revelation was RTTI which (with templates) is the most important
feature of C++.
|
The post by Terje made me realise the terribly misleading error in my
pervious reply. Instead of RTTI please read RAII. Apart from some debugging
aid I do not remember ever
having used RTTI.
/Peter
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Robert Kindred Guest
|
Posted: Tue Aug 17, 2004 7:49 pm Post subject: Re: How is C++ different? |
|
|
"Francis Glassborow" <francis (AT) robinton (DOT) demon.co.uk> wrote
| Quote: |
I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this :-)
In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
|
One of the biggest differences of C++ from other languages is the ability to
use the "Curiously Recurring Template Pattern". This is not possible in any
other language. I have heard of a language called leda that can do this,
but then I heard that it was compiled by C++.
The biggest selling point to cause me to switch from C was constructors and
destructors, and the fact that they are invoked automatically. Almost all
main() functions in C can be written as:
int main(int argc, char* argv[])
{
init();
run();
shutdown();
}
With constructors and destructors, two-thirds of this can be hidden to allow
focus to be placed on the real task, namely what is in run().
hth, Robert Kindred
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Stefan Heinzmann Guest
|
Posted: Tue Aug 17, 2004 7:51 pm Post subject: Re: How is C++ different? |
|
|
Francis Glassborow wrote:
| Quote: | I am in the process of writing a book introducing C++ as a second
language (i.e. the reader is assumed to be able to do simple programming
in at least one other language). And yes, I do know that there are other
books that do this :-)
In the introductory chapter I attempt to cover some of the ways that C++
differs from a wide range of other languages which the reader might
already know. I would be interested in contributions from people who
have learnt C++ as a second language. If you have the time and
inclination could you tell us (I think it might be of general interest
to the readership here) what significant differences you found in C++,
particularly those that caused you difficulty in understanding C++.
You will get full acknowledgement for any contribution I use.
|
Before getting into C++, I had experience with a number of procedural
languages, mainly Pascal, but also some BASIC, C and FORTRAN. I also had
some experience in various assembler languages and in Forth. Before
getting to use C++ in earnest, I had exposure to the concept of object
oriented programming, and did some reading on this subject, which
brought me into contact with other languages for OOP, such as some
OO-extensions to PASCAL (Modula-Family and Eiffel) without having
written anything substantial in them. So you may say that the
OO-paradigm had started to influence my programming style before I got
into C++.
I was well aware at that time that the language you use has an influence
on the way you think about the problem, and this has been a motivation
to look at different languages in order to find new ways of thinking
about problems. I remember having been particularly fascinated by the
example of the streams library, where operator overloading was used for
something that looked like a language extension, but was implemented as
a library. I think to this day that this is the most fascinating aspect
of C++ that it offers enough flexibility to the library programmer to
tailor the languange, in other words to invent your own domain specific
language and implement it as a library, rather than building a new
compiler or preprocessor. Library design is language design, indeed!
I think that examples where this is used for good effect are those where
C++ shines most. Besides the streams library, you could mention things
like the Spirit parser library, or some numeric libraries (for matrix math).
On the other hand, it seems that in this very area the shortcomings of
C++ are also felt. It makes me wish there were a language that was
simplified as much as possible without giving up the possibility of
implementing domain specific languages as a library. It is this old
elusive goal of making it as simple as possible, but no simpler.
C++'s ongoing development has continued to influence my programming
style. The C++ I wrote at the beginning is quite different from the
style I use now. This reflects the development of the C++ community as a
whole, let me just mention templates and exceptions, which have required
a long time to mature.
So this may be the other thing that sets C++ apart from many other
languages: The development that has taken place within the language. I
could say that the development of C++ over the years has allowed me to
develop my skills without switching to other languages, C++ has grown
with me and I grew with it, lately even to include a good deal of
functional thinking. C++ has taken a tour starting at procedural
programming and went through OO towards functional programming, as
exemplified in the STL, and it has taken me with it.
Of course, for someone learning C++ now it can't be the same anymore,
and maybe it shouldn't either. You still need to take history into
account, however, in order to understand how and why things ended up the
way they are now.
I hope that C++ isn't going to freeze any time soon, as there remains a
lot of scope for improvement, both for me and for the language.
--
Cheers
Stefan
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|