One of the best resources for developers approaching Drupal for the first time is going to be the Drupal Examples Project.
Bookmark the API Docs
Although the community documentation has instructions for interacting with the API, the ultimate reference is going to be the code itself, followed by the API documentation, which is generated automatically from the code comments inserted by the Drupal developers. This is especially true for Drupal 8 at the moment, as there is a lag between updates to the code, and updates to the community documentation.
drush dl devel
drush en devel
Drush stands for Drupal Shell, and gives you a way of interacting with your Drupal installation directly from the command line, without loading your site in a browser. From everyday clearing of caches through to complex management of features, Drush allows you to perform tasks faster than you can using equivalent commands from the administrative interface.
Develop on a Page
If I'm adding something very new to my module, I often develop it first in a PHP page on one of my test sites - it's just easier and potentially less disruptive. I still follow the same development "rules" - only the environment is different. If it doesn't work out, it's much easier, emotionally, to throw away a single page than stuff that's already in a module.
Enable "Development" Mode
In Drupal 8, copy the file from sites/example.settings.local.php to sites/default/settings.local.php. (you may need to unlock write access to the default folder) Then in sites/default/settings.php, uncomment the 3 lines at the end that deal with settings.local.php. (again, you may need to unlock write access to settings.php)
Monitor for Errors
If you run the command
tail -f /var/log/apache2/error.log (exact location of your log file may vary) in a terminal window, it turns that window into a real-time monitor of PHP errors that may result from changes to your code. If you want to filter out the parts that are within square brackets, try
tail -f /var/log/apache2/error.log | sed -e $'s/\[.*\]//' This even works over ssh, so you can monitor the php errors occuring on your development machine from a second machine where you have the Drupal IRC channel open, etc, by doing
ssh -t remote_computer_name "tail -f /var/log/apache2/error.log" | sed -e $'s/\[.*\]//'
Use module filter
To make it quick and easy to find a module (or two), install module filter which allows you to have a search box and grouping on the modules page. Very handy for large sites or sites using a multi site installation.
hook_enable / hook_disable
These hooks are often overlooked but I find them useful:
- Set/reset all your variables to their defaults in this function for an easy way back to an almost-virgin state and to make sure the defaults only have to be correct in one place.
- Provide a message that will direct your users to the settings page.
- Log the userid of the enabling/disabling user.
It's always a good idea to help the end-user, so at least start with a skeleton hook_help. It can be filled in more completely as you go along.
It's a rare module that doesn't have at least one menu item, so go ahead and start with a skeleton for this.
Even if you didn't create any tables or content types that should be cleaned up, I can pretty much guarantee that you used some variables (i.e. variable_get, variable_set). Delete them. If you created blocks, it's a good idea to clean those up too. Don't forget to test it.
Drupal has many more hooks than the ones above. You can find documentation about them at https://api.drupal.org/api/drupal.
To do list
Invariably you will think of something that needs to be done sooner or later. Put a small comment section at the top of your module for including these notes.