]
These are only "exceptions" to some stupid rule that
only a subset of the C++ community happen to agree with
including yourself.
The "subset" includes most of the experts. People like Herb
Sutter, for example.
I don't want to get involved in an old argument, but James,
where can I read more about the reasoning behind this? It was
a new opinion to me; I don't think I've come across it before.
The article which brought the idea into mainstream programming
ishttp://
www.gotw.ca/publications/mill18.htm, by Herb Sutter.
That article says, "Don't derive from concrete classes."
Citing another document which explains why.
I don't know of a better way to support multiple versions
of a client. The versioning that some well-known
serialization libraries tout encourages people to use one
class and conditionals to support multiple versions within
the class. I think that approach is very weak and that
deriving from a concrete class is the better alternative.
I'm not sure. I've never seen an implementation of verionning
which used derivation. I'm not sure it can be made to work, but
perhaps I'm just misunderstanding what you're proposing.
I've taken this from one of my pages. It ammounts
to guidelines for handling multiple versions rather
than any type of version support.
release
1.1 1.2 1.3 1.4
-----------------------------------------------------------
class name Account Account Account_13 Account_13
The class name incorporates the release in which it was
last changed. Let's say that the 1.3 version of the server
is required to support 1.1 clients. To do this the server is
built with both the Account and Account_13 definitions.
When only additions to Account are needed between releases,
the software might be structured like this:
AccountBase
|
Account
|
Account_13
If data members need to be relocated out of Account
in the 1.3 release, the hierarchy might be:
AccountBase
/ \
Account Account_13
There's some terminology for different approaches
to version support, but at the moment I'm not
remembering it. Boost's approach might be called
internal version support and mine might be called
external(do-it-yourself) -- advice. I'm of the
opinion that no matter how minor a change to the
data members of a class, you should introduce a new
name for that class. Boost versioning support is
in my opinion best avoided. What it amounts to is
changing 1.1 code in order to support 1.3. If you
do that, I think you're more likely to introduce
problems for 1.1 users. My approach uses unchanged
1.1 code (in the 1.3 release) to support 1.1 users.
Also, the Boost approach uses one big class to
support both 1.1 and 1.3 users. That is inefficient
when it comes to supporting 1.1 users; the 1.3
fields are there whether you need them or not.
There are also inefficiencies that come from
frequent testing of the version number with the
Boost approach.
Brian Wood
http://webEbenezer.net
(651) 251-9384