Update mechanism theory
<p>I write engineering applications at work in C# .NET. Often, these applications have complex update mechanisms, at least the I end up writing complex update mechanisms.</p>

<p>Can anyone direct me to some books or something where I can learn update theory? Should I spend my time learning about Recursive functions? Asynchronous updates? Binary Trees? Am I even in the parking lot to get into the ballpark?</p>

<p>I like using properties because they seem self contained and are easy and clean to bind to the WPF and silverlight gui's that I write and I like events because it seems like it reduces spaghetti, but I don't feel like my theoretical understanding of these things is very sound.</p>

<p>Thanks for the help!</p>

<p>Here is an example of the kind of thing I'm talking about.</p>

<pre><code>public delegate void ParentChangedEventHandler(object sender, EventArgs e);

public class Parent
{
    List&lt;Child&gt; Children;

    private double parentCoefficient;
    public double ParentCoefficient
    {
        get
        {
            return parentCoefficient;
        }
        set
        {
            parentCoefficient = value;
            ParentChanged(this, EventArgs.Empty);
        }
    }

    public double Chaos
    {
        get
        {
            double chaos = 0;
            foreach(Child child in Children)
            {
                chaos += child.ChildChaos;
            }
            return chaos;
        }
    }

    public event ParentChangedEventHandler ParentChanged;

    public Parent()
    {
        ParentCoefficient = 42;
        Children = new List&lt;Child&gt;();
        for (int i = 0; i &lt; 12; i++)
        {
            Children.Add(new Child(this));
        }            
    }
}

public class Child
{
    public double ChildChaos;
    private Parent parent;

    public Child(Parent theParent)
    {
        parent = theParent;
        parent.ParentChanged += new ParentChangedEventHandler(parent_Changed);
    }

    private void parent_Changed(object sender, EventArgs e)
    {
        ChildChaos = 0.5 * parent.ParentCoefficient;
    }
}
</code></pre>

<p>So, you'll notice that the child needs an update when the Parent class is changed, and then the parent needs to update when the child is changed. If I update the parent by registering it to an event in the child, it will update once for every child, when it should only update once all children have updated.</p>

<p>I'm sure some of you can come up with solutions to this particular problem, but please keep in mind that this is a simplified example. The real ones are much more complex.</p>

<p>I could really use some a book that covers the fundamental theory on this kind of thing.</p>
