Boost logo

Boost Users :

From: Nat Goodspeed (nat_at_[hidden])
Date: 2007-12-20 16:45:43


John Torjo wrote:

> * What is your evaluation of the design?

"Factory" is a succinct shorthand for "constructor/new forwarding
library", but I must admit that the name Factory implies more to me --
something more like the GoF Factory pattern.

I used the library to build a toy version of a Factory mechanism from a
previous project. With that, the client passes a std::string name and
gets a pointer to the corresponding concrete implementation of an
abstract base class.

To be sure, the messiest part of my previous implementation was passing
constructor arguments. It was nice that boost::factory eliminated the
need to handle that explicitly.

> * What is your evaluation of the implementation?

I didn't look at the implementation.

> * What is your evaluation of the documentation?

It could be more tangible. As I read it, my question was: how can I use
this library to build the functionality described above? To me, the most
useful part of the documentation was the hint about boost::function and
the examples.

Several more examples would be great. I'd particularly like to see the
boost::function trick illustrated in more depth, e.g.: here's a
std::map<std::string, boost::function<Base*()> > which we can populate
with boost::factory<SubclassOne*>(), boost::factory<SubclassTwo*>(), etc.

Since (to me) the real power of boost::factory is that it forwards
constructor arguments, extending that example to show a non-empty
canonical constructor argument signature (e.g. a mapped_type of
boost::function<Base*(int)>) would be good too.

But lack of that extended documentation shouldn't be a showstopper.

> * What is your evaluation of the potential usefulness of the library?

It's a very useful building block.

> * Did you try to use the library? With what compiler?
> Did you have any problems?

I tried boost::factory with Apple's g++ 4.0.1. I had no problems.
I didn't try boost::value_factory.

> * Do you think the library should be accepted as a Boost library?

Yes. My one concern is that perhaps the name boost::factory should be
reserved for a later, more full-featured library, built on this one --
though I haven't yet thought of a more descriptive name for this one
that's both clear and concise.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net