Learning Joomla Module Development
The way I learned, was by studying and customizing the core or other 3rd party modules.
Modules as concept are simpler than the components (which we could say are 2 apps front-end/back-end) and are designed to display a piece of information.
So if you open the module folder/files and start reading the code, you will probably get fast into it.
Joomla Module Anatomy by example
For example, you can open the Latest Articles Module in Joomla 3.2 and check its code, while reading the lines below.
In the module's folder we will find the 4 basic files:
mod_articles_latest.php is the main file of the modules, the one that is used first when the module is called. It initializes the module and includes the
helper.php, call the helper's class method to retrieve data and finally includes the template of the module (
default.php) to display the data.
helper.php file is the "machinery" of the module (if we could name it so). In the helper we create the module's class and its methods to retrieve the data. This is the place where we can have the module "talk" with the database. Reading the code in this module's helper file, you will see that it contains the
ModArticlesLatestHelper Class, which has one Method :
Within this method the module is checking for the backend settings of the module, and eventually build the list of the articles it will return, based on these conditions. Note that this module uses the
JModelLegacy::getInstance method to return the Content Model Object.
default.php is the main template of the module and responsible to display the module's content. - Here we build the html output, using the data you retrieved previously in the
mod_articles_latest.php by calling the module's class. It is located inside the tmpl folder. *Notice that the main module's file includes the template file with the
JModuleHelper::getLayoutPath method, which first will check for any template overrides.
mod_articles_latest.xml I would call it like the "ambassador" of the module. It is the file that "introduces" the module to Joomla during installation, it specifies the files that will be copied by the installer, and also contains the information about the parameters of the module that are used by the module manager, as well additional information about the module.
These are the essentials parts of a basic module. Another aspect you might want to consider is the support of multiple languages. This can be achieved by using Language Strings and Language Translation files. If you would have reached successfully that far, to create a basic module, then adding languages support should be pretty simple.