I'm currently writing my own PHP Framework (yes, another one) for studying purposes. I'll actually try to use it as my graduation dissertation.
After two failed attempts, I've finally found a way to develop it in a modular architecture, like Zend and Symfony.
I have some loosely coupled modules that can work apart from each other, but their usability would be better if I stick them together.
Now I'm wondering the best way of integrate them. I'm not willing to put a module as requirement for the other, because this breaks the modular design.
My first idea was to create a different module that requires the other two and put them to work together. This would work fine when I have just two modules, but when I have a module that can be integrated with two or more modules I get lost.
Should I create one module for each possible integration? Or should I create just one module and put all integrations I could have there?
Am I clear? If not, I'll try to explain it better.
A practical example.
My Data Access Layer implements the Table Row Gateway pattern. I have a
TableGatewayInterface and a default implementation
Imagine now that I want a table with a cache for the last queries. I can achive this with the Decorator pattern, creating a
CachedTableGateway that depends on
TableGateway and a cache component, let's say
I don't need the cache, but it could be useful.
Should I embed this decorated implementation into the original package, creating a requirement to the cache component? Or should I create an "integration package" that requires both cache and table gateway?