Anytime you write a Drupal module, you should always have the Coder module installed and enabled to check your code when you think you're done.
I'm tempted to end this QuickTip here, as that's all you really need to know.
The Coder module provides a code review for your code - it checks for common security issues as well as adherence to the Drupal Coding Standards. It's a snap to use - just click on the "Code review" link for your module on the admin/build/modules page and be humbled by how much smarter it is than you.
I prefer the "minor" mode - using this, Coder finds every little thing from extra white spaces to phantom tabs. Only once I get a clean Coder report do I consider modules I write "done".