MVC and Descartes

One of the first software development books I ever read was on iOS development. In this book(I long ago threw it in the trash), I learned about the MVC design pattern. I was quite excited about this pattern as it would give me a more elegant way to structure my code. I didn’t realize it at the time, but the book errored when it explained the Controller’s role in this pattern. In short, I wound up with the false understanding that the Controller should contain an application’s domain logic. A couple of years and a few applications later, I picked up another book, Cocoa Design Patterns. It was from this book that I came to realize I had been implementing the pattern incorrectly. Thus began a two-year expedition to refactor and correct the projects I had worked on where I had incorrectly implemented the MVC pattern. (Now you know why I threw the book away)

MVC as defined in Cocoa Design Patterns

  • Model – Models contain all of the rules for processing application data. The Model is the key subsystem that makes an application valuable. It’s critically important that the Model subsystem is able to stand alone without dependencies on either the View or the Controller subsystems.
  • View – The View subsystem presents information gathered from the Model and provides a way for users to interact with information.
  • Controller – The purpose of the Controller is to decouple the Model from the Views. The Controller also handles translation and formatting for presentation to the user.

Fast forward a few years… 

I recently read René Descartes’ Rules for the Direction of the Mind. In this work, Descartes lays down various rules for conducting one’s thoughts and for finding solutions to problems.

Let’s take a look at Rule 2:

  • Only those objects should engage our attention, to the sure and indubitable knowledge of which our mental powers seem to be adequate.

I conjecture that the author of the iOS development book may not have possessed the adequate mental powers needed to write the book. Admittedly, this realization isn’t always an easy thing for people to grasp or admit to, but doing so has the potential of saving yourself and others much sorrow.

Let us continue reading rule 2:

  • …Further, because they have believed that it was unbecoming for a man of education to confess ignorance on any point, they have so accustomed themselves to trick out their fabricated explanations that they have ended by gradually imposing on themselves and thus have issued them to the public as genuine…

Well, that’s a fine kettle of fish, isn’t it? I conjecture that the author of the iOS development book could either be the source of this error or perhaps was a receiver of this error from someone else. Obviously, I definitely received the error since I included it in my code.

Are there any other possibilities? I’m sure there are, how about this one?

I conjecture I did not have enough programming background when I read the iOS book and misunderstood its meaning. I have to consider this conjecture since I have forgotten the title and don’t recall the exact language it used to describe MVC. However, I don’t think this is the case, but I need to entertain the possibility that I could be wrong.

There are also, of course, perhaps other possibilities…

Reflection: As I continue to think back on what went wrong in my understanding of MVC, it may be what wasn’t said about the Model in the iOS book that was the most profound cause of my confusion. The iOS book, as I recall, placed the greatest emphasis on the Controller but put less emphasis on the Model, whereas the Cocoa Design Patterns book placed a great deal of emphasis on the importance of the Model.

Reflection: When I learned this pattern, I shared it with at least one colleague. I remember they were just a bit skeptical when I explained the controller portion to them, but since I had read it in a book, they passed it off and didn’t question it any further. 

Reflection:  I should have consulted other sources as the consequences for getting something like this wrong are far-reaching.

Reflection: I wish I had read Descartes as well as a few other authors when I was younger.

Reflection: Why don’t schools teach the trivium and introduce young minds to authors like Descartes? The author of Weapons of Mass Instruction thinks he knows why.

Reflection: I forgive the author of the iOS book. If this is you, and if you haven’t done so already, please pick up a copy of Rules for the Direction of the Mind.