Skip to content
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

File & folder structure of our apps #120

Open
Mohammer5 opened this issue Jul 24, 2020 · 3 comments
Open

File & folder structure of our apps #120

Mohammer5 opened this issue Jul 24, 2020 · 3 comments

Comments

@Mohammer5
Copy link
Contributor

Right now, every app we have does things slightly differently, even when using the new app platform. I'd like to talk about whether we should aim for consistency in that regard as well and what we think works best for us.

I think what I like the best right now is having a very flat structure and use the duck approach on everything. I'll use the current state of the refactor of the sms-configuration app as an example:

image

I'm using views for the routes, these are more or less just controller-like components that just compose the different modules in the src directory into a working view as well as the view's meta data like route-path and label for sidebars, menus etc.

Everything else is a duck-module and contains components, functions and an index.js.

From time to time there's an issue with circular dependencies when using the index.js approach, which can be solved by importing directly what the files need and optionally split a file into multiple files when necessary (mostly happens when having two selectors.js importing each other)

@varl
Copy link
Contributor

varl commented Jul 26, 2020

The code organization hierarchy that works for a 1K LoC application may not scale to a 10K LoC application, which in turn may not scale to a 100K LoC application.

Note that the LoC numbers are not meant to be exact, they are to illustrate that there is not one way to organize code logically for applications of all sizes.

That said, it would be to ours and everyone else's benefit that we have project templates, that we recommend and use, for at least small/medium/large webapps.

They would aid when guiding new developers into our ecosystem, during dev academies, and for our own sake when cross-pollinating.

@ghost
Copy link

ghost commented Jul 27, 2020

I would like it if, if we do decide on some ideal structure(s), if we could enforce them automatically. Having a ton of conventions that you need to remember is not that nice in my opinion. Plus there's an opportunity for standards to drift and slip if it's not enforced.

@Mohammer5
Copy link
Contributor Author

Yeah, maybe it's better to not have a convention, because it'll be hard to follow, especially as every app will have its own exceptions.

Maybe we could collect / decide on a set of rules that we would like to see, but don't enforce, and then write a guide / tutorial for how we think dhis2 apps should be composed architecturally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants