pingora icon indicating copy to clipboard operation
pingora copied to clipboard

Suggestion for Simplifying Module Organization

Open gengteng opened this issue 1 year ago • 1 comments

Hello,

While exploring the source code of the pingora project, I noticed that the organization of modules often involves the use of a directory with a single mod.rs file for many modules. This approach, although functional, seems somewhat unnecessary when a module does not have submodules. A simpler and more streamlined method would be to use a single file named after the module (xxx.rs) instead of creating a directory with a mod.rs file for modules without submodules.

Adopting this strategy can offer several benefits:

  • Simplification: It simplifies the project structure, making it easier to navigate and understand, especially for new contributors or when quickly browsing the project.
  • Consistency: It provides a consistent approach to module organization that aligns with Rust's module system's flexibility and capabilities.
  • Efficiency: It may slightly reduce the number of files and directories, leading to less overhead when navigating the project in file explorers or IDEs.

I understand that this change would require a significant effort to reorganize existing code, and I appreciate the work that has already gone into developing pingora. However, I believe that this simplification could improve the project's overall maintainability and accessibility.

Would you be open to considering this suggestion for the future development of pingora? I am willing to assist in this transition if my proposal is accepted.

Thank you for your time and for your contributions to the open-source community. I look forward to your thoughts on this suggestion.

gengteng avatar Mar 02 '24 09:03 gengteng

Thank you for the suggestion and especially for your willingness to help. I think you are right that replacing a lonely blah/mod.rs with blah.rs would improve approachability. I don't think this is a change we will pursue internally, but if you feel strongly, we would welcome some (more 😉 ) of your prs to get it done. Since this is such a big change (from git's point of view), I would recommend making the switch in small batches to help avoid merge conflicts. We are working internally on pingora every day and only releasing changes about once a week. Thanks again!

johnhurt avatar Mar 13 '24 13:03 johnhurt