Core Loot Manager DKP & EPGP & SK

Core Loot Manager DKP & EPGP & SK

2M Downloads

Rework initialization requirements for Modules instead of central Initialize

lantisnt opened this issue ยท 0 comments

commented

I'm not a fan of this pattern. Essentially you're creating a singleton table called UnifiedGUI, but you've made it someone else's responsibility to initialize it.
Either you initialize it on file load, or you initialize it on some event (and you register the listener on file load), or the cleanest: you initialize it automatically whenever calling any function that requires it to be initialized.

The problem with this pattern is that your code is now littered in every public function with something like if not self._initialized then return end. Which makes those public APIs weird to use (since I have to check the return value type) and it gives me little recourse; so then any callee now needs to understand that maybe calling UnifiedGUI:Initalize() will solve their problems. But that function has prerequisites which they are not aware of etc...

From what I understand this code has a few requirements:

  • LedgerManager
  • Database

Imo just check if these are set on file load.

Originally posted by @SamMousa in #327 (comment)