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
those kind of code are everywhere sometimes in both the api and the application using the api thus finding a way to avoid this duplicated code will improve code clarity as well as quality
proposals :
the return object could be enhanced with generic methods like then and else to setup handlers this might have some side effect as sometimes the existence of a then method is used to know if the object can used like a promise
a method factory can be used to wrap methods and handle basic tests like the connect level although this will probably be complicated hard to maintain and be a bug factory instead of a method factory. This way may also cause trouble for documentation and completion helper inside some IDEs.
The text was updated successfully, but these errors were encountered:
I would be cautious with this sort of simplification which could often fall down with specific use cases.
I prefer to push this issue to the lowest priority level.
I would be cautious with this sort of simplification which could often fall down with specific use cases.
the main idea is to provide helpers for generic use cases but stay backward compatible so not removing anything thus if a specific use case can be currently achieved it would (and should) still be achievable after the addition of the helpers.
The current code is duplicated for sure but it is perfectly readable, which is not necessary the case with handler subscription.
yes finding a good way to remove duplicated code while keeping it easy to read is easier said than done and might require test of multiple possibilities
galyfray
changed the title
[FEATURE] refacotr to remove duplicated code
[FEATURE] refactor to remove duplicated code
Nov 15, 2021
there is inside of the api many times the same-ish code :
or
those kind of code are everywhere sometimes in both the api and the application using the api thus finding a way to avoid this duplicated code will improve code clarity as well as quality
proposals :
then
andelse
to setup handlers this might have some side effect as sometimes the existence of athen
method is used to know if the object can used like a promiseThe text was updated successfully, but these errors were encountered: