I am writing a telegram bot (using webhooks) that sequentially reads smalls nodes (stored as json files) and now I'm in front of a crossroad: monolitic vs modular approach
The case:
The basic structure is a tree, made of several nodes: each node has just a text-property and a link to his son (a pointer to his next) and every tree will be located in a single folder.
The question is :
Should I use one (json) file per tree that contains all the nodes or should I use several (json) files per node? I want to achieve the best reliability of my service.
One File:
- pro: Easy to refactor, just one source to read
- cons: Costant "big" (around 100-200kb) read the whole file for a single node
Multiple files:
- pro: Costant small reads (1-3kb) on demand
- cons: Harder to refactor (not the hardest), redundancy over each node file, file-swarm
Am I missing Something?
I think that the multiple file approach is the best choiche to avoid concurrency between the request made by the users (tell me if I am wrong), keeping the read time as reduced as possible. The thing that scares me is that these node will be written by people that are not really into computing stuff, and (I hope not) refactoring could always be right around the corner.