T
T
topuserman2022-01-13 12:54:35
OOP
topuserman, 2022-01-13 12:54:35

How is it architecturally better to solve such a problem (from the point of view of OOP)?

In the framework that they work with, there is some built-in class - EventManager.
Which is able to add, register event handlers, etc.

I would like to simplify the signature of one of the methods (so that the input parameters have a completely different format).

For example:

there was a method AttachEventHandler(module, type, handler) and I made this method:

SimpleAttachEventHandler(config) {
     // тут делаю еще какие-то дела
    AttachEventHandler(config.module, config.type, config.handler);  // т.е. внутри своего метода я дергаю тот же метод фреймворка
}


It would not be desirable to expand by inheritance.
Please tell me what are the architectural solutions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Derepko, 2022-01-13
@uDenX

https://refactoring.guru/ru/design-patterns/decora...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question