🌱

Programming skills recovery plan

Phase 1: Environment Setup (Rule Zero)

Disable Copilot, Cursor, and LSP auto-complete in your editor before starting. Work strictly inside a basic terminal (vim, nano, or VS Code with all extensions turned off).

AI Tier Rules Enforced Across All Days:

  • Tier 0 (No AI / No Docs / Blank Editor): First attempt at all daily coding tasks and system design write-ups.
  • Tier 1 (AI as Code Reviewer Only): Paste your working code into AI only after completion for architecture/performance feedback.
  • Tier 2 (AI as Tutor): Ask AI to explain specific concepts (e.g., "Explain memory layout of OrderedDict vs dict in CPython") — never ask it to generate code.

Phase 2: The 7-Day Plan (Async Task Engine Project)

Day 1: Python Data Model & Custom Structures

  • Focus: Dunder methods, custom iterators, and memory.
  • Tier 0 Daily Task (3 hrs): Build PriorityTask and TaskBuffer from scratch.
    • Implement __gt__, __eq__, __repr__, and __len__.
    • Make TaskBuffer an iterator and context manager (__iter__, __next__, __enter__, __exit__).
    • Fix the chunked_stream bug from your diagnostic: handle non-indexable iterables (e.g., generators/streams) using itertools.islice.
  • System Design (20 min write-up, Tier 0): Caching Strategies. Write down the trade-offs between Cache-Aside, Write-Through, and Write-Behind. Compare LRU vs. LFU eviction.
  • Recall Check: N/A (Day 1).

Day 2: Advanced Iterators, Generators & Pipeline Processing

  • Focus: Generator pipelines, memory-efficient streams.
  • Tier 0 Daily Task (3 hrs): Build a streaming file parser log_event_stream(file_path) that reads massive log files, filters error events, and yields structured Task objects using generator expressions.
  • System Design (20 min write-up, Tier 0): Message Queues. Compare RabbitMQ (AMQP/broker-based) vs. Kafka (distributed log-based). Explain how at-least-once delivery causes duplicate processing and how to make consumers idempotent.
  • Recall Check (15 min, Tier 0): Re-implement chunked_stream from memory without looking at Day 1's code.

Day 3: Decorators, Closures & Metadata

  • Focus: Function wrapping, stateful decorators, metadata preservation.
  • Tier 0 Daily Task (3 hrs): Write the @retry_with_backoff decorator from scratch.
    • Must accept retries, initial_delay, backoff_factor, and allowed_exceptions.
    • Must preserve inner function signature using functools.wraps.
    • Build a stateful @rate_limit(max_calls, period) decorator.
  • System Design (20 min write-up, Tier 0): Rate Limiting Algorithms. Explain Token Bucket vs. Sliding Window Log. Calculate memory requirements for rate-limiting 1 million active users in Redis.
  • Recall Check (15 min, Tier 0): Write a context manager Timer using __enter__ and __exit__ that measures block execution time.

Day 4: Asyncio & Non-Blocking I/O

  • Focus: asyncio event loop, tasks, concurrency primitives.
  • Tier 0 Daily Task (3 hrs): Convert the task engine execution core to asyncio.
    • Build AsyncTaskRunner using asyncio.Queue.
    • Process tasks concurrently using worker loops (asyncio.create_task).
    • Handle task failure gracefully with asyncio.gather(..., return_exceptions=True).
  • System Design (20 min write-up, Tier 0): Databases & Indexing. Explain B-Tree vs. Hash indexes. Walk through what happens under the hood during a execution of a SELECT query with a WHERE on a non-indexed column versus an indexed column.
  • Recall Check (15 min, Tier 0): Write a stateful decorator that tracks total call count and execution time across function invocations.

Day 5: Multi-threading, Multiprocessing & Locking

  • Focus: GIL bypass, thread safety, IPC (Inter-Process Communication).
  • Tier 0 Daily Task (3 hrs): Build a CPU-bound worker pool for heavy task execution.
    • Use concurrent.futures.ProcessPoolExecutor for heavy compute payloads.
    • Implement a thread-safe ThreadSafeMetrics tracker using threading.Lock to monitor completed/failed jobs across threads.
  • System Design (20 min write-up, Tier 0): Consistency & CAP Theorem. Walk through CP vs. AP systems. Explain dynamic split-brain scenarios and how quorum mechanisms ($R + W > N$) prevent stale reads.
  • Recall Check (15 min, Tier 0): Write an async producer-consumer loop with asyncio.Queue from scratch in under 20 lines.

Day 6: Standard Library Deep Dive & Packaging

  • Focus: dataclasses, typing, pathlib, structlog setup, pyproject.toml.
  • Tier 0 Daily Task (3 hrs): Package the task engine into a standard Python project.
    • Write clean dataclass state schemas with strict type hints (Generic[T], Callable, Optional).
    • Add a CLI entry point using argparse or sys.argv to launch workers.
    • Create a minimal, working pyproject.toml file manually without scaffolding tools.
  • System Design (20 min write-up, Tier 0): Observability & Failure Modes. Define metrics vs. logs vs. traces. Explain how to prevent cascading failures using the Circuit Breaker pattern.
  • Recall Check (15 min, Tier 0): Re-implement your thread-safe metrics collector using threading.Lock.

Day 7: Testing & Memory Profiling

  • Focus: pytest fixtures, mocking async code, tracemalloc.
  • Tier 0 Daily Task (3 hrs): Write a full test suite for your Async Task Engine.
    • Use pytest and pytest-asyncio without external assistance.
    • Write fixtures for the task queue and worker pools.
    • Profile memory consumption of streaming tasks using Python's built-in tracemalloc module.
  • System Design (20 min write-up, Tier 0): Back-of-the-Envelope Calculation. Calculate required database storage, bandwidth, and cache RAM for a system processing 5,000 write queries per second with 1 KB payload sizes retained for 30 days.
  • Recall Check (15 min, Tier 0): Write @retry_with_backoff from scratch in under 10 minutes.

Phase 3: Weekly Verification Checkpoint

At the end of Day 7, take this timed 2-Hour Final Benchmark in a plain text file without documentation:

Task
Pass Criteria
1. Async Engine
Write an async batch producer/consumer queue that processes 1,000 items with max concurrency of 10 in < 30 lines.
2. Decorator
Write a parameterized decorator with exception catching and exponential delay from memory in < 15 lines.
3. System Design
Diagram and describe a distributed rate-limiting architecture handling 50k RPS on a whiteboard/paper in 15 minutes.

Phase 4: Long-Term Habits (Post-Plan)

  1. The 15-Minute Rule: When stuck on a bug or syntax issue, force yourself to debug manually using pdb/breakpoint() or print statements for 15 minutes before reaching for AI or search.
  2. Drafting Tier 0 First: Write core logic, complex data structures, and function signatures manually. Use AI only to generate boilerplate, write tests for existing code, or generate documentation.
  3. Weekly Unassisted Kata: Spend 30 minutes every Friday solving a medium algorithmic/data-structure problem in a plain terminal editor with Copilot disabled.
SuperMade with Super