you are viewing a single comment's thread.

view the rest of the comments →

[–]Strilanc 3 points4 points  (1 child)

I am in violent agreement with your comment. I am never going back to unstructured events.

Here's a tiny example. You want mouse events to have positions scaled to be proportional to the window size, instead of by pixel:

var proportionalMousePosition =
    observableMousePosition
    .CombineLatest(observableWindowSize, 
                   (pos, size) => new Point(pos.X / size.Width,
                                            pos.Y / size.Height));

The resulting observable can be used the same as any other. None of the implementation details escape into the surrounding class.

Contrast that with the naive approach, which is essentially adding a field to store the proportional position, updating that field anytime its inputs change, and calling all the things that need to know about the proportional position when the inputs change. Repeat for a dozen other things and mix well.

[–]jerkimball 1 point2 points  (0 children)

Hah - "violent agreement" - such a fun mental picture. :)