Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Move calculators into flow directories #2558
The distinction between
Although I don't much like the way this is "implemented" in terms of the current directory structure, I do think it's a useful concept. I also think there is value in keeping all the files relating to a specific flow close together - partly because I think of an individual flow as a mini application in its own right.
However, there are currently a bunch of flow-specific classes under
For "calculator" classes used in multiple flows, I would envisage moving them to the
I should add that the reason I actually started working on this, is because I'm about to start moving the remaining flows towards the new style approach. This will (at least in the short term) mean introducing more flow-specific "calculator" classes and it started feeling increasingly odd to me that these are all some way away from the flows to which they relate.
This leaves us with the following directory structure:
See the individual commits for more examples.
There are many things wrong with the project's directory structure and name-spacing in the app, but I do not plan to fix them all in this PR. The aim of this PR is to improve matters in a good direction by taking a relatively small step. I'm not suggesting that the directory structure implemented in this PR is without flaws, just that it is an incremental improvement on what we have at the moment.
The following directory structure illustrates the direction in which I'm heading. However, none of this is set in stone and I don't think this PR ties us into any particular approach. While I think it's useful to discuss our plans so that we're all on the same page, I'm slightly wary about thinking too far ahead.
For what it's worth, here are some of the other many things that are wrong with the directory structure and name-spacing:
Hi @floehopper, a big
Very minor thing. I am not a fan of having prefixes unless they really add value (especially when they share the same name as the application):
@pmanrubia: Thanks for your comments.
I agree. I'm not convinced that the above directory structures should end up in
What I find confusing is having both smart_answer and smart_answer_flows directories.
I keep expecting all the controller code specific to a smart answer to be smart_answers not in smart_answer_flows
I'd rather the future looked like this:
If the current smart_answers directory is to only contain generic code, it should probably be renamed to something that reflects that e.g. "helpers".
So, to do this in baby steps, I would first:
So in the interim we would have this directory structure:
Thanks for taking the time to explain your thinking. It sounds as if we agree on the rough directory structure for an individual flow, which is good to know.
I agree that this is confusing. I think it relates to what @pmanrubia was saying in his comment above. In my reply I said:
Hopefully you can see by my reply that like you I'm also definitely not convinced that the individual flow directory structures should end up in
The problem that I've started trying to address in this PR is that files for a single flow are currently not close together. I feel as if what I've done so far moves us towards the directory structure for a single flow discussed above. I think the idea of the sub-directories like
If it's ok with you, I'd like to treat the issue of having both
So I think I'm inclined to press on with the current approach, although I've now started a bunch of other work and may not come back to this for a while. I'm going to close this PR for now, but feel free to add more comments to it if you have any more feedback.