title: Does MVC break encapsulation?
body: <p>Let's say I have an class to model a city. Its characteristics are the following:</p>
  
  <ul>
  <li>It has only two properties "name" and "population", both private, that are set in the constructor.</li>
  <li>It has getters for these properties, but not setters. </li>
  </ul>
  
  <p>I don't want any user of this class to set the properties, I want them to use a public .edit() method.</p>
  
  <p>This method needs opens up a form to input the new name of the city and population, i.e.: a view. Then, if I have a view, I would like to implement the MVC pattern, so the idea would be that the controller receives the .edit() call, renders the view, retrieves the data back, and sends it to the view so that it changes its state.</p>
  
  <p>But, if I do so, I have to change the properties of the city model from private to public. So, if any user instantiates my class, she/he can directly change the properties.</p>
  
  <p>So, the philosophical question: Isn't that breaking the encapsulation?</p>
  
  <p><strong>EDIT</strong> Just to make it more explicit:</p>
  
  <p>This <code>city_instance.edit()</code> method should be the only way to mutate the object.</p>
  
  <p>Besides, I see that part of my problems comes from the misunderstanding that a model is an object (you can read that on php mvc frameworks), when it is actually a different abstraction, it's a layer that groups the business logic (domain objects + I guess more things)</p>