D
D
dmitriy2017-10-24 09:23:14
PHP
dmitriy, 2017-10-24 09:23:14

What is the name of the class that contains the implementation?

There is a library that does something, there is a part of the functionality that this library needs for its work in a closed CMS (the principle of Open / Closed), in this library I want to provide an implementation for different CMS, the question is:
1. What type does this set of classes belong to (Adapers, ...)?
2. Do I need to supply an implementation with this library at all, perhaps it needs to be done in a separate repository?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Gontarev, 2017-10-24
@igontarev

1) it looks like a strategy , here, as a strategy, your functionality for the library, in fact, for different CMS you can have different functionality, or the same one, substituting one or another implementation, in general it looks like your case, but there is little information
2) you need to supply everything that is necessary for the library to work, if it is a separate repository, then you need to add a dependency to the composer, but you don’t need to complicate it too much, you can’t think everything through in advance, you can move it to a separate repository in the future

D
dmitriy, 2017-10-24
@dmitriylanets

Googled that the bridge pattern seems to fit, an example in php-debugbar https://github.com/maximebf/php-debugbar/tree/mast...
https://sourcemaking.com/design_patterns/bridge/php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question