Babbel Case Study

This is a case study which is a very simple word quiz game. In the case study, my main goal is to build a maintainable, readable and testable structure.

Installation

There is no any installation process. You need open BabbelCaseStudy.xcworkspace file then select App target and run.

Decisions

  1. In order to focus more on architectural design and patterns, I made the random word creation as simple as possible.
  2. The word list was chunked into four. I randomly select two from a set of four and present them to the user. This provi a 25% possibility without a doubt. It causes a problem for short word lists, though.
  3. The project include 2 additional helpers modules named as Common, Additions. Since these modules do not include any resources files, I prefer Static Linking/Library.

App Modules Diagram

Project Tech Stack

  • Xcode: Version 13.4.1 (13F100)
  • Language: Swift 5.6.1
  • Minimum iOS Version: 15.0
  • Design Architecture: MVVM-C
  • Tools: Swift Mock Generator
  • Style Guide: Raywenderlich
  • Powered by ❤️

Funtional

  • Random word pair
  • 5 seconds to attempt
  • Game end scenario
    • Max number of wrong attemts
    • Max number of word attempts
  • Quit game
  • Restart the game
  • Show score

Non-functional

  • 13 unit tests
  • Separation of Concerns
  • OOP approach
  • POP approach
  • Testability
  • Modular architecture approach

Nice to have

  • UI test
  • Implementing a dedicated module for QuizGame

Time investment ~12

  1. The architecture: 1h
  2. The modules: 30 min
  3. Word generator: 30 min
  4. Unit tests: 3h
  5. UI and animation: 2h
  6. ViewModel: 4h
  7. Readme: 1h
  8. Self code review 30min

Improvements, if spend more time

  • Fall down animation
  • Improvement of random word generator probablity to make it %25.
  • Additional edge cases
  • Detailed Error handling
  • %100 test coverage for QuizViewModel
  • Add Loading State, Empty State and Error State

Folder Structure

⊢ Common
    ⊢ Base
    ⊢ Provider
    ⊢ Reader
    ⊢ Timer
⊢ Additions
    ⊢ Foundation
    ⊢ UIKit
⊢ App
    ⊢ Scenes
        ⊢ API
	    ⊢ Model // Entity for API
            ⊢ Data // Words
	⊢ Providers
	⊢ ViewController
	⊢ ViewModel
	⊢ Coordinator

GitHub

View Github