+Kevin O'Hara. The key practices is to write logic out of the trigger into a custom apex class using Polymorphic design. Check out previous post about Apex Best Practices
Polymorphic Trigger :
Write all logic in one apex class to easily manage triggers for an objects and contextual methods. Like
Then write object specific class to override each method an apply business logic.
Call the AccountTriggerHandler class in the Trigger
Contextual Trigger :
You can write context trigger for before and after context for an transaction. Either you can write multiple triggers or one trigger to nail all context like shown here
Recursive trigger :
Recursive trigger situation occurs when a trigger and workflow stuck in unlimited looping situation, a simple scenario would be, workflow updates a field, which in-turn invokes Trigger and henceforth, workflow turns on back again and so forth recursion comes in scene.
Key solution is using static variable, I wrote blog post here and here and recommend reading solution by Andrew Fawcett . Basically you can use static variable to solve your problem.
Create a class with static variable
Now use this variable to check, if trigger ran before
Using Enums for Contextual Trigger :This is another solution proposed by
In this approach, the idea is to create a class with enum variable handling events and the context class call helper class to process all records. On trigger, for each type of event we can invoke the Context class, I wrote an example using Account sObject in mind, but ideally it can be applied to generic sObject.
Read More :