On Jun 11, 12:11 am, Noah Roberts <u...@example.net> wrote:
> James Kanze wrote:
> > The clean build isn't the problem. You can schedule that
> > overnight, or for a weekend. (For my library, a clean build
> > for all of the versions I support under Unix takes something
> > like eight hours. Which doesn't bother me too much.) The
> > problem is the incremental builds when someone bug-fixes
> > something in the implementation. For non-templates, that
> > means recompiling a single .cc file; for templates,
> > recompiling all source files which include the header. A
> > difference between maybe 5 seconds, and a couple of minutes.
> > Which is a very significant difference if you're sitting in
> > front of the computer, waiting for it to finish.
> See the "Stable Dependencies Principle" and the "Stable Abstractions
> Principle".
> http://www.objectmentor.com/resource.../stability.pdf
> "Thus, the software that encapsulates the *high level design
> model* of the system should be placed into stable packages."
> - Emphasis added -
> "[The Stable Abstractions Principle] says that a stable
> package should also be abstract so that its stability does not
> prevent it from being extended."
> Robert C. Martin's article on stability principles pretty much
> stands against everything you've said in this thread to date.
You've obviously not understood the article, or what I've been
saying. The abstraction and the design should be stable. It's
implementation won't necessarily be. The problem with C++
templates, and currently implemented by most compilers, is that
they require the implementation in places where logically, you
should only have the abstraction. And thus introduce
instability in places where you don't want it.
> Templates are the epitome of abstraction.
I wouldn't go that far. They're a tool which can help to
implement certain types of abstraction.
> Perhaps if you were not so anti-template
I'm not anti-template. I'm very much in favor of templates. So
much, in fact, that I'd actually like to seem compilers
implement them in a way that was usable in practice (with
export). My complaints aren't with templates; they're with the
cruddy implementations I have have of them.
> you'd do some looking into how to make the best use of them
> and you would not be arguing about changing templates causing
> long builds; you'd be well aware that you simply don't change
> templates that often.
That's true for things like the standard library, and lower
level code. On the other hand, if you're not changing your
application, then what are you doing when you program.
[...]
> Of course, you need to go back and read about the other design
> principles that Martin describes in order to see the entire
> reasoning behind why you put the *high level code* in your
> stable, abstract packages. I'm not begging an authority,
> Martin's stuff just happens to be very good and the reasoning
> stands on its own.
> The principles of OOD translate very well to Generic Programming.
I have a very high regard for Robert Martin; he's one of the
people who taught me C++. The problem is simply pragmatic;
templates don't really work with most compilers. For most
compilers, they're really just elaborate macros, with all the
problems macros entail.
--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34