Quick Index
Index

Accompanying Video


A video that accompanies the challenge is here....

Goals


To get more familiar with MVC.

While working on your MVC, also start absorbing concepts from our things to learn list from this chapter.

Problem Statement


This challenge follows this full example.

For this challenge we'll code an MVC application for model type "Quadrupler".

This challenge is a revision of the Tripler that triples a value (the "Full Example"). The quadrupler, as you might guess quadruples the value (i.e. "value = 4 * value")

MVC Coding Steps


  • Unzip 'tripler.zip' from the full example "complete example source code"
  • Rename unzipped directory from 'tripler' to 'quadrupler'
  • This will be your working directory for this challenge
  • You will only need to edit files (you won't need to add or remove any).
full example
  • Edit file "ui\view.html"
  • Revise "3x" to "4x" in html file
  • Change the id from "triple" to "quadruple"

Note: feel free to play with and tweak cosmetics of view
  • Edit file "ui\controller.js"
  • Edit method "newModel" method to use "Quadrupler"
  • Edit "attachEvents" to change the triple event and handler to be appropriate for the quadrupler
  • Rename the "clickedTriple" method to the correct handler name used in the edited "attachEvents"


Controller
  • Edit file "model\model.js"
  • Change the model (class) name to "Tripler" to "Quadrupler"
  • Rename the method "triple" to the appropriate name for the "Quadrupler"
  • Edit "toString" where it says "Tripler" to "Quadrupler"
  • Remove script lines...


Model
In this challenge you can test using the view, making sure it works.

In future challenges we'll be using automted unit testing.
Please zip up your entire "quadrupler" working directory into a ZIP file named in the usual way ("Assignment XX -- FirstName LastName.zip"
where "XX" is the assignment number and FirstName and LastName are your corresponding names in D2L).


ZIP


References