In #3627449: Add example module to promote best practices, I'm arguing for the need for some authoritative "source of truth" for best practices in core. I figure people who've been in this business for years will have some interesting feedback to share :)

Comments

plach created an issue.

avpaderno’s picture

An example module is probably not sufficient for collecting all the best practices. If a single module were sufficient, I would be in favor of adding it to Drupal core.

I would not add example modules which need to be removed for a production site, considering the example modules are not thought to be used by people with normal permissions. They are modules that should show how to write code for specific purposes; if they expose a page or a form, it is just for showing how the render markup looks like, without any real purpose behind that form or page.

Furthermore, I think that adding example modules which can be installed in Drupal core would confuse people, who could think they are real modules to use. In the case they adapt those modules to use them in a production site as custom modules, the outcome would be probably worse.
This could even happens with the example modules in this project, but example modules in Drupal core would be available for every site where Drupal core is installed; this would make "easier" to use them as custom modules for a specific site, or a group of sites.

avpaderno’s picture

Drupal core could improve the code comments, which could teach people how to correctly use Drupal core API.
That would be something that Drupal core could do; it would probably make modules in this project less relevant, for that part. It would not make the modules in this project less relevant, if their purpose is showing how forms render. (I would prefer not having a module in core just to show how the user interface would be.)