Refactor a Legacy Module with AI
Medium · AI-Assisted Coding · about 60 minutes
Asked at Meta, LinkedIn, Microsoft.
You're given a 300-line function that handles order checkout (validation, pricing, inventory and notifications all mixed together), with a few tests. Using an AI assistant, refactor it into clean, testable units without changing its behavior, then add one small feature that the old structure made hard.