princes-theatre-challenge

Prince's Theatre Challenge

View project on GitHub

🏡 Home > 📍 Project Github Page

Prince’s Theatre Code Challenge

Status: Submitted for Review-1

This project is part of a Code Challenge that demonstrates Full Software Development Lifecycle (FSDL) for iOS mobile applications. It shows end-to-end development activities from inception, to analysis, design, development, unit testing, UI testing, test automation, documentation and delivery. For this project, requirements are set for a fictional client - Prince’s Theatre Movie Finder Services.

About the App

Architecture

Movie Finder App congregates information about movies from various movie-services providers. It, then, displays movies details and prices comparison - sorted from low to high. The design incorporates SOLID concepts, which allows new service providers to be added easily. The current implementation, iteration-1, contains 2 service providers: 1) Cinema World; and 2) Film World.

It uses latest (to date) technologies for iOS development: Swift 5, SwiftUI, Combine framework, and Test/Behaviour Driven Development (using Quick/Nimber frameworks).

Features - Iteration-1

Prince's Theatre I-1

   
Swift 5.3, iOS 14.2 Swift UI, Auto Layout
Combine Framework /w Merging Multiple Publishers TDD/BDD with Quick/Nimble
MVVM REST api over secure HTTPs
Support multiple movie-finder service providers Network error-handling with Combine Framework
Git Git Flow
Unit Test UI Test and Test Automation
UI support both iPhone/iPad and light/dark modes UI support both Portrait and Landscape modes
Code Coverage of 89.7% Full git commit history

Installation & Setup - What you need?

At minimum:

  • Macbook with at least 16GB of RAM
  • Mac OS 11.0.1
  • Xcode 12.2

    • iPad Pro 11” 2nd Gen Simulator
    • iPhone 12 Simulator
  • iOS 14.2
  • Apple Developer account

Tools & Dependencies

  • xcpretty - For generating test reports
  • xcrun & xccov - For generating Test Coverage from CLI
  • Xcode Build (xcodebuild) - This is CLI from Xcode
  • make
  • curl - cURL util for testing interface to API

To install xcpretty:

$ sudo gem install xcpretty

xcrun and xccov are part of Xcode CLI tools. They can be installed and reinstalled using:

$ xcode-select --install

Building the Project

First clone this repo from Github.

Project Source Code

$ mkdir SOME_PROJECT_DIR
$ cd SOME_PROJECT_DIR
$ git clone git@github.com:primecoder/princes-theatre-challenge.git

Next, build initial project with the Xcode. If you have multiple versions of Xcode, make sure to select the correct one. Use xcode-select to list and set the correct version of Xcode.

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

Verify the location above is correct. To change, use xcode-select -s option.

Next, deploy the app to the simulators or devices.

NOTE: you will not be able to run the app at this point. See: “Preparing Access to API Endpoints” sectioin below.

Project Organization

First, the configuration directory. It must be outside the git repo - i.e. not checking in with git.

prices-theatre-challenge.env    <-- YOU need to create this dir
└── api.conf                    <-- YOU need to put API key here

Below is the project home directory. It is maintained within the git repo.

prices-theatre-challenge        <-- This is a project HOME directory
├── Makefile                    <-- For CLI build, test, ui-test, and automation tasks
├── doc                         <-- Documentation & resources
│   └── res
├── journal                     <-- Blog, journaling, keep track of progress
│   └── 2020
│       └── 12
├── requirements                <-- Original requirement doc
└── src                         <-- Source dir
    └── apple
        ├── i-0                 <-- Prototype i-0
        └── i-1                 <-- Current implementation of Xcode project

Preparing Access to API Endpoints

First, obtain API_KEY.

Put the API Key in api.conf above.

# File: api.conf
export API_KEY=<YOUR API KEY HERE>

File api.conf is used by Make util to test access to API endpoints.

$ cd PRJ_HOME
$ make test_apis

You should see that it displays JSON contents from the movie service provider.

Next, you will need to put this API key on the device and on each simulator that you want to run the app.

iPad Settings

Re-run your app again, you should see application main page displaying a list of movies, similar to the screenshots shown here.

Test! Test! Test!

This project is Test Driven Development (TDD). It goes further and beyond using Behaviour Driven Development (BDD) using Quick and Nimble frameworks. For more information, see references below.

All Unit Tests and UI Test Automation are driven using make targets.

$ cd PRJ_HOME_DIR
$ make clean test_all

To re-run all test cases, do:

$ make test_all

Test results are stored in PROJ_HOME_DIR/src/apple/i-1/MovieFinder/test-out directory. See test reports from Iteration-1 here.

I-1 Test Coverage

To clean up all the build artefacts, do:

$ make clean

Source Code Repository Management

  • Use Git Flow
  • Main

    • This is a main branch which contains the latest stable code
  • Main > develop

    • This branch contains latest development work
  • Main > develop > i-0

    • This branch contains the prototype work on project evaluation and inception stage
  • Main > develop > i-1

    • Current development

Known Issues & Workaround

  • Simple Retry Error Handling
  • UI Layout Cluttering on small devices
  • Assumption: all providers share the same data structure (model)

Simple Error Handling

Iteration 1 implementation offers simple error handling using Combine’s Retry on the merged streams of publishers. Currently, the merged stream is retried upto 3 attempts. After 3 attempts, the program fails gracefully and allows a manual reload as a workaround.

Repetitive load-tests of 2 simulators running concurrently has shown that tests are success at over 90%, i.e. failed 1 in 10 repeatitive tests.

Possible improvement:

  • Perform delayed retry, i.e. add a delay before each retry to avoid flooding server
  • Perform delayed-retry only on the failed publisher (not on the merged one)

UI Layout Cluttering on Small Devices

On small devices, i.e.iPhone SE, the UI elements are cluttered together. This needs more work and better design or even separate design/layout for these small devices.

Providers Share Same Data Structure

Iteration-1 assumes that all providers are using the same JSON data structure. More work may be needed if this assumption is not true or changed in the future.

References

History

Thank you

Thank you for your time and interest on this exciting project.

-peace-

Ace 2020.12.13