Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Keep in mind, there are many variations on MVC and no real "right way" to do things. Ultimately, how you design your classes comes down to personal preference. However, since you asked for design advice, here are my two cents:</p> <p><strong>Business logic belongs in the controller. Keep it out of the model and view.</strong></p> <p>Out of the many variations on the MVC pattern, the <a href="http://martinfowler.com/eaaDev/PassiveScreen.html" rel="nofollow noreferrer">passive view</a> style seems to be the easiest to test. In the passive view, your classes are designed as follows:</p> <ul> <li><p>Your controller is "smart: it makes changes to the database, updates the model, and syncronizes the view with the model. Apart from a reference to the model and view, the controller should hold as little stateful information as possible.</p></li> <li><p>The model is "stupid", meaning it only holds the state of the view and no additional business logic. Models should not hold a reference to either the view or controller.</p></li> <li><p>The view is "stupid", meaning it only copies information from the model to the UI, and it invokes event handlers which are handled by the controller. The view should contain no additional business logic. Views should not hold a reference to the controller or model.</p></li> </ul> <p>If you're an MVC purist, then it would not make sense for the model to update itself or the database since those responsibilities belong to the controller, so it would <strong>not</strong> be appropriate to create an addView method to your Video class.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload