tl;dr keep everything in one file for now, split subsequently while refactoring when the file becomes huge.
Python does not force you split classes / functions into modules. We as programmers make that call for solely the purpose of readability and maintainability.
While refactoring I personally look at functions with more ~40 – 50 lines and files with ~ 1000 lines to split and try to keep closely related things together.
high cohesion and low coupling.
is a characteristic feature of good software.
Also, since you seem to be starting out with this project I would recommend you to first concentrate on making a version that works, thereafter refactor it to improve code quality.
premature optimization is the root of all evil.
I am assuming that you are looking for suggestions to improve code quality here, so here are a few things you might be also be interested in:
- follow pep8 standards: https://pep8.org
- make your functions / methods accept parameters instead of hardcoding them eg the path of the folder you are watching.
- make your program capable of resuming operations even after erroneous / abrupt termination: eg store state with a file or database
- instead of trying to implement a queue yourself use robust systems like rabbitmq or redis.
- write functions / methods that perform only one operation and do it well.
4
solved New class or new .py Python