1 Rust’y Patterns


This chapter covers

  • What are design patterns?
  • What this book will cover
  • Why this book is different
  • Tools you might need

Reading this book is a great way to advance your Rust skills, whether you’re a beginner, intermediate, or advanced Rust programmer. If you’re a beginner, studying design patterns is an excellent path to elevate your skills above the basics of the Rust language. Design patterns are powerful abstractions which every programmer can leverage to produce high-quality code. Humans are excellent at pattern recognition, and when we follow well-understood and easily recognized patterns it helps us solve two tricky problems: it becomes easier to reason about whether or not a design is good or bad (i.e., following well-known patterns help us avoid creating bad code), and following patterns help other people understand your code.

Reading code is often more challenging than writing code. When we read someone else’s code, which follows well-understood patterns, it’s easier to reason about what the code is doing if we recognize the patterns. If you’ve trained your brain to recognize the most common patterns, judging code quality becomes much more manageable, resulting in fewer mistakes. We can leverage millions of years of evolution by teaching our brains which patterns to recognize and short-circuit the challenge of judging code quality.

1.1 What are design patterns?

1.2 What this book will cover

1.3 Why this book is different

1.4 Tools you might need

1.5 Summary