Closed biscimus closed 6 months ago
@biscimus, Thanks for your contribution - we appreciate it. Would you mind pointing out to me any related documentation and where you miss such an event bus-related documentation? Thanks!
@biscimus Would it be helpful to have something like https://stackoverflow.com/a/46186706/5846045 in the documentation?
@boghyon Yes something like that would be very nice!
Hi @biscimus,
concerning the EventBus we have to take the overall application architecture into account. While it is true that you can achieve an inter-controller communication quite easily, it is not always the preferred or best practice way.
We struggle with this topic, since it's highly dependent on the application structure and your needs. We are always a bit flimsy on that topic for a reason... and the reason being: we can't recommend it wholeheartedly ;) Less LoC doesn't necessarily mean better design, so we are a bit careful with this topic.
In general, I would recommend to use the global EventBus as sparingly as possible (if at all).
I'll give you some of my thoughts down below, as well as a concrete recommendation for UI5 apps. But please understand that this is just my opinion. Like any design pattern, the whole topic is contentious and also a reason why we are a bit "weak" on the topic in the developer guide... Ultimately it's highly dependent on your app and the scope of it.
Hope that help's you in your design considerations.
BR,
Thodd
object
. There is no typed connection between publisher and subscriber.
owner Component
via dependency injection.owner Component
concept applies.async/await
instead of an event-callback hell.async
functions, their return value is void
and we reserve the return value for potential future use.@Thodd Thank you for your detailed input. If the event bus is that much of a sensitive topic, isn't that even another reason to add a documentation regarding this feature?
@biscimus After lengthy discussion with our developers we concluded that providing additional documentation on the event bus feature is neither necessary nor prudent at this point. We promise, however, to keep an eye on the issue and inform you if anything changes.
Missing documentation to Event Buses
Hello Documentation Team,
Recently, I faced an issue trying to access controllers of child views inserted in the parent view. The concept of event buses really helped to reduce lines of code and to make the entire inter-controller-communication easier (in case there are better ways to solve this problem, please let me know). However, the event bus feature was overlooked by our team for quite some time, since there weren't any documentation pages referring to the feature, but only a single API reference page instead. There are a couple documentation pages describing how to incorporate child views using multiple targets, but no description how these child controllers should interact with each other & communicate information. Event buses also come in handy when generally dealing with publishing custom events, which is why I'm proposing a documentation page for the event bus feature.
Feedback Type (Optional)
None
Page Title on SAP Help Portal (prefilled)
No response
Page URL on SAP Help Portal (prefilled)
No response