"Idiomatic Rust" by Brenden Matthews
I liked the book overall, and I'm very grateful and appreciative for the efforts of the author. But somehow the book feels confused as to whom is the reader that it targets, and to whom should it add most value.
This post is part of my Book reviews series, where I share thoughts and impressions on the books I read.
"Idiomatic Rust" is written by Brenden Matthews and published as the 1st edition in 2024 by Manning.
đź’ˇTopic
Writing Idiomatic Rust.
A collection of design patterns and best practices for the Rust programming language.
đź“–Content
227 pages divided into 10 Chapters with extensive code examples.
👩‍💻🧑‍💻 Who is this book for?
Rust programmers who have already a good experience in writing medium to somewhat complex Rust. I would say 3-6 months of serious practice with Rust would be needed at a minimum to really appreciate the content of this book.
đź‘ŤLikes
The chapter on Immutability (ch. 9) was very good, and I liked the explanations and points of view that the author shares.
đź‘ŽDislikes
I think using Linked Lists is not a great teaching example. Though I do understand why it is seductive as a teacher to use this data structure, with all its gnarliness around ownership that Rust will throw at you, I still feel that it's not very productive, particularly in a book format, to use Linked Lists as a teaching tool. The comprehensibility aspect suffers greatly, mainly because lots of code is required - which spills across many pages - and which is quite hard to track and grasp"all at once".
I found the first sections of 3.2 Functional Rust to not really add a lot of value to the book, especially considering how short the book is. Also, due to the fact that it continues to build on the already confusing Linked Lists example, it becomes hard to follow even for an experienced Rust developer; lots of intermixed concepts, taking a long time and much non-trivial code to get to a conclusion. I get it that Iterators are cool, but I feel the same conclusion could have been arrived at in a much more succinct and clear manner.
I also did not really find the purpose of section 4.6 on “Global state”, also not sure how that really qualifies as either an idiom or a design pattern? Most of the section is spent explaining how different crates in the ecosystem are implementing global state, which frankly is something that you can simply get from reading the intro example of each crate!
Section 5.1 is another one where I’m not really understanding the value add: there are several other books out there on macros, including a recent one from Manning as well (same publisher as this book); why would you spend 5% of an already quite short book to discuss and explain something that’s quite basic and/or is one of the first advanced topics that any serious Rust programmer would have already dug into?
This next point might seem like nitpicking, but I will mention it anyways because I believe details matter: for a book whose aim is to teach idiomatic Rust, having very non-idiomatic .expect messages like “unable to lock mutex” is definitely not cool.
As a final note, even though I like the trend from the serious software book publishers to go for more condensed formats and smaller page counts, I still feel that pushing authors towards writing such short books will lead to a general "dumbing down" of future developers. Sure, I get that most people don't want to read anymore, and publishers need to align with the market; unfortunately it's a sad reality of the times we live in, and I fell we're all losing in the long run.
🚧 Improvements I would suggest
For a potential next edition I would suggest a serious pruning for some of the more "basic" topics (e.g. Functional Rust, Global State, Macros), as well as the overly complex like using Linked Lists for the introductory examples.
Focus more on topics that are a bit more abstract but very troublesome in practice, e.g. Immutability, Antipatterns, Generics, Fast prototyping with Rust.
Generally, try to decide what's the experience level in Rust of the ideal reader, and aim to really add value exclusively for that specific type of reader.
🤔Final Thoughts
I liked the book overall, and I'm very grateful and appreciative for the efforts of the author. But somehow the book feels confused as to whom is the reader that it targets, and to whom should it add most value.
Even though there's a lot of good content and great views in the book, it generally misses the mark. It's neither dense or advanced enough to be truly valuable for the very experienced Rust developers, like e.g. "Rust for Rustaceans" by Jon Gjengset, but also not accessible enough like "Programming Rust" by Blandy et. all.
Probably this is an inherent challenge in the market segment of medium to advanced Rust books, in that it's not really clear where the demarcation is in terms of reader's experience. I do hope that as time goes by the authors and publishers will be able to narrow down in this aspect, and hopefully avoid being too generic and trying to hedge their bets by covering too many types of readers.