Understanding Randomness

Learn about the effect of randomness on genetic algorithms.

Testing and improving your code

In the last chapter, we learned how to optimize your framework in three different ways to get the most performance out of Elixir and the BEAM. So far, we’ve created a framework for writing genetic algorithms capable of solving a wide variety of problems. One thing you haven’t done, however, is test and analyze this framework to ensure our code is correct and clean.

Testing is a crucial part of any development process. Typically, we’d want to write tests that mirror a specification or some behavior first before writing any code. This process, called test-driven development, calls for writing small unit tests first and then improving code to mirror a specification. Elixir emphasizes the importance of tests and makes the process of writing unit tests a breeze.

Get hands-on with 1400+ tech skills courses.