Featured post
c# - to pass data around using event handling -
anyone can detail pros , cons pass data 1 class using event mechanism? when best time use event pass data?
let's take example. have system 20 people subscribed weather station changes in weather. want weather station keep track of people , services subscribed?
in opinion weather station should not know people or services waiting weather changes. weather station should dispatch event, , whoever listening notified :-)
so point is, use events notify observers action or state change occurred in object. observers can difference type of objects since don't have know them. if listens object, takes care of it.
if 1 one relation , object waiting happen of same type, wouldn't need event case.
events great decouple systems, seen in example above weather station. weather station can run on own without knowing services or users listening it.
- Get link
- X
- Other Apps
Comments
Post a Comment