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

Module naming conventions should allow underscore #1722

Open
madsoliver opened this issue Sep 5, 2023 · 2 comments
Open

Module naming conventions should allow underscore #1722

madsoliver opened this issue Sep 5, 2023 · 2 comments

Comments

@madsoliver
Copy link

In devdocs Module naming convention it is stated that:

  • Module names should contain only lower case and numbers.
  • Native modules' names must be prefixed with “ps_” (e.g. ps_linklist).

I suggest that the convention instead should be something like:

  • Module names should contain only lower case letter, numbers and underscore.
  • Developers are encouraged to prefix their modules with their own unique prefix, just like prestashop native modules are prefixed with ps_. This makes it easier to avoid conflicts in module name collisions , allowing the merchant to both have (example) modules psdevone_imageslider as well as psdevtwo_imageslider and ps_imageslider.
  • Native modules' names must be prefixed with “ps_” (e.g. ps_linklist).

Why allow underscores?

  • Because not allowing them means developers needs to change the name for hundreds of modules. Myself I have over 100 modules prefixed with "ko_" and most of them also has more underscores like "ko_product_homepage_slider"
  • Because snake-case-names looks better and are much_easier_to_read than notusingunderscoresatall, in file-lists, databases and where ever.

Also discussed on slack

@Hlavtox
Copy link
Contributor

Hlavtox commented Sep 5, 2023

+1 I never understood who came with this thing, completely breaking the ecosystem and conventions. (If native modules were not prefixed with ps_ than maybe. :-))

Related to PrestaShop/PrestaShop#23717
Latest info from Pablo PrestaShop/PrestaShop#23717 (comment)

@madsoliver
Copy link
Author

I really hope we can sort this out one way or another 🙂
Just imagine how many modules that have underscores in their names. Changing name for modules is not a small task, neither for the developers, nor for the merchants. As far as I know there is no automatic way to upgrade from my_module to mymodule, so the merchant would need to uninstall and install. Also, think about all configuration values, tables, file-paths, all defined by the module name. It means ALOT of migration needs to be done for ALOT of modules.

And for what?

I also agree with @Hlavtox comment about convention. AFAIK there was no module naming convention before, so back in time, I just read between the lines that one should use underscores, such as using company_module, just like the native ps_modules did and still does. And I still think that should be the convention 😉

I understand there might be some technical issues with translation domains, but I think maybe it no longer is the case?

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

No branches or pull requests

2 participants