Assignment title: Information
Creating Data-Driven Mobile Applications - Assignment 6 Page 1 of 4
ASSIGNMENT 6 - Model-View-Controller Pattern, App
Lifecycle
Graded as Pass / Fail, Individual Work
Due: Week 11
Objectives
1. Understand and employ the Model-View-Controller (MVC) design
pattern in iOS apps.
2. Understand the iOS app lifecycle.
Tasks
Task 1 - Separate Your Concerns, Part II
Good object-oriented design will help your code be resilient to changes,
new features, and portability. Apple uses the Model-View-Controller design
pattern as part of the UIKit framework on which most all iOS apps are built.
• Create a table view application that sources data from the Internet.
Your application should separate your data model, your control logic
and your display code following the MVC pattern. This will require
creating a class to represent your model. It is common to have this
model object handle interactions with the external data source, so you
should implement the NSURLSession protocols in your model class.
The controller and view parts of your application should not know
anything about where the data comes from and how it is retrieved.
Creating Data-Driven Mobile Applications - Assignment 6 Page 2 of 4
• The user should be able to refresh the data, which will involve making
another call to the Internet, updating the app's data and then updating
the table view. You could use a notification to signal from the model
class to the controller class that the data has been reloaded and so
the display should be refreshed.
• Write a short report (1.5 pages) explaining how you used the ModelView-Controller design pattern to implement your class structure and
communication between classes. Also discuss possible
improvements/new features to your application, and highlight how
your design will resiliently handle changes because of your proper
design. Specifically, imagine that you must now make your application
work offline, and you must now cache the data retrieved from the
Internet persistently. How does the MVC pattern help you add this
functionality to your existing design?
You may use code snippets and/or diagrams in your report (each snippet
or image counts as ¼ of a page), and must include a caption.
Task 2 - The Cycle of Life
iOS applications don't always live in the foreground. Applications can be in
the foreground, in the background or suspended, and active or inactive,
depending on the circumstances.
Imagine that you are asked to develop a 3D game for iOS in OpenGL (an
open standard for 3D graphics written in C). The game has levels,
multiplayer capabilities, and a global leaderboard (connected through the
Internet).
Creating Data-Driven Mobile Applications - Assignment 6 Page 3 of 4
• Create a diagram that explains what work your game will do when
transitioning between each of the application's states. Attention should
be paid to iOS requirements (e.g. iOS apps that use OpenGL in the
background will be terminated by iOS!). Your diagram must cover at
least the following possibilities:
1. User receives a text message in the middle of a single player
game
2. User receives a phone call in the middle of a multiplayer game
and decides to answer the call.
3. User closes the app with the home button in the middle of a
single player game.
4. User presses the lock button while on the Main Menu of the
application, outside of a game.
Write a short essay (1 page) explaining your diagram and design choices,
and what problems/issues you would expect when developing this
application in code.
Useful References
Apple's App Programming Guide for iOS, particularly:
Execution States for Apps
https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/
iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html
and:
Creating Data-Driven Mobile Applications - Assignment 6 Page 4 of 4
Background Execution
https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/
iPhoneOSProgrammingGuide/BackgroundExecution/
BackgroundExecution.html
Core/Extension Tasks
All tasks in this assignment are "core".
Submission
You are required to submit a printed report that adheres to the following:
• The header or footer must contain your name, student ID, and unit code.
• The document must have a title.
• Evidence that shows you completed each task must be presented in a
separate section.
• The document should NOT have a table of contexts or cover page.
Demonstration
You may be asked to demonstrate your assignment in the lab. You should
be able to do this and explain your code when asked in the lab session.