[Exceptional C++ Style] Item 14: Order, Order!

Kevlin Henney kevlin at curbralan.com
Tue Dec 14 06:59:23 EST 2004


In message <ABEFILAMAIBCHBLPJDEKKECOCDAA.SamS at helpIT.com>, 
SamS at helpIT.com writes
>effective-cpp-bounces at accu.org wrote:
>> In message <20041213170753.ZPVO11200.fep02-app.kolumbus.fi at EVO>, White
>> Wolf <wolof at freemail.hu> writes
>>>>
>>>> In that case it is a definition that you should make
>>>> explicit, because the definition of strength is otherwise
>>>> unqualified and people will fall back on the associations
>>>> normally used when describing relationship strength and
>>>> thoughts of coupling, cohesion and dependency management in
>>>> general. However, even after clarifying the terminology,
>>>> friendship still ranks second: membership is a stronger binding.
>>>
>>> Why?  A member does not depend on the class containing it.
>>
>> Err, yes it does: that is fundamental to the definition of membership!
>>
>> Kevlin
>
>Are you two talking about the same thing?

I hope so :-)

>It looks like Kevlin is speaking about member _functions_ and WW about
>member _data_. It is obvious to me that function membership provides the
>strongest binding, but, in C++, data membership surely has a weaker binding
>than both friendship and inheritance?

In this context I would not expect to be talking about data members as 
it wouldn't make as much sense -- it would not be the same or a related 
topic of discussion. As we started talking about friendship, the notion 
was the dependency that a piece of executable code could have on a 
class. Hence the concern about relationship strength and breadth. 
Friendship can be granted to types and functions, and it is these that 
would be granted access privileges. The related member concept is member 
functions and nested classes, not data members.

That said, there is of course some kind of dependency of data members on 
the surrounding class -- initial value, permissible access, etc -- but, 
interesting as that is, it is not really what we are discussing.

Kevlin
-- 
____________________________________________________________

   Kevlin Henney                   phone:  +44 117 942 2990
   mailto:kevlin at curbralan.com     mobile: +44 7801 073 508
   http://www.curbralan.com        fax:    +44 870 052 2289
   Curbralan: Consultancy + Training + Development + Review
____________________________________________________________



More information about the Effective-cpp mailing list