Yesterday I was struggling all day with Svelte stores. I do not understand very well how they work, and I was fiddling all over the place, trying to get the store to work in the way I intended. I went to bed without having been able to get it working. At the same time, I noticed myself procrastinating a lot.

In the morning I woke up and I knew I had to change my approach. “Perhaps I ought to simply read the documentation”, which is something I surprisingly hadn’t tried before. But this seldom works for me. In programming you see symbols, most of the time if you do not understand the code, reading the description of what the code is doing will not do anything for you, for the best explanation is in the code.

This is precisely what had happened, I was still at a loss at how things worked, and I got sidetracked multiple times. I even begun writing this work log before accomplishing my task, describing my frustrations, but something felt wrong about it. I thought: I haven’t tried enough, I shall replicate my issues in the Svelte’s REPL so that I can say I tried everything. So I did this and somehow things worked!

I debugged my code, and saw that, amidst the modest complexity of the codebase, I was triggering something in the store inadvertently, and thus things were not behaving in the way that I had intended.

The lesson for this seems to be: when facing a problem outside your domain, remove everything extraneous to the problem. Understand from principles. Even if I had been successful in resolving the problem by tinkering, I would have reached the solution without understanding the problem.

After I resolved this, a sense of mastery came to me: not only have a I resolved the problem, I have understood how to resolve all programming problems. Nothing will stop me now, HA HA HA!