The hard fast way to mastery
Tell me if this seems familiar.
Sometimes I need to add a feature, or piece of functionality, to my program. And this new feature or piece does X.
Doesn't matter what X is.
What matters is I can think of 3 different ways to code it. And I don't know which is best. If I had more experience in this area, maybe I would know the best choice. But I don't.
Seem familiar? I bet this has happened to you, too.
Most of the time, I just pick one. Because I have a deadline, or I just want to get X done, so I can move on to Y and Z.
But if I have extra time and energy invest... I'll often do something else, specifically. And it's made a DRAMATIC difference in my growth and a developer.
Here's what I do:
If there's three ways I think might work...
I do all three.
Yep. You heard me. I code all three ways. Even if it takes me all day, or longer.
Like I said, I often DON'T do this. Because it just takes a lot of time. The one thing I don't have enough of. So I don't do it a lot.
But when it's practical to do this... I code up three different solutions, for the three different approaches. (Or two, or four, or whatever the number is.) Make that many different versions of the program, essentially.
Once they're all done, and working... I compare:
- Which one did I implement fastest?
- Which one seems to work better?
- Did any end up having fewer new dependencies than the others?
- Any other differences worth noting?
In the end, I pick one to actually use...
And painfully, tragically, heart-shattering-ly... I throw the others away.
Was that a waste? Actually, no.
Because this was a rare opportunity to gain a lot of wisdom and knowledge very quickly. And I took advantage of that situation, to get all that benefit for myself. By writing each version, in succession, and evaluating how each solves the same problem... With the full context of each fresh in my mind...
This is more powerful than you might realize.
Because what it does is this: it trains you to UNCONSCIOUSLY recognize certain coding situations, and intuitively know the best way to solve them.
That naturally comes from experience, of course. But: if you do what I describe above, it will happen *much faster*.
And the difference is MASSIVE.