microsoft / alguidelines

Best Practices and Design Patterns for the AL Language
https://alguidelines.dev/
MIT License
131 stars 49 forks source link

Event Bridge Patten #110

Closed waldo1001 closed 2 years ago

mynavblog commented 2 years ago

Maybe it is late for me. But could the events be outside the interface after the place where the function GetWeight() is "triggered" then you will be sure that the trigger always will be reachable by other apps?

waldo1001 commented 2 years ago

Hm .. well, what if I call it from another method / or I decouple the method. I still need to be able to call the right events, no? 🤔

This pattern is meant to "think about reuse of events" - something even MS didn't think of in a few cases ;-).

mynavblog commented 2 years ago

If the pattern is about reuse of the events I fully agree that is something worth to do. I just was little confused about interface in this - since one app would add the event and another may not to the method then the event will be triggered only in some implementations anyway - only those which have the event. Am I correct?

waldo1001 commented 2 years ago

If the pattern is about reuse of the events I fully agree that is something worth to do. I just was little confused about interface in this - since one app would add the event and another may not to the method then the event will be triggered only in some implementations anyway - only those which have the event. Am I correct?

The intention of the pattern is to make it possible to create a new interface implementation (in a dependent app or whatever), and still being able to respect the events .. does that make sense? afaik, there is no way to FORCE that use of the events in the new implementation.. .