Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Nest sub-apps under umbrella namespace #66

Merged
merged 2 commits into from
Oct 27, 2017

Conversation

timriley
Copy link
Member

For example, in a newly generated “blog” umbrella project, the “main” sub-app’s module namespace will now be Blog::Main instead of just Main.

This brings a few of benefits:

  • The conceptual clarity of sub-apps being nested under a single root project namespace (having the sub-apps being “siblings” to the root project made their relationship unclear)
  • Constant loading is now more straightforward when a sub-app wants to use a class defined in the root module. When referring to Entities::Foo in code within a Blog::Main sub-app, the resolved constant can now fall back to Blog::Entities::Foo (in the root namespace) if Blog::Main::Entities::Foo (a more specialised version, in the sub-app’s namespace) is not available.
  • Reduce global namespace pollution: only one top-level constant is used.

For example, in a newly generated “blog” umbrella project, the “main” sub-app’s module namespace will now be `Blog::Main` instead of just `Main`.

This brings a few of benefits:

- The conceptual clarity of sub-apps being nested under a single root project namespace (having the sub-apps being “siblings” to the root project made their relationship unclear)
- Constant loading is now more straightforward when a sub-app wants to use a class defined in the root module. When referring to `Entities::Foo` in code within a `Blog::Main` sub-app, the resolved constant can now fall back to `Blog::Entities::Foo` (in the root namespace) if `Blog::Main::Entities::Foo` (a more specialised version, in the sub-app’s namespace) is not available.
- Reduce global namespace pollution: only one top-level constant is used.
Now that sub-apps are nested, this style of reference to the Import modules is probably the way we’ll go.
@timriley timriley changed the title Nest sub apps under umbrella namespace Nest sub-apps under umbrella namespace Oct 27, 2017
@timriley timriley merged commit 9a636c0 into master Oct 27, 2017
@timriley timriley deleted the nest-sub-apps-under-umbrella-namespace branch October 27, 2017 03:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant