![]() |
|
Don't ask to ask, just ask | |
PerlMonks |
Re: Designing multiple related modulesby bliako (Abbot) |
on May 12, 2021 at 13:22 UTC ( [id://11132478]=note: print w/replies, xml ) | Need Help?? |
I am in favour of (2) creating an "interface" although I would call it "base class" because it will have common functionality implemented in there, centrally and for once. For example a toString() method or export/import_session() which would not be in general needed to be overwritten by subclasses. An advantage of this is that 3rd party developers can contribute implementation classes for different social media while the API is centrally controlled. Provided that there is indeed a common API with these and future social media sites (hmm not so sure about that). An example for the above is HTTP::Cookies and the large number of subclasses (by different contributors) overwriting its load() and save() methods for various browsers and cookie standards. The key point is: contributions by 3rd party. And the biggest problem is for you to identify the API and make sure it will be generic and can survive in time, respecting the contributions by others. PS. I may be missing something but (4) Factory works in conjuction with (2), not as an alternative. bw, bliako
In Section
Seekers of Perl Wisdom
|
|