1

I am writing an extension for a certain software. This extension uses many hooks to add functionality to this software. The software in question uses global state all over, and often has dependencies pulled in, as well as tight coupling by using static method calls. In the code invoked by my hook handlers I often need components from this software and thus seem to have no choice but pulling them in. These hooks are all quite different, passing along different into, at various steps in the processing of the app, and with different handling components in my extension code. This basically means my extension has a mess of entry points, ruling out creating an application object at some main entry point and doing dependency injection from there. Any recommendations on what approaches to take to have as SOLID code as possible in such a case?

Jeroen De Dauw
  • 10,321
  • 15
  • 56
  • 79

1 Answers1

0

I would consider using Facade design pattern. It will help you to hide the complexity of your current system. With facade pattern you can have only one communication point between your extension and system. In the facade you would just expose the entry points you need for your extension. It will also be the only place which will have dependencies on your current system components.

There is plenty of resources on the net, so just for start:

Community
  • 1
  • 1
mipe34
  • 5,596
  • 3
  • 26
  • 38