March 4, 2020

TDD by example: Evaluating an expression

pexels-luis-gomes-546819

TDD by example: Evaluating an expression

Test-driven design can be daunting at first. This book presents a moderately complex task – write a program that can read a mathematical expression like 2 + 3 * 5 and return its result.

The author explains each step with both tests and production code until the program can handle decimal numbers, multiple levels of parentheses and even symbols (like in x + 3).

It is said that the best way to learn something is to teach someone else

This is my attempt at teaching others test-driven design (hereafter TDD) in order to deepen my own understanding of it. 

In addition, I had often wished – at the beginning of my journey into programming – to read a book that would show how another programmer thinks and works through his or her mistakes.

Finding a subject was a problem for me, there are two opposite forces

I need something simple enough that I can focus on the TDD process instead of the actual problem to be solved, but I also need something complex enough so that it doesn’t get dismissed as a toy.

In this book, I have settled on something that I found moderately difficult in the first years of programming – evaluating a mathematical expression.

Conclusion

This is a code-heavy, hands-on book; just reading it without writing the code yourself might not provide the full benefit.

Special offer

TDD by example: Evaluating an expression

Only 4.99$ on Kindle!

Featured articles
Premium online guides

Related articles