Commonality and variability

I just finished Jim Coplien’s Multi-Paradigm Design for C++. While I found it a little too theoretic for my taste (sometimes I think I’m stupid, but there’s been some evidence to the contrary, so I assume the book was just difficult), it presented some concepts I thought would be interesting to investigate further.

As I understood Coplien, the fact that C++ supports multiple paradigms is mostly useful to the extent that these paradigms (object-orientation, templates, procedures, preprocessor) can be used to express commonality and variability in designs.

Commonality forms families or type hierarchies in traditional OO. For C++ generic programming, a commonality could be expressed as a template.

Variability, on the other hand, is what disambiguates the family members from each other. Again, in the OO setting, this is typically derived, concrete classes, whereas for templates it’s the actual template arguments that cause the specialization.

I think these concepts may actually be very useful in thinking about designs, and how to express them. Coplien’s work postdates the seminal work on Design Patterns, but I believe commonality/variability analysis can be of help in forming, understanding and recognizing patterns.

All in all, I thought the book was pretty hard to digest, but it added some kind of meta-conscience to my design sense. I think I’ll be able to think in terms of commonality and variability to explore solutions to design problems more freely. Given time and energy, I’m going to see what else has been written on commonality/variability outside of the multi-paradigm design space, and keep reading.

3 thoughts on “Commonality and variability

  1. Danilo Vujovic skriver:

    Hi Kim
    Have you come across any other literature on Commonality-Variability Analysis since you read Coplien’s book?
    I’d be interested to see if there has been any further research on this topic.

    Thanks.
    Regards,
    Danilo.

  2. Kim Gräsman skriver:

    Hi Danilo,

    No, I think Coplien is actually the inventor of these terms in this context. I found a reference to his Master’s Thesis [1], which appears to be an early version of the book — most of it looks superficially familiar to me.

    I haven’t had time to do more digging, but a discussion on the TDD list some time back led me to believe that the concepts weren’t widely known.

    HTH,
    – Kim

    [1] http://users.rcn.com/jcoplien/Mpd/Thesis/Thesis.pdf

  3. […] tekniker som används för att uttrycka likheter och variationer tar inte stöd bara mot befintliga features i språket, utan uppfinner egna konstruktioner på […]

Kommentera

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut / Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s