Learn BDD by Playing Dice — eBook

Systems Development

Hello, Ruby enthusiast! Hello, BDD enthusiast! I invite you to read, download, modify, clone, or do whatever you like with the book Learn BDD by Playing Dice!

This mini-book is a journey, line by line and test by test, using the Behavior-Driven Development technique on a very interesting project: simulating the dice in the game War!

I wrote this little book to learn BDD and RSpec, so I needed to cover something simple and, preferably, fun. Then I thought: Why not roll some dice? Why not roll the dice from the game War? So here it is: Learn BDD by Playing Dice!

The application we’ll build together uses two classes: Dice and WarDice. In the first chapter, I build the RSpec file for the Dice class and the Dice class itself side by side, step by step, until all the tests turn green.

In the second chapter, I continue development with the WarDice class, which simulates each die in the game War!

Finally, in the third chapter, I use the classes in a fun application made with Shoes. The philosophy of this book is to learn by making fun things. In one word: experimentation.

I hope you enjoy this simple but also very instructive book. The tests used in this book aren’t a definitive solution. They’re just some possibilities among many others. As I said, I wrote it to learn RSpec. You can send suggestions, clone the project, modify it, and code it another way. Who knows—maybe we’ll make version 2.0 of this book together :).

Here is the book:

You can download the complete source code for the application here:

http://github.com/valeriofarias/shoes-war-dice

You can download the complete book text and the source code for the book generator here:

http://github.com/valeriofarias/learn-bdd-playing-dice-book

If you prefer, you can also download the English version of the book:

http://valeriofarias.com/learn-bdd-playing-dice-ebook/