ta-training

Code Review

Goals

Process

Core Review Principles

Enforce, Don’t Code

Be Specific and Educational

Progress Over Perfection

Reviewer Checklist

Scope and Structure

Data and Error Handling

Code Organization

Dependencies and Environment

Security and Configuration

Code Quality

Style and Professional Practices

Common Review Scenarios

What to Look For

How to Give Feedback

Ask Questions

Suggest Alternatives

Explain Benefits

Celebrate Improvements

Sample Review Comments

Poor Feedback

Effective Feedback

The Review Feedback Loop

Student Code → TA Review → Student Revision → Final Approval

Keys to Effective Feedback

Managing the Process

Priority Framework

Critical (Must Fix)

  1. Security issues: Committed secrets, exposed credentials
  2. Reproducibility blockers: Missing Docker files, hardcoded paths
  3. Data correctness: Missing validation, improper error handling

Important (Address Soon)

  1. I/O separation: Mixed computation and file operations
  2. Type hints: On public functions and unclear parameters
  3. Configuration management: Hardcoded values, missing .env.example

Nice to Have (Follow-up)

  1. Documentation: Docstrings and README improvements
  2. Code organization: Function names, file structure
  3. Performance: Obvious inefficiencies in large data processing

Technical Focus Areas

Python Best Practices

Data Validation & Types

Environment & Dependencies

Configuration Management

When to Escalate

Immediate Escalation

Pattern-Based Escalation

Effective Escalation

Examples and Practice

Practice Exercise

Review this function and identify issues:

def process_survey_data():
    data = pd.read_csv('/Users/alice/Documents/clinic/survey_data.csv')
    
    print("Data loaded successfully!")
    
    # Remove invalid responses
    clean_data = data[data['satisfaction_score'] > 0]
    
    # Calculate statistics  
    avg = clean_data['satisfaction_score'].mean()
    dept_stats = clean_data.groupby('department')['satisfaction_score'].mean()
    
    # Save results
    results = {'overall_avg': avg, 'dept_averages': dept_stats.to_dict()}
    
    with open('analysis_results.json', 'w') as f:
        json.dump(results, f)
    
    print(f"Analysis complete! Average satisfaction: {avg}")
    return results

Discussion Questions

Remember: Building Professional Data Scientists

Every code review, every standard enforced, every coaching conversation shapes how students will approach data science throughout their careers. The habits they learn here will serve them for years to come.

Focus on developing student capabilities, not just delivering perfect code. Your role is to guide, teach, and model professional practices that will make students better collaborators and contributors in their future careers.