learning-it by example

Back to the video

Customer Hack to Reusable Connector: Refactor and Measure

Three copied scripts, 33 repeated lines. One 16-line connector gave the same orders.

Video #324 ยท Forward deployed engineer interviews

Steps in the video

  1. 0:00 Three customer scripts, 33 repeated lines, and one connector that replaced them
  2. 0:34 The idea
  3. 1:09 Setup
  4. 1:39 Acme's script
  5. 2:05 Cara's script
  6. 2:35 One connector
  7. 2:58 Measure it
  8. 3:19 Same results
  9. 4:03 What this does not show
  10. 4:38 Mistakes to avoid
  11. 5:03 My take and next steps
  12. 5:32 Recap

Files

  • connector.py (20 lines)
  • fakeapi.py (15 lines)
  • hack_acme.py (17 lines)
  • hack_bobs.py (17 lines)
  • hack_cara.py (17 lines)
  • measure.py (16 lines)
  • run.py (18 lines)

Download the code (zip)

Tested with

Python 3.12.15

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.

Sources

Learning IT by Example.