I am writing a system of callbacks for BitBucket and GitHub which should modify our site on certain events in BitBucket or GitHub.
It is reasonable to make a base class like GitIntegration
to handle both BitBucket (BitBucket
class) and GitHub (GitHub
class) as its inheritors. Note that these three classes are agnostic of our site. Their only responsibility is to communicate with BitBucket and GitHub, not to do anything with our site.
But there is yet another class in the play (let's call it OurSiteGitIntegration
) which will do actual modification of our sites, when he receives messages from either BitBucket or GitHub.
We need to somehow connect OurSiteGitIntegration
with particular code for BitBucket and GitHub.
The best idea I've come up is the following:
Make OurSiteGitIntegration
an abstract class and create two mixins:
OurSiteBitBucket
(derived fromOurSiteGitIntegration
,BitBucket
)OurSiteGitHub
(derived fromOurSiteGitIntegration
,GitHub
)
Is there an even more concise and straight way? (without the mixins)
I use Python Django.