Write good examples by starting with real code

103 · Julia Evans · July 8, 2021, 7:01 p.m.
When I write about programming, I spend a lot of time trying to come up with good examples. I haven’t seen a lot written about how to make examples, so here’s a little bit about my approach to writing examples! The basic idea here is to start with real code that you wrote and then remove irrelevant details to make it into a self-contained example instead of coming up with examples out of thin air. I’ll talk about two kinds of examples: realistic examples and suprising examples. good examples are...