Lab 03: MVC Implementation

Dr. Wong began the lab by asking who had already implemented MVC in their HW02 solution. Most people responded that they had. It seems this lab will focus on MVC and miscellaneous tips regarding HW03.

Concepts

  1. There are two approaches to implementing adapters in the context of MVC. Dr. Wong reminds us that, in the end, it all comes down to decoupling the view from the model.
    1. Every single event that the View can generate (each individual button press, etc.), gets its own individual adapter to connect it properly to the model.
    2. There is a single IAdapter interface, with as many method specifications as are necessary to capture all of the events generated by the View.
    3. Dr. Wong advocates a mixed approach, wherein semantically related functionality is grouped into a single adapter, and a Controller may instantiate and distribute more than one kind of these adapters. For instance, adding a ball and clearing all balls are somewhat similar in that they both manipulate the set of balls. Therefore, an IBallAdapter interface could specify the addBall and removeBalls methods. On the other hand, methods for updating and drawing the balls (updateBalls, paintBalls) based on a Timer tick may reside in an IUpdateAdapter.
  2. To get started on HW03, Dr. Wong recommends to hold off on fancy painting (He seems to mean painting that somehow varies with time (something that changes shape or rotates / etc.)). We’ll get to that later. Also, until you have your Balls correctly using various Strategies, it is recommended to just hard-wire your dynamic class loader to skip the whole process of dynamic class loading, and instead to simply return an instance of some concrete Strategy.
  3. Many HW02 submissions were still called HW01 in Eclipse. This is because SVN branching will only affect the SVN folder names, whereas Eclipse knows the project name based on metadata stored in the “.project” file. Be sure to rename the project inside of Eclipse after branching; otherwise Eclipse will overwrite the copy of HW01 that is on your computer.
After 25 minutes of lecture, it appears that we’re now just going to have independent work time for the rest of the lab.

Quotes

  1. Never delete something before its replacement works. In electrical engineering, they call that ‘make before break’” – Dr. Wong.

Resources

  1. Lab 3: http://www.clear.rice.edu/comp310/f12/labs/lab03/
  2. COMP-310 endorsed overview of MVC: http://cnx.org/content/m26104/latest/
  3. MVC Explained (in more detail, with picture): http://comp310.blogs.rice.edu/2012/09/11/mvc-explained/