Do you avoid "UI" in event names?

Updated by Brady Stroud [SSW] 1 year ago. See history

123
<introEmbed body={<> No "UI" in event names, the event raiser should be unaware of the UI in MVVM and user controls The handler of the event should then do something on the UI. </>} />
private void RaiseUIUpdateBidButtonsRed() {
if (UIUpdateBidButtonsRed != null) {
UIUpdateBidButtonsRed();
}
}

❌ Figure: Bad example: Avoid "UI" in event names, an event is UI un-aware

private void RaiseSelectedLotUpdated() {
if (SelectedLotUpdated != null) {
SelectedLotUpdated();
}
}

✅ Figure: Good example: When receiving an update on the currently selected item, change the UI correspondingly (or even better: use MVVM and data binding)

Acknowledgements

Adam Cogan
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star