Re: Book recommendations: Generic programming
on Mon Mar 19 2007, "Rune Allnor" <allnor-AT-tele.ntnu.no> wrote:
On 15 Mar, 00:47, Jorgen Grahn <grahn+n...@snipabacken.dyndns.org>
wrote:
though. Maybe I am lazy or unintelligent ... but it seems to me that
there is a use case for templates in everyday, non-library
development. And that neither book covers that explicitly.
I don't know about my own intelligence, ut I am definately
lazy, I'll put a lot of effort on avoiding to do any actual
work. Which is why I make the efforts to avoid writing only
slightly diffrent code over and over, for only slightly
different applications.
That's a great instinct. Unfortunately you've run up against a
paradox: the more re-usable you make your code, the less lazy you can
afford to be about it... but it's worth it. Well, to tell you the
truth, no matter how un-lazy you are, any idea that you can afford to
be lazy while writing only slightly different code over and over is an
illusion.
For someone like me who hasn't used templates for anything but
trivial tasks, reading these books makes me feel like when I
learned BASIC, or functional programming. It is hard to tell where
to start, and what's possible to do.
Not only that, the thinking about C++ has changed during the
last decade or so. I learned C++ in 1995-96 after having got
bogged down in a nightmare of a C program the years before.
Around -97 I had to make some major decisions, most of which
had to do with programmer time and portability. The STL was
in its infancy at the time, and g++ was the only compiler
available to me which supported templates etc. I had personal
reasons for not wanting to have anything to do with g++, so
I turned to matlab for my work.
G++ is still one of the better compilers for template work, largely
because of the quality of its error messages.
Around 2002-2003 I decided to return from the matlab world,
and have slowly tried to revive what little C++ I knew.
These days, STL is the name of the game. I almost got a
shock when I got my hands on the Koening & Moo book; the
C++ code is recognizable, but the approach to the programming
language has changed completely.
Great book; great approach! Too few people still approach C++ from
the high-level end.
The focus on the STL and the change
of philosophy seem to have had such significant impact
on the whole thinking around C++ programming, that people
like me, who first learned C++ (and learned it poorly, in
my case), say, mid 1990s and before, have a chance of
catching up, for a reasonable effort.
Well, Koenig and Moo is a great first book in that direction. Maybe
someone could convince them to write Koenig & Moo II :)
To me, contemporary C++ is an all but completely new
language, compared to the language I left in -97.
I think you're seeing the shift away from focusing on low-level
language features and toward the use of high-level libraries. I agree
that's a profound change, and there should be more books that focus on
how to be effective with libraries.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]