Many moons ago, we recorded an episode of Kodsnack on frustrations and how to get past them. Today, I once again stared into the face of the fact that I have absolutely no clue whatsoever when it comes to being certain kinds of stuck in code.
The situation is pretty typical for me and this type of Stuck. I am working within a large-ish code base of which I have a general grasp of the whole and good knowledge of certain parts, but I know there are ocean-wide gaps between my islands of knowledge. I am trying to add something new. I look around, I see various things which work very much like parts of what I want to do, but I also find that the whole of my new feature is rather unique.
I dig into the things which look like candidates for being reused, extended or mutated into parts of my new thing, and I see lots of code and flow which fits quite firmly into those gaps I mentioned. I can tell what is going on, but it is not at all clear to me which parts are more or less important, or if there are flows and thoughts I am unaware of. Things like that lead me to think that I will perhaps be better off building on top of the existing components, keeping them the way they are and adding my feature on top. That looks like a clean (as in not messing up too many other things at once) way of getting a first version of the feature which can then be iterated over and improved as needed.
However, it also becomes clear pretty quickly that some components are not intended to be built on in the way I intend to do it. Imagine using some GUI widgets as part of a new GUI widget, only without showing their UI. Something like that, clearly a semi-gross violation of their intended use.
Being me, I look at the bits and set off experimenting. I make little changes here and there, build the experiment on top and start running into snags. My wish to get something working quickly is being hit hard in the side by running into problems which may or may not be caused by me actively mis-using components which expected to be left to lead a peaceful existence in the countryside, serving their original purpose and being generally left alone.
It seems clear that the Right and Pure thing to do would be to start over, creating a new component from the ground up (as in: copying, pasting and modifying code wildly while leaving the originals alone) and look at re-integrating changes and removing duplication one something actually works. But here, too, my feeling of not grasping the entire code base comes back to spook me. I know that restarting like this would add time before I had something working to play with and adjust course from, and I have absolutely no guarantee that I would not run into snags stemming from my lack of complete understanding. I could easily spend time recreating things from scratch only to end up stuck on the very same problem I ran into with my first approach.
To sum up: Argh! Too many unknowns! Let me see if there is anything new on Twitter …