> ## Content Index
> Fetch the complete content index at: https://www.namastesalesforce.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# The Apex mistakes I still see in every org
- URL: https://www.namastesalesforce.com/blog/apex-mistakes-i-still-see-in-every-org/
- Published: 2025-08-07T09:00:00.000Z
- Updated: 2025-08-07T09:00:00.000Z
- Description: Fifteen years of the same five mistakes: queries in loops, tests without assertions, triggers with opinions, hardcoded Ids, and empty catch blocks.
- Author: Swarnil Singhai
- Tags: #blog, Apex, #blog-layout-split, #Import 2026-09-03 19:13

Fifteen years of the same five mistakes: queries in loops, tests without assertions, triggers with opinions, hardcoded Ids, and empty catch blocks.

## Queries in loops, still

The 101st SOQL query has been throwing the same exception since 2008 and it remains the number one production incident I get called about. The fix is a pattern, not a talent — collect, query once, map, loop.

## Tests that assert nothing

Coverage without assertions is a donation to the deployment gods. If the method's behaviour changed completely and the test still passed, it was never a test.

## The empty catch block

catch (Exception e) {} is a decision to find out about failures from your users. Log it, rethrow it, or write the comment explaining why silence is genuinely correct — there is no fourth option.