Yesterday I talked about how to add uniqueness to a factory to solve flaky tests, but there's a related lesson that I think is worth exploring.
The original question as posed in the community was something like "How do I add more randomness to my system to prevent my factories from generating duplicates?"
That's an interesting question, and could be its own separate discussion, but for the purpose of this tip, I want to focus on the framing of the question instead.
A direct answer to the question as posed might have led to a solution that was more complex than necessary, or could have been a dead end entirely.
But re-framing the question to be about uniqueness yielded a very different solution.
This is just one specific example, but I bump into this myself all the time. I'll be working on a problem, and I'm searching the docs in one area, but finding nothing.
Then I'll think of it from a different angle (often after bouncing it off someone else, or even an AI chatbot), and suddenly the answer is right there in front of me.
Recognizing when you might need to frame a problem a different way is a great skill to sharpen, and can help you get unstuck more quickly.
Here to help,
Joel
P.S. Need that "someone else" to bounce a problem off of? I'm your guy!