Mixed purpose modules
Following this edit, a little info here.
ResourceLoader always loads a module's styles before executing any scripts. It is by no means "desirable for the stylesheet to be loaded before rest of html [by using OutputPage::addModuleStyles]". OutputPage::addModuleStyles will insert a hardcoded
<link> tag in your HTML that is ineffeciëntly cached and separate from the whole advanced cache-busting and cache-preserving system around ResourceLoader. Usage of direct
<link> tags in the output should be extremely rare and is imho to be considered deprecated (except for some core stylesheets and the ResourceLoader startup module itself).
The only scenario in which might consider loading the styles of the module from the
<head> (separate from the rest of the module) is when your module is serving two purposes, which you shouldn't be doing.
If you've got a module that has a stylesheet that is styling content outputted by PHP and/or moving around elements outputted by PHP, and at the same time have code in this module that is doing dynamic stuff after the document is ready (e.g. something that isn't visible or needed before the page is loaded), then one should split the module.
One module for initialization stuff. This module should have the
position property in the module registry set to "top". This will tell the client to load the module from the
<head> before parsing the body contents. So that whatever is in here will be in memory before the page is displayed. The other module would contain everything else and can simply be loaded regularly from the asynchronous queue that arrives at or a little after the document is ready.
Both should be added to the load queue in OutputPage::addModules. That way the module properties and the load queue are kept separate, the client will use the module registry properties when it loads it and do the right thing (instead of telling OutputPage to force loading it in a certain way, simply let the client handle it).
The problem with what you say above is that the "top" property is not available until version 1.19, which is not yet stable. So with version 1.18 doing it the way you say, the browser displays unstyled html for a second before the styling is applied, which is a very unpleasant user experience. I would rather trade a bit of efficiency for a much better overall experience.
I don't know where you get this information from, but
position property has been in MediaWiki at least since version 1.18