Refactor: organize components into folders - #135
Conversation
kaze-cow
left a comment
There was a problem hiding this comment.
for the program structure specifically, the reason its somewhat confusing right now is because we mix the processors with everything else in a flattish folder structure. Instead, we should have a folder structure like:
- programs/settlement/src/processors
- begin_settle.rs
- finalize_settle.rs
- create_buffers.rs
- ...
- programs/settlement/src/helpers
- settle.rs
- token.rs
- ...
Exactly one file per processor. An onlooker can easily find the entrypoint instruction processor they are interested in, which is arguably the most important part to understand about the program.
For the interface, the existing folder structure was better. Grouping by groups of operations doesn't do a lot for our program with only like 10 instructions
For any utilities shared between instructions, those can go in a helpers/ folder
(btw I am not all that opinionated on this, in fact we could keep the folder structure the same! but since you asked me to review if I liked it or not, these are my thoughts)
|
Your suggestion is more complicated than just a folder reorganization like I did here! |
There was a problem hiding this comment.
This PR appears to be in conflict with #140 , which also splits a number of files and moves them. For example,
interface/src/instruction/create_buffer.rs -> interface/src/instruction/buffer/create.rs
I don't like this change because it breaks the , and making the /file names shorter doesn't do a lot for me. Personally when finding files in the project I use Control-P so there is very little need to navigate or "find" files. but having shorter, more generic file names with longer parent paths like create.rs does make it harder to find the relevant file.
With the changes from #140, the only folder that's starting to get messy is the test folder. Should I keep the changes in this pr for program/settlement/tests/ or just close it?
#140 is great! lets close this one if thats ok
We're starting to have too many files in the same folders.
The current components can be reorganized nicely by purpose, and this is what this PR aims to do. It should make it easier to find what we need by looking at the filesystem.
To get an idea of the changes,
programs/settlement/src/is very representative:How to review
Check in your code locally and make sure that you like the new folder structure.
Only then, check the code and confirm that nothing really changes apart from the import paths.
Also, make sure that all tests are still being run and that we didn't drop tests by accident. For example by running:
before and after to check that the number of tests is the same.