aries-cloudagent-python icon indicating copy to clipboard operation
aries-cloudagent-python copied to clipboard

Interfaces/base classes and dependency injection

Open usingtechnology opened this issue 2 years ago • 0 comments

With the evolution of aries-acapy-plugins, I think it is time to start defining/implementing base classes so we can break up dependencies and allow new implementations for plugin developers.

The anoncreds-rs work has started in this direction and I believe there are many more opportunities to decouple the code.

One example is multitenancy... when I was working on traction plugins, I had difficulty simply replacing the implementation. There were direct dependencies on the base class. Also, while I was doing old school debugging to figure out how/where to make my workarounds I noticed that the dependency injection mechanism and profiles seemed to be called a lot! It is very quick, but in a single request thread the profile was copied hundreds of times. It feels like there may be a better way to build out the necessary context.

Hopefully there is a way we can stage this out, something like:

  • define Base classes and define providers for base classes (maybe not necessary for all cases?)
  • ensure providers are used, no direct dependency on base class
  • refine the dependency injection and profile framework

usingtechnology avatar Oct 18 '23 23:10 usingtechnology