Blog post : OOP composition with mixins

Abdulhaq via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Aug 31 07:20:23 PDT 2015


On Monday, 24 August 2015 at 13:28:23 UTC, Atila Neves wrote:
> On Monday, 24 August 2015 at 11:10:16 UTC, Dicebot wrote:
>> Rough summary of the talk I have given for recent Berlin D 
>> meetup event:
>> https://blog.dicebot.lv/posts/2015/08/OOP_composition_with_mixins
>
> Nice. I've only just started exploring code reuse with template 
> mixins, and used it to great effect in my last project. Blogs 
> like this are useful since there aren't many examples in other 
> languages (Ruby modules come to mind).
>
> Atila

Inheritance certainly is 'the base class of all evil'. I have a 
theory that the reason inheritance is so overused in OOP 
languages lies in the way it is taught - the OOP aspects cover 
much of the syntax of the language and hence much teaching 
material revolves around inheritance. This makes the student 
believe that inheritance is therefore the 'right way' to proceed. 
Many years of pain have, however, taught me to avoid inheritance 
and to prefer composition - even/especially when using e.g. Java.


More information about the Digitalmars-d-announce mailing list