[Ns-developers] ns-3-object proposed for merge

Raj Bhattacharjea raj.b at gatech.edu
Wed Jan 30 11:25:51 PST 2008


On Jan 30, 2008 3:53 AM, Gustavo Carneiro <gjcarneiro at gmail.com> wrote:

> I think AddObject/AggegrateObject & GetObject/FindObject/FetchObject
> really
> conveys the wrong meaning.  Remember, this is not a simple object
> container,
> far from it!  You can add multiple objects, but not if they are of the
> same
> type.  For me, AddInterface and QueryInterface is the only terminology
> that
> conveys the correct semantics.  Especially if you have background on COM.
> If you don't have background on COM you can always point people to some
> COM
> terminology and they'll understand (for example
> http://en.wikipedia.org/wiki/IUnknown).
>

Functional semantics aren't conveyed by JUST the name of a method, but also
by its parameter list and return type.  If you told me that I can use
something like GetObject(TypeId), I'd ask you immediately "what if two
aggregated objects have the same TypeId, what is the behavior?"  If you gave
no reply, after a few seconds I'd probably think "either it returns a list
of ALL matching Objects, or it is disallowed to have multiple Objects of the
same TypeId".  Then I'd look at the return type and see that it returns only
a single Ptr to the type, and I'd conclude that it is in fact disallowed to
have multiple Objects of the same type aggregated.
The semantics are correctly implied by the function signature, and most
people would realize what is going on from this and the name.  If our
aggregation had generic container semantics, it might look like
GetObject(objectName) or GetObject(objectIndex); but it doesn't, so I don't
think there is a problem.

-- 
Raj Bhattacharjea
Georgia Institute of Technology
School of Electrical and Computer Engineering
Systems Analyst
404.894.2955


More information about the Ns-developers mailing list