Skip to main content

Naming and Function Refactor Workshop

Attempt these five tasks before opening feedback. Keep a contract, observation, candidate change, alternative and verification limit. These P tasks are required; extra lesson drills are targeted repair or optional depth.

P06: Rename without migrating data​

Rename process(d) from lesson 9 while retaining tuple rows whose id is index 0 and balance is index 2. List the extra work needed to move to attributes.

P07: Audit a misleading rationale​

A comment says three retries enforce four requests per second. Identify the missing temporal assumptions and write an accurate replacement comment.

P08: Extract with effects visible​

Compare the report snippets in lesson 10 on a one-shot iterator and on an exception during totaling. Record write ordering rather than assuming the extraction preserves behavior.

P09: Keep useful documentation​

Write a docstring for withdraw covering units, accepted zero, rejection, invalid input and unchanged-state guarantees. Explain why the name alone cannot replace it.

P10: Check published compatibility​

An exported method is renamed and the compiler passes. Name three consumers outside ordinary static call sites and propose a migration or compatibility plan.

Reuse lab evidence and record assistance. If a book gap remains, locate the topic through the Refactoring book index and the selective reading guide.