#324 Forward deployed engineer interviews 6 min
Customer Hack to Reusable Connector: Refactor and Measure
Three copied scripts, 33 repeated lines. One 16-line connector gave the same orders.
Change the page size
Copy the code folder first. In fakeapi.py change size=3 to size=2 in the get_page function. Predict whether the number of orders found for each customer will change. Run python run.py and look at the three lines that end with 'orders as the old script'.
A hint
The scripts and the connector both read pages until one is empty. I saw the same 5, 4 and 6 orders.
Break the paid test for one customer
Put the page size back. In connector.py change "PAID" to "OPEN" in the entry for acme. Predict what run.py will print and whether it will check the other two customers. Run python run.py.
A hint
The run compares the connector with the old script and stops at the first difference. The old script still keeps the PAID orders.
Add a fourth customer as data only
Put "PAID" back. In fakeapi.py add this entry to DATA: "dave": [{"num": n, "cost": n * 5, "open": n % 2 == 0} for n in range(1, 8)]. In connector.py add this entry to CUSTOMERS: "dave": {"id": "num", "total": "cost", "scale": 1, "paid": ("open", False)}. Predict which orders count as paid. Then run python -c "import connector; print(connector.run('dave'))".
A hint
Paid means the open flag is False. I saw 4 orders with ids 1, 3, 5 and 7 and pounds of 5.0, 15.0, 25.0 and 35.0. run.py now counts 17 connector lines.
These tasks are for you to try on your own machine. Nothing is checked or saved.
What this does not show
Made-up customers and API; 'repeated' means identical lines of text; the connector holds only differences that fit in data, and some customers would need code.
Up next in Forward deployed engineer interviews
More in Forward deployed engineer interviews
- #302 Forward Deployed Engineer Interview: What Is Tested
- #303 The FDE Decomposition Round: Vague Ask to a Plan
- #304 Scope an AI Pilot: Metric, Baseline and Stop Rule
- #305 Retry a Flaky API Without Duplicates: Idempotency Keys
- #306 Webhooks Done Right: Signatures, Retries and Replays
- #307 Schema Drift: Map a Customer's Data and Catch Changes
Related videos
- #329 Build, Configure or Vendor? Score It and Stress-Test Forward deployed engineer interviews
- #171 TDD With an AI Assistant: Red, Green, Refactor (unittest) AI coding and productivity
- #302 Forward Deployed Engineer Interview: What Is Tested Forward deployed engineer interviews
- #303 The FDE Decomposition Round: Vague Ask to a Plan Forward deployed engineer interviews
