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

Rename the app and root module "prefix" as to not namespace trespass #54

Open
ed-flanagan opened this issue Apr 25, 2024 · 0 comments
Open
Assignees

Comments

@ed-flanagan
Copy link
Owner

The app name is :riot_lor; however, our "root" module is Riot.
According to https://hexdocs.pm/elixir/main/code-anti-patterns.html#namespace-trespassing this may be considered "namespace trespassing"

This anti-pattern manifests when a package author or a library defines modules outside of its "namespace". A library should use its name as a "prefix" for all of its modules. For example, a package named :my_lib should define all of its modules within the MyLib namespace, such as MyLib.User, MyLib.SubModule, MyLib.Application, and MyLib itself.

This suggests that the "namespace" should be something like RiotLoR. There isn't an official Riot namespace, but I do not wish to claim it. I'd rather keep that namespace open and have my own, distinct, namespace. This is based on this example:

Even if Plug does not currently define a Plug.Auth module, it may add such a module in the future, which would ultimately conflict with plug_auth's definition.

Further, this library is specific to Runeterra, i.e. the LoR. However, if I choose to extend my development to something beyond Runeterra, RiotLoR isn't a great prefix. So, based on this example:

If you are the maintainer for both plug and plug_auth, then you may allow plug_auth to define modules with the Plug namespace, such as Plug.Auth. However, you are responsible for avoiding or managing any conflicts that may arise in the future

It may be prudent to come up with a common, more generic, prefix.
E.g. say I have to libraries: one for Runeterra deckcodes and one for the Riot API. I may desire to have a common prefix, say MyRiotLib. I can then have a common prefix across libraries, i.e. MyRiotLib.Runeterra and MyRiotLib.API.

MyRiotLib is not an app reference itself, but can be a common prefix, like Plug. The respective app names may be something like :myriotlib_runeterra and :myriotlib_api

This is a major change and will require a major version update. Further, there may be implications of changing the app name for Hex

@ed-flanagan ed-flanagan moved this to Backlog in Version 2.0 Apr 25, 2024
@ed-flanagan ed-flanagan self-assigned this Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant