I am new to event driven development, and I feel lost when I try to implement events that should pass the core/UI boundary.In my program I have the following (example in c#):UI.RuleForm   Core.RuleList     UI.ResultFormCell 1        Rule 1Cell 2        Rule 2Cell 3        Rule 3What I want is:when a RuleForm cell changes, it will update the corresponding rule in RuleList. And when the RuleList changes, the resultFrom will be recalculated from the rules.My current thought is that, in order to keep core logic separated from UI logic (i.e. core should know nothing about UI), core should then only generate events, but not processing events generated by others.So I have to create some kind of UI.RuleListWrapper which can process RuleForm change events, updating Core.RuleList. RuleList in term should fire OnChange events that UI.ResultForm can use.So in summary, my questions are:I want to know if my reasoning and purposed implementation is okay or not, which probably means: should a core module be able to process events generated by outside UIIs my separation some kind of mysophobia, or has it been done before.Are there other better approaches?
Event driven design and separation of core/UI logic
mvc;event programming;layers
What I want is: when a RuleForm cell changes, it will update the corresponding rule in RuleList. And when the RuleList changes, the resultFrom will be recalculated from the rules.My current thought is that, in order to keep core logic separated from UI logic (i.e. core should know nothing about UI), core should then only generate events, but not processing events generated by others.So I have to create some kind of UI.RuleListWrapper which can process RuleForm change events, updating Core.RuleList. RuleList in term should fire OnChange events that UI.ResultForm can use.Look up data binding in .NET.  That seems to be what you're after.  It's handled differently depending on whether you do WinForms or WPF, but the concepts are the same.Your idea on the approach you need to take is basically right, however you probably don't need a RuleListWrapper class (at least not in this specific case).  Through data binding your cell changes will automatically update the corresponding rule.  Then your rule can raise a property change event to be handled by your result form.Specifically, look up the System.ComponentModel.INotifyPropertyChanged interface for your rules.  If you're using WinForms, look up BindingSource for the UI, and for WPF just look up the built-in binding syntax.