codex-lv3-may-2025

Mini Project: Refactoring with Pure Functions

Objective

Revisit your capstone project and refactor it by extracting logic into pure functions. This project will help you practice writing testable, reusable code using Vitest.


Assignment Overview

You will identify opportunities in your capstone project to extract logic into pure functions, write comprehensive tests for those functions, and integrate them back into your project. This assignment combines testing skills with refactoring practices.


Instructions

Step 1: Review Project Requirements

📋 Read the complete requirements: Project Requirements Guide

Step 2: Set Up Testing

Step 3: Identify Refactoring Opportunities

Find at least 3 ways to refactor by creating pure functions. Look for:

Step 4: Plan Your Functions

For each function you plan to create:

Step 5: Create and Test Functions

Step 6: Integrate Functions into Project

Step 7: Additional Testing


Required Deliverables

Submit the following through Moodle:

  1. GitHub Repository Link
    • Your capstone project repository
    • Include all refactored code and test files
    • Make sure the repository is public or shared with your instructor
  2. Test Files
    • Show your test files with comprehensive test coverage
    • Include screenshots of all tests passing (green)
  3. Function Documentation
    • Document each function’s inputs and outputs
    • Can be in code comments, README, or separate documentation file
  4. Before/After Comparison
    • Show the old code (before refactoring)
    • Show the new code (using pure functions)
    • Explain what was improved
  5. Reflection (3-4 paragraphs)
    • What functions did you extract and why?
    • How did writing tests first help you design better functions?
    • What challenges did you face during refactoring?
    • How did this improve your code quality?

Grading Criteria

Total: 100 points

Bonus Points (up to 15 points):


Resources


Tips


Success Criteria

Your project should demonstrate:


Questions? Review the project requirements guide or ask in the discussion forum.

Good luck! 🧪✨