Skip to content

blurxy/bytebites_tinker_activity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ByteBites Tinker Activity - Week 3

Project Overview

This project implements the core architecture for ByteBites, a campus food ordering app. The system uses Python classes and simple algorithms to manage customers, menu items, transactions, and order processing.

Project Structure

bytebites_tinker_activity/
├── CLAUDE.md              # Custom agent configuration
├── bytebites_spec.md      # Client feature request and candidate classes
├── bytebites_design.md    # Final UML class diagram
├── models.py              # Core implementation (4 classes)
├── test_bytebites.py      # Test suite
└── README.md              # This file

Implementation Checklist

✅ Part 1: System Design (UML and AI Collaboration)

  • Set up working environment
    • Created bytebites_tinker_activity folder
    • Initialized Git repository
    • Created initial commit
  • Created spec file (bytebites_spec.md)
    • Copied Client Feature Request
    • Identified 4 candidate classes
  • Configured custom agent (CLAUDE.md)
    • Added metadata (name, description, tools)
    • Wrote behavior instructions
  • Created final UML diagram (bytebites_design.md)

✅ Part 2: Code Implementation

  • Created models.py with all 4 classes:
    • Customer - manages name and purchase_history
    • FoodItem - stores name, price, category, popularity_rating
    • Menu - manages items collection
    • Transaction - stores items and calculates total
  • Added class scaffolds with constructors
  • Committed implementation

✅ Part 3: Algorithmic Enhancements

  • Implemented core methods:
    • Menu.filter_by_category() - filters items by category
    • Menu.sort_by_popularity() - sorts by rating (descending)
    • Menu.sort_by_price() - sorts by price (ascending)
    • Transaction.calculate_total() - computes order total
    • Customer.add_purchase() - tracks purchase history
  • Tested methods manually
  • Committed algorithmic methods

✅ Part 4: Testing and Validation

  • Created test_bytebites.py
  • Implemented test cases:
    • test_calculate_total_with_multiple_items - happy path
    • test_order_total_is_zero_when_empty - edge case
    • test_filter_menu_by_category - filtering logic
    • test_sort_by_popularity - sorting by rating
    • test_sort_by_price - sorting by price
    • test_customer_purchase_history - purchase tracking
  • All tests passing (6/6)

The Four Core Classes

1. Customer

Manages customer information and purchase history.

customer = Customer("John Doe")
customer.add_purchase(transaction)

2. FoodItem

Represents menu items with details.

burger = FoodItem("Spicy Burger", 10.00, "Main", 4.5)

3. Menu

Manages the collection of food items.

menu = Menu()
menu.add_item(burger)
drinks = menu.filter_by_category("Drinks")

4. Transaction

Handles orders and calculates totals.

transaction = Transaction()
transaction.add_item(burger)
total = transaction.calculate_total()  # Returns 10.00

Running Tests

python -m pytest test_bytebites.py -v

Test Results

✅ test_calculate_total_with_multiple_items PASSED
✅ test_order_total_is_zero_when_empty PASSED
✅ test_filter_menu_by_category PASSED
✅ test_sort_by_popularity PASSED
✅ test_sort_by_price PASSED
✅ test_customer_purchase_history PASSED

6 passed in 0.01s

Design Decisions

  1. Simplicity First: Avoided over-engineering; focused only on required features
  2. Clear Responsibilities: Each class has a single, well-defined purpose
  3. List-based Storage: Used Python lists for simplicity (no database)
  4. Functional Methods: Menu sorting/filtering returns new lists (non-mutating)
  5. Comprehensive Testing: Covered both happy paths and edge cases

AI Collaboration Workflow

This project was built using AI as a design partner:

  • Used AI to generate UML diagrams
  • Reviewed and refined AI-generated code
  • Verified all outputs against the specification
  • Made final decisions on implementation details

Next Steps (Optional Enhancements)

  • Add validation (e.g., price must be positive)
  • Implement menu item search by name
  • Add transaction date/time tracking
  • Create a simple CLI interface

Course: AI110 | Foundations of AI Engineering Week: 3 Activity: ByteBites Tinker Status: ✅ Complete

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages