[Ns-developers] Pcap and Ascii Tracing Rework: Mixins

Gustavo Carneiro gjcarneiro at gmail.com
Tue Feb 2 03:35:25 PST 2010


On Tue, Feb 2, 2010 at 9:18 AM, Mathieu Lacage <
mathieu.lacage at sophia.inria.fr> wrote:

> On Mon, 2010-02-01 at 14:12 -0800, craigdo at ee.washington.edu wrote:
>
> > For quite some time, we have frowned on multiple inheritance (at least
> > gratuitously so) in ns-3.  However, we already have a number of instances
> of
> > multiple inheritance that have appeared over the years.  I don't know if
> > these are accidental, or things that haven't been caught in reviews, or
> what
> > the ultimate story is.  However, putting a stamp of approval on mixins
> will
>
> I am not aware of existing uses of multiple inheritance. If there are
> some, it's because I did not see them in reviews. Would you mind point
> me to these existing cases or file a bug about them so that we can
> review if it's a bug or if it makes sense ?
>

While scanning python bindings I caught these:
Ipv6ExtensionHopByHopHeader, Ipv6ExtensionDestinationHeader,
MinMaxAvgTotalCalculator.


>
> > We avoid this nonsense in low-level code by using aggregation.  We made a
> > conscious design decision to avoid low-level mechanisms in helpers
> wherever
> > possible and so I think mixins are the only sane answer here.
> >
> > Now that we have multiple inheritance implemented in pybindgen, I would
> like
> > to go ahead and use mixins for this functionality.
> >
> > Any objections?  Comments?
>
> I do not really understand why we can't merge both PcapHelperForDevice
> and TraceHelperForDevice into one single class TraceHelperForDevice
> supporting both tracing modes: we don't want device helpers which
> support only one or the other method of tracing. We want always both to
> ensure maximum consistency.
>
> For the ipv4/ipv6 stuff, my comment is the same: I don't really see the
> point of trying to decouple all this stuff, especially since we have a
> single ipv4/ipv6 implementation which should/could support both tracing
> methods.
>
> So, I am not really against using multiple inheritance if it makes sense
> but, in this specific case, we could probably simplify the problem to
> avoid having to solve it using multiple inheritance. Actually, I should
> rephrase the above to: "we could probably simplify the problem to avoid
> having so many classes around which are always used together anyway".
>
> Mathieu
>
>


-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list