I have written a simple pdf viewer. The rendering code was initially about 5 classes. Then I added Tiled Rendering because my app was running out of memory at higher zoom levels. It took me a few days to get that working correctly.
Now I want to add a tabbed browser like UI with multiple open documents at the same time. My class count has increased from 5 to about 10 and it has gotten a lot more complex. The tabs work about 20%. Because all classes have to work together it's difficult to find out which class doesn't work correctly. I have written testing code for some classes but not all. I just have the feeling that with my approach to programming I reach a certain level of complexity and then the whole house just crashes below me and everything falls apart. What makes it a bit more difficult is that I program as a hobby and have no team members which I could consult. I tend to only realize that an idea wasn't that great after I finished the whole code.
I have tried to sketch out the current situation of my "thing" I "designed". There is stuff that runs on the mainthread, stuff that is asynchronous and lots of listeners.
At the moment I can have multiple open documents. A document has multiple pages that can be displayed at once. For rendering the pages get divided into a grid of tiles. Every page can have multiple layers, like a layer for a pdf file and another layer for annotations
on top of the pdf layer.