-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean and reasonable project structure #633
Comments
I think these are great ideas and will support them in any way I can. |
I'm in support of these suggestions but think they should be done after the 2.4 release. |
Making a note that we should also include the module cleanup that @chrisknoll proposed as part of #611. |
Maybe this is the right place to ask: Is anyone is considering getting away from requirejs anytime soon? I'm back to working on ATLAS and I want to use libraries written with ES6 imports. I think I can get stuff like that working with something like https://github.com/mikach/requirejs-babel, but if we might be moving toward ES6 module imports, there's no sense messing with temporary bridging kludges. Has this been discussed lately? |
Let's focus this discussion on project structure. It doesn't matter what the module syntax is for us to clean up and address @pavgra items, and we wouldn't want to be distracted by a holy-war over module systems. If you do want to discuss it, I think opening up a separate issue on this or starting a forum discussion on it.
You can do this, just use the bundled library (via CDN or otherwise). We do this with d3, so use that as an example. |
No problem. Here it is: #654 |
Since there is overall support of the proposal, the topic was discussed at recent Architecture WG (@fdefalco , @anthonysena, @Sigfried) and Odysseus is going to start working on this step-by-step:
|
@chrisknoll, @anthonysena, @fdefalco, Before
After
|
Hi @johnSamilin Thanks for drafting this up. A few thoughts:
With the last 2 points in mind, I've put together 2 options I'd like you to consider. Option 1: one module per file, separate folders for template and stylesheets:In this option, I'm putting components and pages in separate root folders. Pages will contain all the components specifically for driving the Atlas pages. components will be where we place the re-usable elements of the application.Note: I'm putting charts and reports under /components because they should be reusable things, and not specific to any one page...For example: the person report should be the same report for data sources and cohort characterization. I also have separate folders for templates and stylesheets to tuck those assets away from the main folder with the modules. To reference those assets, in the module define, you would do this:
I propose this option so that you can look at the directory structure and clearly see what components are defined. Option 2: one module per file, do not have separate folders for styleshets/templatesThis folder structure is nearly identical to option 1 (from a top-level folder organization), but instead of sub-folders for stylesheet and template assets, they are now in the main folder for the component, and if we adhere to some naming conventions, the assets will be grouped together. In this way, the external assets are imported via:
Module ID resolutionWith this folder structure, instead of this:
It is this:
If we do feel like we should have sub-groups of reports, we could put that into a sub-group:
But I still think that we should think of reports as more atomic things that aren't tied to one specific function in the application. -Chris |
@chrisknoll , I believe that the first option, which is structuring by content type, doesn't work good for big projects, especially when we do not have strict typification. The second option looks quite similar to what was proposed in the branch, but I would combine it with the @johnSamilin 's approach:
|
@chrisknoll, thanks for the review, |
Hi, @johnSamilin , I feel what's happening here is that we're trying to make this all look like a node or webpack project structure, and we're using AMD formatted modules. In AMD world, it's one module per file (vs. one module per folder). So, since we're in the world of AMD, let's follow the model that modules resolve to a single file, and work under those rules. I think we should consider folders as 'collections of modules' (or like a java 'package'). @pavgra, I understand your point about folder specific content types (when I suggested a stylesheets and templates folder) instead, maybe we have a more generic 'resource' or 'etc' or something else that we can place all those separate assets into (if we have an objection to having the resources co-mingled with the module files). |
@chrisknoll , if the resource (under resource I assume stylesheet) is component specific, why should we move it far from the component? It should be tightly coupled with the component's controller and template, so should be near |
I'm thinking that resources might be shared across components (ie, an image for an icon or something like that). But my Option 2 above grouped those assets all in the same package folder so I'm fine with keeping them with the component, but remember: we'll have multiple components in a single folder, not one folder per component. |
Icons and similar resources - yes, no objections. I was talking about stylesheets. So, all in all, do we agree on the following change list for the PR?
|
I think that covers it, @pavgra , but I'd definitely like to review again as the implementation moves forward, there could be another issue that's not easily observed yet. So, at the very least, I agree with those 3 items you list, but I'm not saying that's the complete list. But hitting just those 3 items would be a great improvement over the current structure. So I'm all for it. |
Cool! Then @johnSamilin will do the changes and we'll see whether anything else comes out. And as we discussed earlier, the approach, which we are targeting, is to go with PRs module by module, not with an insanely huge one. |
@chrisknoll @pavgra could you review again? |
Ok, I think this looks better. I'm still concerned with seeing an 'index.js' under the data-sources folder as well as a data-sources.js file (which would be resolved by pages/data-sources/data-sources. I think that there's still this notion that a module is a folder, not a file. Am I looking at the wrong things? the modules under classes look clean.... |
@chrisknoll , have you seen what is in the first I would suggest to wrap the refactoring of single data sources module into PR, go through it with a review and merge it |
No, I was just looking only at the project structure to see if it conveys the information about the project structure without needing to have to look inside the files to get the general idea (which is what the point of the folder-restructure is), and so I'm just giving my perspective based on just looking at the structure. But I'll look into the files I have a question on and suggest names that reflect their purpose. Thanks, @pavel and @johnSamilin! |
@chrisknoll / @johnSamilin , another suggestion from me is to build module-local permission services. E.g. permission checks of Cohort Characterization module are not required anyway outside of the module, so keeping them encapsulated will allow to keep global |
Closing due to age and it appears that most major concerned were addressed via PRs linked to this issue. |
Today files in the project are quite messed up and it would be good to define strict project structure, simplifying code navigation.
Proposal is following:
Naming is a subject for discussion.
Changes required to align current codebase to the described structure are going to be done in separate branch. Also the defined structure should be put into README and forced for usage during code-reviews.
@chrisknoll, @fdefalco, @anthonysena , would be grateful to receive your opinion on this.
The text was updated successfully, but these errors were encountered: