Essential Developer

View Original

S01E04: [TDD 🍅 3] Swift Closures and Recursion

Watch on YouTube

We begin the third tomato by sanitizing our FlowTest class. We refactor the tests by removing duplicated code, we talk about different ways for organizing the test setup code and we showcase the factory method for the creation of the system under test. These changes will prove very valuable as the project grows.

In the Flow class, we decided to solve the problem of progressing from one question to the next by using recursion.

Finally, we discussed the access control of the Flow class and we realized that only the start() method needs to be visible to the outside world, meaning the behavior of this class is being tested through this single interface!

Subscribe today to our Youtube channel and catch free new episodes every week and follow along the project's progress on GitHub.