Compare future methods, Queueable Apex, Batch Apex and Scheduled Apex. When would you use each?
Suggested answer
Future methods are simple fire-and-forget async calls, often used for callouts from triggers, but they only accept primitive parameters and cannot be chained or monitored easily. Queueable Apex is the more flexible replacement: it accepts complex types, returns a job ID and supports chaining.
Batch Apex processes very large data sets in chunks, each with its own governor limits, with start, execute and finish methods. Scheduled Apex runs a class at a specified time and is commonly used to launch a batch job on a schedule.
What interviewers look for
The interviewer wants trade-offs, not just definitions. Strong answers mention job monitoring, chaining, higher async limits, and choosing Queueable over future for new work. A pitfall is using Batch Apex for small workloads or calling future methods from batch contexts where not allowed.
Original practice content; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.