You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it a good idea to let the class Plugin inherit from Core? It seems a little bit more intuitive than passing the core object like it is necessary at the moment:
I'm not sure what you mean by inheritance here, but it would be great if you could describe what you're thinking of. (I struggled a bit with the architecture there and I'm still not 100% convinced, so I'm open to suggestions)
The reason I did it this way is that the Core object is only initialized once and it holds the connection. The Plugin and every RemotePlugin needs a reference to the core to share that single connection. So the Core object is basically an abstraction between the RPC library and the API.
The principle behind this is called dependency injection.
Another option is to keep the Core as a singleton, but the more I read into that the more it seemed like bad practice.
Is it a good idea to let the class
Plugin
inherit fromCore
? It seems a little bit more intuitive than passing the core object like it is necessary at the moment:def __init__(self, name: str, desc: str, author: str, licence: str, core: Core):
The text was updated successfully, but these errors were encountered: