Plotting the Course vs. Bushwhacking
I know that I should think things through before I start working on a problem, but that doesn't seem to stop me from doing it right now. I understand perfectly that if I think things through, I might be able to solve the problem with less effort, but for some reason I have ingrained in my head the idea that I can just hack on something and will figure it out as I go.
This mindset served me really well in the first year of development or so, but has not served me particularly well as I transition from junior to mid-level developer. I feel like part of being a more competent engineer is the ability to think about things, not just "do" them. It moves from "make the widget" to "think about how you would make the widget, then make the widget". The added step seems trivial, but for my mind, it's anything but.
Today, for example, I knew what I had to figure out:
- Goal: get app host/domain configuration from somewhere else
- See if the store contains the context that we need, try to use that
- See if we can generate a similar redux-esque store within our application.
But for some reason, my main actions ended up being:
- Smash on this configuration until I can inject some weird thing that has an arbitrary value
- Fix some deprecated function calls
- Debug those function calls
- Go into a utility library to see if that has any solution to my problems
- Bang on the app again until I get a somewhat working state
- Go to the first step.
I did this for 5 hours and ended up with a working product, but here's the cost:
- I don't fully understand the solution that I've made
- The codebase is now littered with trash since I've polluted it with my hackings and half-assed attempts. A service here, a selector somewhere else, it's all just a spaghetti.
- I now have less time to implement the correct solution.
That being said, my pros are that I have a working product, and I can look at the solution to see why it works, but it will take more time. I'd really like to rid myself of this habit, and writing about it seems like a decent first step.
If you have any tips, definitely let me know! I'd love to hear.