This is the second post of Getting a Little Further Than Hello World With Rust series. We will write some Rust code with tests. In fact we will be practising Test Driven Design.
- We will start by writing a unit test and make sure it fails.
- We will write the code to make the test pass. Just enough code, nothing more.
- If there are any opportunities, We will refactor our code.
Rinse and repeat.
Rust has excellent documentation and these posts are not meant to replace the official documentation. I strongly suggest going through the links below, if you have not already done so, before/after/while reading these posts:
Rust has been around for a while but I have just recently found the opportunity to study it. It has some unique and powerful ideas and I intend to experiment further. This post summarizes the steps I have followed to install Rust toolchain on my Debian Stretch machine without admin rights.
A long time ago in a software sweatshop far, far away... Our code monkeys, haxx0rl33t and xXxDarkAssassiNxXx were furiously typing away to meet their deadline that was yesterday. The fact that it was dictated by non-technical people is irrelevant to our story. Our story is about the consequences of this artificial urgency for our code mon... developers.
Our esteemed colleague Mr. haxx0rl33t, is a results oriented fellow. To be more specific; the kind of person who would argue; assembly is as expressive as any so called high level language, because they are all turing complete. Code is purely a means to an end, triggering right side effects at runtime is all that matters. Therefore haxxy can’t care less about readability. Now, this may come as a surprise to you, but haxx0rl33t’s code occasionally has bugs.