Combined Front End Submission Instructions
This document intends to provide a specification for submitting a combined submission of Assignments 1029 and 1114. Assignment 1114 was meant to build on the same repository as Assignment 1029 anyway, so this shouldn’t be too much of a stretch. The goal here is to make it easy—really easy—to switch between having a mock runtime API vs. a real one that makes real network connections.
- Work on Assignment 1029 (now due 1114) until it is finished.
- Work on Assignment 1114 until it is finished. (feel free to tweak the overall application as well)
- When completely done, prepare/copy/name your files as given in the following instructions.
- Don’t forget to verify that both versions of your application still work! (and that tests still pass)
iOS App Instructions
- Make sure that the code base has two runtime implementations of the
Apiprotocol. Call the hardcoded implementation
PlaceholderApiServiceand call the real request implementation
RealApiService. (you may place each implementation in its own file but due to how Swift handles files, this isn’t absolutely necessary)
- As submitted, your front end should use
- To switch from one implementation to the other, one must only exchange all
Apiimplementation instantiations within the app (not within tests). For example, searching and replacing
RealApiServiceshould switch from the hardcoded to the real request implementation.
- Tests should still pass (and use the proper mock implementation) regardless of what implementation is used at runtime.
Web App Instructions
- Make sure that each implementation alternative for your API functions resides in its own file. Call the hardcoded implementation api.js-placeholder and call the real request implementation api.js-real.
- Copy api.js-placeholder into api.js so that, as submitted, your front end uses the hardcoded implementation.
- To switch from one implementation to the other, one must only copy the desired implementation to api.js. For example, copying api.js-real as api.js should switch from the hardcoded to the real request implementation.
- Tests should still pass (and use the proper Sinon stubs) regardless of what implementation resides in api.js.