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
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)
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
- https://blog.thecodewhisperer.com/permalink/clarifying-the-rule-of-three-in-refactoring
- https://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)
- https://truto.one/blog/zero-integration-specific-code-how-to-ship-new-api-connectors-as-data-only-operations
- https://www.mulesoft.com/cloudhub/iapps
Learning IT by Example.