Skip to content

Instantly share code, notes, and snippets.

@98chimp
Last active August 29, 2015 14:17
Show Gist options
  • Save 98chimp/b699fed92d95ee171955 to your computer and use it in GitHub Desktop.
Save 98chimp/b699fed92d95ee171955 to your computer and use it in GitHub Desktop.
Week02 - D06 Questions
PART I
Q1. A.
MVC is perhaps the most prominent form of structural design pattern used by developers of iOS apps. The term MVC stands for Model-View-Controller with each word representing a key component of this design pattern. Model refers to all aspects of data representation and the logic for data manipulation. View refers to the visual layout of display elements as well as UI elements with which a user can interact (e.g., buttons, sliders, etc.). In the MVC construct, Model and View are to have no direct communication with one another and all responses to user input are to be coordinated by the controller which sits as an intermediary between Model and View. As such, the Controller can have a two-way communication with each Model and View independently from each other, and continue to play the crucial role of relaying user input for access to specific data and conversely coordinating the display of the data in the desired form in the View.
The implied purpose of this design pattern is that by having clean separation of concerns, Model and View can be manipulated or replaced indpendently of each other and with little impact on the overall functionally of the app.
Q1. B.
i) A doctor can have many patients: this implies the structure of the Model being made up of instances of the same Patient object with unique values for various properties (e.g., name, age, sex, medical history, etc.);
ii) A doctor should be able to see a list of all his/her patients.: this is the pure concern of the View and "how" the data is presented on a screen.
iii) When looking at a patient's file, we should have the patient's picture in the top left hand corner: Again, this is another exmaple of "what" and "how" the information is being presented and as such a View specific requirement.
iv) A doctor should be able to sort his/her patient list by last name, or by date of last visit: this invlves taking the user input through the View and relaing it to the Controller. The Controller in turn will translate this sort request to a sort command that is sent to the Model. The Model will respond by providing the Controller with a sorted list of patient data. Lastly, the Controller will relay this inforamtion to the View so that it can be presented in response to the user's command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment