[Ns-developers] finalizing the ns-3 object model (configuration)

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Sat Jan 19 09:42:15 PST 2008


hi craig,

I thought I had sent a reply to that email, but it seems that this is
not the case so, here is a rewrite.

On Mon, 2008-01-14 at 20:22 -0800, craigdo at ee.washington.edu wrote:

> So, my first comment is, that when I saw: 
> 
>    Parameters params;
>    params.Set ("PointToPoint::ChannelDataRate", "5000000");
>    params.Set ("PointToPoint::ChannelDelay", "2");
> 
>    Ptr<PointToPointChannel> channel0 =
>      PointToPointTopology::AddPointToPointLink ( n0, n2, params);
> 
> I was astonished.  This code snippet seems to violate pretty much every
> usability guideline for interface design I've mentioned.  It's completely

I have to confess that I have read your email carefully a few times but
that I do not really understand how it violates all these guidelines.
Would you mind trying to elaborate ?

> new and unique.  It makes a simple and common thing like passing 5000000 to
> a function painful.  This pain will last forever.  I can see this kind of

Well, this has to be compared to the alternatives. Every other
alternative is going to require to specify a name/value pair somewhere:

DefaultBind ("Name1", "Value1") 
DefaultBind ("Name2", "Value2") 

Ptr<PointToPointChannel> channel0 =
PointToPointTopology::AddPointToPointLink ( n0, n2);

seems hardly different and/or more or less verbose from:

Parameters params = Parameters ("Name1", "Value1", "Name2", "Value2");

Ptr<PointToPointChannel> channel0 =
PointToPointTopology::AddPointToPointLink ( n0, n2, params);

or from the slightly more verbose version you have shown above.

> stuff appearing all over our codebase.  It does make rare things possible,
> though, and strikes me as way to clever.  It may work and it may enable some
> really hairy reconfiguration down at the low levels of the code, but I'll
> have a really, really hard time signing off on something like this.

Is your concern really only about syntax ?

Mathieu


More information about the Ns-developers mailing list