When I get overwhelmed by the options of moving forward building something new, I remember to step away from the mess, assume the best developer in the world has built it, and I try to use it.
Today this actually helped me discover an interface I hadn't considered!
Howard Jing was the first person I remember who really got this pattern to stick in my brain, probably from pair programming with him and seeing how well it worked again and again.
Recently, in React, I was unsure whether I wanted to manage some state locally, in context
, or render-prop components. So here's what I did:
Step back - literally open a new file to sketch in
Assume it exists - the most thoughtful developer has built this thing you need
Use it - start writing your app with the best interface conceivable (it only needs the minimum amount of info, its fun to use, and it doesn't leak any details)
Now we have a clear way forward.
Doing that today, I realized I didn't need react context, nor the render-prop pattern. I could do what I needed in a custom hook. This is what my scratch file looked like: