Use Apex if you want to:
1. Create Web services.
2. Create email services.
3. Perform complex validation over multiple objects.
4. Create complex business processes that are not supported by workflow.
5. Create custom transactional logic (logic that occurs over the entire transaction, not just with a single record or object).
6. Attach custom logic to another operation, such as saving a record, so that it occurs whenever the operation is executed, regardless of whether it originates in the user interface, a Visualforce page, or from SOAP API.
For more information, see the Force.com Apex Code Developer’s Guide.
Cheers!!!