Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-02-25 18:00:45


> This is an excellent point. One doesn't go looking for a class
> named "smart_ptr" or a library named "Boost.SmartPointer" when
> looking to manage the lifetime of some arbitrary resource. When
> one uses pointers, it makes sense.

I would be searching namely for smart_ptr. I know that smart pointer is the
name for the resource management idiom.
 
> > It is a shame for things to simply be the way that they are simply
> > because they started out from a specific beginning...
>
> History always has a way of biting us. In this case, we are
> creating something brand new in Boost. There isn't a PBSP in
> boost. Therefore, if it is a manifestation of a SmartResource
> concept or is implemented in terms of a smart_resource class
> isn't as important as the recognition that it is a special case
> of the more abstract concept.
> There can still be a smart_ptr class, even if there's a
> smart_resource class. Both may be separate manifestations,
> possibly sharing some implementation details, of a SmartResource
> concept. Equally plausible, smart_ptr could be implemented in
> terms of smart_resource somehow (derivation, aggregation,
> whatever).

This all would make sense if you could find at least "10 differences"
between "smart resource" and "smart pointer".
 
> Names are important. Witness the recent discussion about whether
> pointers are resources, refer to resources, or may refer to
> resources. Words convey meaning. The wrong words confuse. The
> right words clarify. The same is true for names. Yes, one can
> learn that "smart_ptr" means resource manager for which pointer
> semantics may be appropriate. But, far better is to have
> "smart_resource" and "smart_ptr" as separate classes. The latter
> provides a superset of the behavior of the former, but the former
> may be precisely what's needed in a given context.

In general I agree that names are important. In general, but not in this
particular case.
If names are so important for you here, why do you try to use the name
"smart resource"?
What is "smart" here? May be we should use "clever" or "cunning" or "wise"?
And what word "resource" is doing here? It almost never the resource itself,
but the manager code for some resource (it may not even hold reference to
the resource itself inside). As I sad before IMO most close name would be
"resource_manager". But I still do not see a reason in introducing new
terms, while already exist well established idiom with name "smart pointer"

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk