PrestaShop/docs

Module naming conventions should allow underscore

madsoliver opened this issue · 2 comments

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

+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)

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?