The StorageService.js file in our codebase encompasses various functionalities, making it complex and difficult to maintain. This contradicts our coding best practices that emphasize readability and modular design.
Steps to Reproduce
Review the StorageService.js
Observe the multiple responsibilities student information management, course data handling, etc.) handled within a single file.
Expected Behavior
Ideally, the code should be modular, with separate files for distinct functionalities. This would enhance readability and make maintenance easier.
Actual Behavior
The file combines various unrelated functionalities, leading to a lack of clarity and potential difficulties in maintenance and scalability.
Proposed Solution
Refactor StorageService.js by splitting it into smaller, more focused files. For instance:
Separate files for managing user, student, and course information.
Stefan's suggested solution:
Separate the store functionality and the control functionality so one you have a controller that governs whether it should fetch data from the backend or the local storage, and a storage file that manage storage and ODM functions.
If you wanna separate it more, you could divide Storage and ODM functions, or separate user storage and course storage.
Additional Information
Environment: Mobile
Feedback Reference
"Perhaps we should split up this file by moving the different parts into separate files. Would make it more readable"
Issue Description
The
StorageService.js
file in our codebase encompasses various functionalities, making it complex and difficult to maintain. This contradicts our coding best practices that emphasize readability and modular design.Steps to Reproduce
StorageService.js
Expected Behavior
Ideally, the code should be modular, with separate files for distinct functionalities. This would enhance readability and make maintenance easier.
Actual Behavior
The file combines various unrelated functionalities, leading to a lack of clarity and potential difficulties in maintenance and scalability.
Proposed Solution
Refactor
StorageService.js
by splitting it into smaller, more focused files. For instance:Stefan's suggested solution:
Additional Information
Feedback Reference
"Perhaps we should split up this file by moving the different parts into separate files. Would make it more readable"
_Originally posted by @Jatewo in https://github.com/Educado-App/educado-mobile/pull/214#discussion_r1407419142_