title: MVC - Model View Controller
body: <p>I am preparing a lecture about MVC, and what I found out is that there is not one MVC, but I found at least 3 of them (+ platform/tool variations). I would like the comments about the overall picture I created from reading the different source. (names "Classic", "Event" and "New" are mine, created to distinguish between them in discussion)</p>
  
  <h1>Classic MVC</h1>
  
  <p>I found out, that first MVS was invented by Trygve Reenskaug working on Smalltalk at Xerox in 1979. It was designed for static websites, and View was fully stateless. </p>
  
  <p>Loading page was directed to Controller, and it was using Model to get data and creating View to respond. View was then just creating a website from data. </p>
  
  <p>Changing data was also directed to Controller which were using Model to apply changes. Then it was sending back information to refresh the page or not. </p>
  
  <p>Example:</p>
  
  <pre><code>class Controller {
      val model = Model()
      fun getWebside(req: Req, res: Res) {
          val data = model.getData()
          val view = View()
          view.respond(res)
      }
      fun updateData(req: Req, res: Res) {
          val changed = model.getData(gataFrom(req))
          if(changed) askToRefresh(res) else res.ok()
      }
  }
  </code></pre>
  
  <h1>Event MVC</h1>
  
  <p>Another type of MVC that is often mentioned is connected (in my opinion) with early window development. Here View and Controller are holding references to each other. Which one is creating which one is a matter of framework. At the beginning, View is asking Controller for data (sometimes even View is asking Model for data but I am sure that it is not pure). Also often input is directed to View, but it is always passed then to Controller. When there is a request to change data then Controller is using Model to do it, and <strong>Model is sending Event when he finish is. These events are notifying the View. Using them View is updating itself.</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/yZMLn.png" rel="nofollow noreferrer">Example diagram of Event MVC</a></p>
  
  <h1>New MVC</h1>
  
  <p>The newest, and right now the most popular MVC is nearly the same as MVP, but Controller and View are not behind interfaces. View is contacting only with Controllers! No Events from Model to View. They can be reached by Controllers which are then changing View. </p>
  
  <p><a href="https://i.stack.imgur.com/xKcBb.png" rel="nofollow noreferrer">New MVC</a></p>
  
  <p>Am I correct? Maybe wrong? I would love all comments and opinions.</p>