Change the code as usual 2. Write a test that only passes after the change 3. Revert to before 1 4. Type the test again (copy/paste is cheating & invalidates the warranty of the exercise) 5. Make it compile by changing the code 6. See it fail 7. Change the code to make it pass — Kent Beck (@KentBeck) July 30, 2021 I literally did this for one afternoon (back in 1999, I think) and began to feel the difference almost immediately. I also happened to like that feeling, even though there were mo...| The Code Whisperer
Complicated code only creates problems when humans try to change it. When we try to change code, we spend energy understanding it, and so we label code “complicated” when it feels like it requires “too much” energy to understand. That’s why we design software: we organize code in a way that reduces the cost of understanding it. “Too many” if conditions represents just one way to write complicated code. Most of us don’t immediately grasp long chains or deeply-branching trees of...| The Code Whisperer
Limiting beliefs and unstated assumptions interfere with our performance. This is not a trifling matter. Here is yet another story of how that happens. TL;DR We often test a module by connecting it to a lightweight implementation of one of its collaborators, such as in-memory persistence. This works great for simulating happy paths, but it’s usually impossible to make an in-memory database fail the same ways that an SQL database would fail running on some remote server somewhere. This leads...| The Code Whisperer
A recent tweet caught my attention. The drawback of ‘contract’ as a metaphor is that it leads to discussion as to whether a party is right (conforms) or wrong (violates) instead of overall outcome (what’s the best way to make the system meet the needs of the stakeholders in our technical/economic context). — Nat Pryce (@natpryce) May 28, 2019 When I read this, one thought immediately came to my mind: are people really doing this?! And of course they are, because people relentlessly fi...| The Code Whisperer
At Øredev 2013, I asked managers to tell me what makes their job difficult. I spoke to one manager who told me that they face immense pressure on two fronts: from the board of directors to deliver more features more often and from the programmers to give them more time to refactor. I’ve heard dozens of stories like these over the years and I’ve found a trick that helps. It doesn’t resolve the problem, but it helps take a significant step in the direction of a resolution. Warning. You a...| The Code Whisperer