Jeff Hicks shares some good practices with us:
Over the course of the last several weeks, I’ve been sharing and demonstrating techniques for writing effective PowerShell functions. I know I’ve mentioned a few recommended best practices. But since they are important, I want to review and re-emphasize them. These practices will make your code easier to write, easier to debug or troubleshoot, and more secure. I’d like to think some of them are simple, common sense, but sometimes we need someone to remind us. These items are not in any particular order.
There are some Powershell specifics here but most of the advice is language-agnostic.