This site is archived.

A Hands-On Guide to Module Development

Ryan's picture
Submitted by Ryan on Tue, 07/22/2008 - 18:10.

Session recording

Attached files

Co-presenters: 
Placement
Session time: 
08/30/2008 - 09:00 - 08/30/2008 - 10:30
Conference booklet summary and bio
Article for conference booklet: 
Drupal module development is a bit like playing Zork. Anyone can play the game, walk around a while, score some points, get eaten by a grue, and try again. Even the most stalwart adventurer will need some help if he is to seriously improve his game. Otherwise, he'll get fed up with Zork and return to playing Duck Hunt. So it is with module development. You've setup a Drupal site. You've used some contributed modules. You've tweaked some to your liking and even written a couple from scratch... but you need to know how to improve your game before you get frustrated or waste all your time making the same mistakes. Yes... there are plenty of mistakes to be made, and we've made quite a few of them ourselves. Expect more classic gaming references in this session, but more importantly expect to learn about the things we've done wrong and the things we're starting to do right in our Drupal module development. This session will be geared toward beginning and intermediate Drupal developers looking to learn more about the module development process and "best practices" that go beyond (but certainly include!) simple adherence to coding and security standards. We will cover the tools we use, the module structures we like to stick by, and how we make the most of our first pass at a module. More importantly, we'll look at code that works with some of the harder to understand parts of the Drupal API, and we'll look at writing modules that integrate not just with Drupal but with other contributed modules like Views and CCK. <em>A Hands-On Guide to Module Development</em> will be an informal lecture session where we say our opening words and move into a time of hands-on learning. Those with laptops can follow along with code examples as we work through the development of a module that demonstrates the topics mentioned above. We'll be accepting quick questions as we go along and use any time at the end to take more questions and hopefully provide some helpful answers.
Bios for conference booklet: 
Lyle and Ryan hail from Louisville, KY where they have been hacking away on Ubercart for the last two years. Through that project and their personal endeavors they have together touched almost every corner of Drupal's APIs. Every module written for Ubercart or otherwise has brought with it new insights and an even stronger desire to start retooling their earlier works.

Overview

Drupal module development is a bit like playing Zork. Anyone can play the game, walk around a while, score some points, get eaten by a grue, and try again. Even the most stalwart adventurer will need some help if he is to seriously improve his game. Otherwise, he'll get fed up with Zork and return to playing Duck Hunt.

So it is with module development. You've setup a Drupal site. You've used some contributed modules. You've tweaked some to your liking and even written a couple from scratch... but you need to know how to improve your game before you get frustrated or waste all your time making the same mistakes. Yes... there are plenty of mistakes to be made, and we've made quite a few of them ourselves.

Expect more classic gaming references in this session, but more importantly expect to learn about the things we've done wrong and the things we're starting to do right in our Drupal module development (primarily Ubercart).

This session will be geared toward beginning and intermediate Drupal developers looking to learn more about the module development process and "best practices" that go beyond (but certainly include!) simple adherence to coding and security standards. We will cover the tools we use, the module structures we like to stick by, and how we make the most of our first pass at a module. More importantly, we'll look at code that works with some of the harder to understand parts of the Drupal API, and we'll look at writing modules that integrate not just with Drupal but with other contributed modules like Ubercart and Views.

Sounds like a lot, eh? We think so, too. However, we'll be presenting the information in the following format to try and disseminate as much knowledge as possible:

A Hands-On Guide to Module Development will be an informal lecture session where we say our opening words and move into a time of hands-on learning. Those with laptops can follow along with code examples as we work through the development of a module that demonstrates the topics mentioned above. We'll be accepting quick questions as we go along and use any time at the end to take more questions and hopefully provide some helpful answers.

As always, if we can't get to you in the session, feel free to stop us in the halls or find us around Drupaltown and get your learn on.

We're open to collaborators interested in the topic and the format. Interested developers should contact Ryan or Lyle (Island Usurper). If you just want to contribute your module development best practices, we'd love to have a nice happy list for folks to use as a reference coming out of this session.

Agenda

* Introductory words
* Getting ready to code - think first
* Where to start with a blank file
* Writing those first hooks and callbacks
* Writing smart functions
* Documenting as you go!
* Grokking some more Drupal hooks:
   - hook_form_alter()
   - ... (to be determined)
* Hooking into contributed modules:
   - Ubercart
   - Views
   - ... (to be determined)
* What to do when you're "done" ; )

Goals

Attendees should leave with a greater sense of what it takes to develop Drupal modules successfully. There's no way to pass on a comprehensive understanding of what we know or get to cover, and that is a subset of all there is to know about module development. However, every little bit helps, so we'll try to pass on as many little bits as we can!

We want to help move as many beginner developers as possible toward the intermediate level and entice those intermediate developers to become the experts we know they can be.

Resources

* Drupal 6
* http://api.drupal.org
* http://drupal.org/project/ubercart
* http://drupal.org/project/views
* http://www.infocom-if.org/downloads/downloads.html

We will include a downloadable zip of code examples for session attendees to use to follow along as we write the module, discuss the code, and discuss how we got there.

Cary Gordon's picture

Cool

But 90 minutes? You're going to have to talk pretty fast!

Ryan's picture

haha I agree. We'll just

haha I agree. We'll just have to do a lot of homework to make sure our stuff's in order before we show up. ;) Lyle's working on the module specs. and should be able to cook up a zip of ready-made "W.I.P." code samples to pass around. We'll see how it works.