MVC from a Java perspective.

I’ve been asked to explain this concept on a pretty regular basis by non-programmers… to a visual ‘presentation’ developer, this is essentially the same reason a person would chose to use CSS with HTML (to seperate data from presentation), only it goes a bit further…

  • Controller – extends HttpServlet, acts as the point of entry into the application, and delegates to various worker classes to fulfill a request. In particular, the Controller is a user of Model and View objects
  • Model – data-centric classes encapsulating problem domain objects. Each class corresponds roughly to the rows of a database table. Model objects can be constructed from a ResultSet of a database query, from user input, or from user request parameters.
  • View – implemented as Java Server Pages (or a similar tool), primarily concerned with presentation and formatting of Model objects which have been placed in scope by the Controller (or its delegate)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.