This post is part of my Book reviews series, where I share thoughts and impressions on the books I read.
Explanation of the Functional Programming side of Rust, its mechanics and implementation details.
Core aspects of FP are explained, as well as functionally-inspired principles related to code organization and architecture.
There is a good mix between staying at a reasonable level of the FP theory, e.g functors and monads are explained but not getting too much into the weeds.
As well, the author uses some very interesting, though complex at times, examples in order to showcase how to "think" functionally also in terms of refactoring your codebase.
You'll spend a large part of the book building an Elevator Control program, going from quick and dirty naive implementation all the way to a fully-featured modularized application suite.
👩💻🧑💻 Who is this book for?
Developers who have a Medium to Advanced working knowledge of Rust, and software development in general.
I would say you need to have worked with Rust 🦀 for at least 6-9 months seriously, before being able to make the most out of the book.
The author definitely knows their stuff, and there's a certain clarity of thought that went into the explanations, which I liked and found impressive.
Reading it felt like sitting next to an incredibly experienced software developer + architect, who's seen a lot in their professional life.
It's one of those books that forces you to write and compile the code yourself in order to see the results and properly think through them, and for me that's a good thing.
There are lovely tidbits of wisdom sprinkled all around the book, in statements such as "Don't let your programming style become a liability; practice defensive software development."
Sadly, the general low quality control of Packt Publishing is obvious in this book as well, with glaring typos and mistakes such as "A combinator more generator combines things" 😳
The font size could have been one size smaller, and the shade of black used for the code made darker; right now the book is not great to read in physical format.
At the start of every chapter there is a heading called "Technical requirements" which is in my view useless and can be completely removed.
🚧 Improvements I would suggest
There should be either terminal outputs or "assert" lines for most of the code example. Especially for the smaller code snippets, it would be nice to directly see the output.
I would also dial down a notch the "heaviness" of some of the code examples, and add more explanations in the form of line comments that detail some of the more complex usages.
At the end of each chapter, there is a Questions section; I would add right after the answers as well, instead of at the end of the book. Other publishers do this, and I think it's a better reader experience.
The chapter on Macros could be increased quite a bit, with probably 10 or so more pages of explanations and examples.
Whenever a new crate library is used in the example, I would have appreciate a paragraph explaining what it is and what it does, before actually showing the code.
For me personally, I would have loved an entire chapter where the authors shares their wisdom related to: organizing principles, how to start projects, how to refactor large projects, good practices, how to onboard new developers to Rust.
I feel that Andrew has acquired a lot of very good advice throughout his career, and we could all benefit more from it being shared, as it applies to Rust projects.
Even though one could expect more "functional" aspects to be detailed, judging from the book's title, I think it strikes a very good balance overall of offering a deep view of the functional-inspired aspects of Rust, how they can be used and implemented, and also important aspects to avoid or be careful with.
Thank you Andrew for the effort of writing it, and for sharing your learning with us 🙏