Day 14

Today

MP4: Interactive Programming

Sit with your partner and discuss the issues raised in the “Getting Started” section. Bring course staff into your conversation as desired.

After you’ve come to a shared understanding, start generating project ideas and working on your written proposal (due at the end of the day today).

If your partner was unable to make it to today’s class session, you will set up and host the repo from your account. The proposal that you add to the repo and submit a link for on canvas can include up to three ideas for a project. Submitting more than one idea can get you instructor feedback on more than one possible MP4 direction. You can then discuss these possible directions with your partner when they are able to meet. If possible, this meeting should happen before Friday’s class.

Model-View-Controller (MVC)

Model-View-Controller is what is known as a software design pattern.

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into source or machine code. It is a description or template for how to solve a problem that can be used in many different situations. Patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system.

          -- Wikipedia article on Software Design Pattern

The Model-View-Controller design pattern (or MVC for short) is an extremely useful design pattern for a number of applications. The most common places that it shows up are graphical user interfaces and web applications. Most importantly it is ideally suited to the projects that you all will be doing for this mini-project. Here is a figure that shows the basic principles of the MVC design pattern.

a graph of the interactions in the model-view-controller design pattern

  • A controller can send commands to the model to update the model’s state (e.g. editing a document). It can also send commands to its associated view to change the view’s presentation of the model (e.g. by scrolling through a document).
  • A model stores data that is retrieved according to commands from the controller and displayed in the view.
  • A view generates an output presentation to the user based on changes in the model.

            -- Wikipedia article on Model View Controller
    

This decomposition has a number of extremely nice properties. At the highest level, the pattern allows for the writing of loosely coupled and highly modular code. This allows various components to be swapped out with minimal changes to the overall program.
We’ll look at an example program using the MVC pattern in a future class.