Book Review: Best Practices Of Spell Design

Not too long ago, I put together a book review on the book Computational Fairy Tales. If you did not read my review, it`s a book which explains computer science through a medieval-ish story line. The author, Jeremy Kubica, wrote a sequel called Best Practices Of Spell Design. Whereas Comp(Computational Fairy Tales) teaches you about programming concepts and algorithms, Best Practices teaches you the best way to use those tools when designing software.

The Plot: Experienced wizard Marcus has a huge problem: A wizard called Hannaldous cast a spell on the castle, and while intending to create a magic shield around the castle, he accidentally puts it in the process of destruction. Marcus must now create a counter-spell, with help from his apprentice Shelly. As the book goes along, multiple software best practices are introduced.

Remarks: As a sequel to Comp, Best Practices remains in the same universe, and seems  to be a few months after the darkness is stopped in Comp. It personally taught me a lot of good coding habits that I would not find in most other coding books.

For example, I used to write an if statement like this:

if value == 3

But Best Practices taught me that to avoid accidentally changing the value, it’s safer to put the constant first such as:

if 3 == value

I also learned about unit tests for functions, and how it can help avoid errors.

Another thing I learned is refactoring, a form of optimization in which you change the structure of the code entirely, while keeping the same functionality. Before I learned about refactoring, whenever I wanted to add a certain functionality, I would just update the current structure, causing a lot of chaos. A better way is to use refactoring to restructure the code in a way to include the new functionality while keeping the code tidy and preserving the original functionality.

It also has a lot of references to Comp, such as Ivan mentioning Princess Ann`s apprenticeship under Breadstita. finally, it is packed with humor, which I love and believe should be essential to any fictional story.