Exercise 1: Adding record_refund() to the Boundary-Free Version — Possible Solution ==================================================================== THE NEW FUNCTION, FOLLOWING THIS CHAPTER'S OWN PATTERN ------------------------------ def record_refund(order_id, amount): with open('refunds.txt', 'a') as f: f.write(f'{order_id},{amount}\n') Matches this chapter's own record_order()/record_payment() shape exactly - a direct open() call inside the business function itself, with no boundary between "record something happened" and "write it to a specific file." VERIFYING THE TOUCH COUNT ------------------------------ Scanning all four functions (record_order, record_payment, generate_report, record_refund) for the literal string open( using Python's own inspect.getsource(): touch count with record_refund added: 4 of 4 Every function, including the new one, contains a direct file-open call - the touch count grew by exactly one, matching the one new function added. WHY THIS CONFIRMS THIS CHAPTER'S OWN SCALING CLAIM ------------------------------ This chapter's own scaling demonstration showed the boundary-free version scaling exactly 1:1 as functions were added (3 functions -> 3 touches, then 6 functions -> 6 touches). This exercise adds one more data point at 4 functions -> 4 touches, confirming the same ratio holds - every new function that needs persistence in this codebase adds exactly one more place that would need editing if the storage technology were ever swapped. WHY THIS WORKS AS AN ANSWER ------------------------------ The new function follows this chapter's own established boundary-free pattern exactly, and the resulting touch count is verified directly via the same inspect.getsource() technique this chapter already used, rather than only asserted to match the expected 1:1 ratio.