Class is in session
As we mentioned before, when we write triggers, the majority of code goes into our Apex classes, not the triggers themselves. As only the platform can execute the code in a trigger, any code you put in there is inaccessible to you. This means that if you ever need to reuse the same logic, you'd have to rewrite it in a class. If you're going to have it rewritten anyway, you might as well just start off correctly and put it in a class to begin with.
We can create a new Apex class from the Force.com IDE as follows:
Right-click on your project in the Force.com IDE and navigate to New | Apex Class.
The Create New Apex Trigger window appears as shown:
Enter the name for your new Apex class. For this example, use
accountMethods
.Leave the Template option as Default.
Click on the Finish button.
A progress bar will appear followed by your new Apex class.
Currently, there are only three template options available when creating a new Apex class from the Force.com IDE:
Default: This is an...