title: How to map objects with UI
body: <p>I have following class implementation (not complete, just to give an idea)</p>
  
  <pre><code>   public class MySwitch{
          Command command = Command.Red;
          public Command GetNext() {
              command = GetNext(command); // circular enum values
              return command;
          }
      }
  
  
  public enum Command { Red =0, Blue=1, Green=2}
  
  public class LED {
      public void Glow(Command command){
          this.setColor(ColorForm(command));
          this.Glow();
      }
  }
  
  public class Commander {
      public Commander(LED target, MySwitch source){
          this.LED = LED;
          this.MySwitch = MySwitch;
      }
  
      public void Execute(){
          this.LED.Glow(this.MySwitch.GetNext());
      }
  }
  </code></pre>
  
  <p>I want these objects to map to UI items. Consider, I have win form app where switch and LED are two panel where I want GDI to draw it. </p>
  
  <p>Issue is what is best way sync objects with UI elements. Options are:</p>
  
  <ol>
  <li><p>Create UI element inherited with panel and should contains one
  instance of object.</p></li>
  <li><p>Create UI element (say LEDUI) inherited from BO, and should
  contain container (panel) to draw and implement draw method using this.Color
  (LED for example) - this will lead to file cound 2* BO </p></li>
  <li><p>Keep UI element and BO separate and let presenter to be bridge
  between them.</p></li>
  <li><p>Implement method on BO itself to render  (assuming single UI) on winform. Since
  it cannot be added to winform directly, so create a <code>CustomForm</code>
  object which allows such elements (assume <code>IMyObj</code>) to be added, and
  call <code>CustomFOrm.Render()</code>, which eventually call render method of
  all childElements. Pretty same way Form and controls are rendered.</p></li>
  <li><p>Any other way</p></li>
  </ol>
  
  <p>In my opinion, point 2 is better way. Please suggest what pros and cons on different way of mapping BO with UI, and how to sync them. Game developers may have better understanding.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>My mistake, there could be many LED and switches. Each switch may be attached to many LED. Also the classes I have created is independent of UI. I don't expect solution to how to find the control and glow, but what is the best way to implement if you are given these classes and told to make a winform app, assuming u will least touch the classes as well as write minimum code, along with following standard way of UI development</p>