When to use a module vs. writing own code?
The way I go about deciding whether to use a module or write my own code is roughly the following:


If the functionality I need can be written with a couple of lines of code I don't even start looking for a module to do it. Using a module for every little thing often gets you a good portion of extra code and other data that you don't need. All the unnecessary extras could:


negatively affect performance
make the site more complex and harder to maintain
result in more bugs

If there would be a considerable amount of code to write I'll look for possibly existing modules to make the task easier. Good reasons to use a existing module in my book:


it fits the requirements fairly well: using the module (and altering it with hooks, adding extra functionality via a custom module where needed) to get exactly what's needed is easier/faster than writing everything from scratch.
the site administrator needs to be able to change specific settings via the GUI and the module already offers that.