Is there anything wrong with having a central resource of pointers to act as a communication exchange within a project?
Im currently working on a multi component application in JUCE, learning C++ as I bumble along. Its gotten unwieldy and im looking to clean it up, both to decouple the components from each other and simplify / standardise communication.
The solution that seems most obvious / elegant to me would be to have a pointer manager object holding pointers to all components that need to receive external input, and just have classes reference the manager object, calling the component they need, when they need. Objects would be owned by their parents, and register themselves to the pointer manager in their constructor.
Is there anything wrong with this? Ive not seen any design pattern take this approach, which kind of suggests im about to put a lot of work into doing something stupid.
Does anyone have any downsides or alternatives to consider?
Aucun commentaire:
Enregistrer un commentaire