Progress
Written Nov 18, 2022, tagged under post
As it turned out, yesterday was pretty well the peak experience as far as climbing the learning curve is concerned. I feel like I have been wrestling with a problem for absolutely ages, and then after a re-think on my approach - and learning some techniques I needed - the whole thing then kind of splurged out.
It was all about testing. In software development, certainly as practised at my employer, when you do work to achieve a desired effect (like adding a new feature), there are actually two main tasks to complete:
- Write the code to achieve the change
- Write the tests to confirm that the code achieves what it should
Now, if you're not familiar with this domain, you might well think that the first task is the hardest one, and the second one is like some icing on the cake, just to make it go down nicely. Before getting involved, that's what I thought too.
The reality is very much the other way round. The last change I've been working on took a couple of days for the change itself, and then I've been bogged down in tests for about a week, it feels. Now, much of the reason for this is that there are some (really super-powerful) testing libraries that we use (mainly Jest and Cypress), and they have an awful lot of domain knowledge associated with them. And they are VERY SNEAKY, and require a different way of thinking.
For example, to test some code, you might want to pass in some parameters and see what comes out. But actually you need to know about what's going on inside, or perhaps the code goes off and does something else that you can't access during testing. (For instance, if your code was a "submit payment" page for an e-commerce site, the payment processor might not be accessible during testing). So the testing frameworks let you "mock" parts of the code, which means to pretend to be that code, and respond in a desired way.
Or you might not be interested in the code's actual result, but you want to test what it does as part of it doing its work. In that case, you might set up a "watcher" to see how something is used.
Either way, there are particular ways to work, which may need to factor in uncertainty, such as being interested in one bit of what happens, but not another.
Anyway, this is a long way of saying that after gestating on this process for way too long, I finally feel like I have made a bit of progress, and was able to get a few things out of the way and un-clog myself to move forward.
The most interesting thing, looking back on today, is how much it changed how I was feeling, when I could suddenly see the end in sight. I went from feeling blocked and frustrated through to surfing on a wave of joy and creativity!
Just in time for the weekend, too: result.
Photo by Jakub Dziubak on Unsplash