in reply to Stacking Mixin Classes at Run-time with Class::MixinFactory

Using the proper ice cream store real-world analogy, Mixins come from candy companies, not factories. I suggest you amend this. Also, a Factory for a Factory is usually called a GeneralContractor, or maybe a ConstructionCompany. We don't need to check if something has a factory, since, well, we know some things always come from factories (like car parts).

<quote> Effective use of multiple inheritance for run-time selection of mixin classes </quote>

Seriously, can you justify a real world example where this cannot be replaced with a simpler concept? IMHO such complexities are a sign the code/design needs refactoring to make it simpler...not more complex.

  • Comment on Re: Stacking Mixin Classes at Run-time with Class::MixinFactory

Replies are listed 'Best First'.
Re^2: Stacking Mixin Classes at Run-time with Class::MixinFactory
by simonm (Vicar) on Nov 16, 2004 at 19:26 UTC
    Seriously, can you justify a real world example where this cannot be replaced with a simpler concept?

    Of course multiple inheritance CAN be replaced by decomposition and delegation -- for that matter you could do it all without method calls, or in COBOL -- the question is whether your code would end up being better as a result.

    My contention is that controlled use of multiple inheritance is a reasonable technique for a developer to use, and more specifically that this implementation is a workable solution for cases where you'd like to extend an object through subclassing, and need the ability to use several subclasses at once.

    The example I was using was from the real world -- Text::MicroMason. Using stackable mixins lets users select which features they want to enable, with relatively little overhead... If you see a better way to handle this, patches would be welcome.

      -- for that matter you could do it all without method calls, or in COBOL -- the question is whether your code would end up being better as a result.
      Straw-man. Of course Fortran is the way to go.