TDD — Lookahead Refactoring

In this article, I want to consider a situation where considering the next test we want to write, influences the way we refactor.

aaatomo1.jpeg

For this article, I want to consider implementing a simple function to check if a number is odd or even. The function will simply return true if it’s given an even number, and false if it’s given an odd number.

As with my previous TDD articles, we are working very rigidly with the TDD cycle — we must write a failing test, we must implement it in the simplest way possible, we may then refactor… Continue

Are your ready to accelerate your Cloud Native journey?