Choose more descriptive and/or realistic examples than `foo-bar-baz`
Thank you for a great effort on the patterns book. An enhancement suggestion. There are many good examples in the book that help to relate the patterns and their application. However, in some places there are classic foo bar and baz examples that, yes, show the intended interaction that the pattern tries to achieve, but get completely decoupled from the application. I think overall useful book looses quality with those examples. Compared to the official rust book where language features are exemplified on relatable structs and functions from real life i think that should be the standard for examples.
Concrete suggestion select more descriptive example for:
- Newtype pattern - https://rust-unofficial.github.io/patterns/patterns/behavioural/newtype.html
- Compose pattern - https://rust-unofficial.github.io/patterns/patterns/structural/compose-structs.html
Yes, I agree with you. PRs are welcome :)
@simonsan Can you assign this issue to me ? I'm eager to create PR to fix it
Sure :)
Both examples have been fixed now, but there are more to go, I would keep this open as a more general issue.
As someone who is new to patterns, I've found this book to be incredibly helpful, but I'm a bit puzzled about the 'Compose Struct' chapter compared to the 'NewType' pattern. Initially, when delving into the example code, I found it very similar to that of the NewType pattern. So, I thought 'Compose Struct' was about composing a struct using 'NewType' instances. Now I've come to realize that the 'Compose Struct' pattern is more about struct decomposition and borrowing each field independently rather than the composition through 'NewType'. So maybe removing the NewType from the example will be clearer.