Tuesday, 7 January 2014

Model-View-Controller

I have always had a problem understanding the Model-View-Controller pattern. Perhaps because I always thought the Controller should be in between the Model and the View. In reality, there are flows between all the different components.

Date and Time


One of the things that in my mind would be a perfect example is Date and Time. The reason that I think it is an excellent example, is the way the Model part is exceedingly simple, and the View part is exceedingly complex. The Model part is nothing more or less than a Long indicating the number of milliseconds since Jan 1, 1970 GMT. The View part is split up into years, months, days, hours, minutes, seconds, milliseconds, timezone, daylight savings time, leap years, and God knows what else. While the Model part is simple and convenient for a computer, the View part is complex, but required if you want your date/time to be meaningful to your users.


References


Wikipedia: Model-View-Controller
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

No comments:

Post a Comment