0% found this document useful (0 votes)
21 views7 pages

Exception Handle Pattern in Java - Stackademic

The article discusses the pitfalls of excessive use of try-catch blocks in coding, particularly among junior developers who often rely on them for error handling. It argues that this approach can lead to hidden errors and production incidents, suggesting that senior developers use try-catch as a last resort. The author emphasizes the importance of adopting better exception handling patterns to ensure safer and more effective coding practices.

Uploaded by

irwan kilay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views7 pages

Exception Handle Pattern in Java - Stackademic

The article discusses the pitfalls of excessive use of try-catch blocks in coding, particularly among junior developers who often rely on them for error handling. It argues that this approach can lead to hidden errors and production incidents, suggesting that senior developers use try-catch as a last resort. The author emphasizes the importance of adopting better exception handling patterns to ensure safer and more effective coding practices.

Uploaded by

irwan kilay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Open in app

Search Write

Stackademic

Member-only story

Junior Devs Use try-catch


Everywhere. Senior Devs Use These
4 Exception Handling Patterns
HabibWahid Follow 6 min read · Feb 1, 2026

983 24

Try-catch on every method? That’s not safe code — that’s a ticking time
bomb. Here’s what senior devs do instead.
I joined a startup two years ago. The codebase had try-catch blocks wrapping
every single method — controllers, services, repositories, and utility classes.
Everything. The team called it “safe coding.”

It wasn’t safe. It was a disaster waiting to happen.

Within three months, we had three production incidents where errors


vanished silently. No logs. No alerts. No way to know something broke until a
customer complains. The try-catch blocks didn’t protect us. They hid the
problems from us.
That experience taught me one thing: wrapping everything in try-catch isn’t
defensive programming. It’s fear-based programming. Senior developers
don’t reach for try-catch first. They reach for it last — only when it’s the only
right tool for the job.

Here’s exactly what that looks like in code.

Why Junior Devs Default to try-catch


It makes sense on the surface. Something might fail? Wrap it. Compiler
complains? Add a catch block. The tutorial shows a try-catch. Copy it.

Irwan, become a member to read this story, and all


of Medium.
HabibWahid put this story behind our paywall, so it’s only available to read with a paid Medium
membership, which comes with a host of benefits:

Access all member-only stories on Medium

Get unlimited access to programming stories from industry leaders

Become an expert in your areas of interest

Get in-depth articles answering thousands of programming questions

Grow your career or build a new one

Steve Yegge Carlos Arguelles Tony Yiu Brandeis Marshall


ex-Geoworks, ex-Amazon, ex- Sr. Staff Engineer Director CEO
Google, and ex-Grab Google Nasdaq DataedX

Cassie Kozyrkov The Secret Developer Austin Starks Camille Fournier


Chief Decision Scientist Software Developer Software Engineer and Head of Engineering
Google Entrepreneur JPMorgan Chase
Resume membership

Published in Stackademic Follow


78K followers · Last published 12 hours ago

Stackademic is a learning hub for programmers, devs, coders, and engineers.


Our goal is to democratize free coding education for the world.

Written by HabibWahid Follow


1.3K followers · 36 following

I have been a Software Engineer for 6+ years and am highly experienced with
Java, Spring Boot, Generative AI, Spring AI, React, Next, AWS, Microservice, etc.

Responses (24)

Irwan Kilay

What are your thoughts?

Manivasagam E
Feb 7 (edited)

Share Non member link if available

52 2 replies Reply

Saish Dawg
Feb 5
For Result, perhaps better to borrow from FP and return a Try or Either (each a Tuple2). Or, take advantage of a
sealed interface and have separate types for Success and Failure.

33 2 replies Reply

See all responses

More from HabibWahid and Stackademic

In Stackademic by HabibWahid In Stackademic by Code blows

Stop Writing CRUD APIs: 5 AI Wrote ‘Perfect’ Code. My Senior


Advanced Spring Boot Patterns… Dev Rejected It. Here’s Why He W…
Basic CRUD gets you hired. These advanced Sometimes ‘works’ isn’t good enough. Here’s
patterns get you promoted. Learn what code… what AI can’t see.

Nov 11, 2025 317 14 Feb 17 1.4K 83

In Stackademic by Coding For me In Stackademic by Ashish Singh


I Tested Every AI Coding Tool for 6 10 Homebrew Packages That
Months. Only 3 Are Worth Using. Replaced My Paid Mac Apps
ChatGPT, Copilot, Claude, Cursor — I For years, I kept paying for “must‑have” Mac
measured them all. Here’s which ones actual… utilities — launchers, window managers,…

Feb 4 253 18 Feb 13 278 6

See all from HabibWahid See all from Stackademic

Recommended from Medium


In Women in Technology by Alina Kovtun In Level Up Coding by Teja Kusireddy

Stop Memorizing Design Patterns: Google Is Quietly Dismantling


Use This Decision Tree Instead Everything OpenAI Built
Choose design patterns based on pain points: The most dangerous failure in Silicon Valley
apply the right pattern with minimal over-… isn’t bankruptcy. It’s becoming the engine…

Jan 29 5.6K 46 Feb 18 4.6K 142


Phil | Rentier Digital Automation Abhinav

I Stopped Vibe Coding and Started Why Teams Are Moving Back From
“Prompt Contracts” — Claude… Microservices to Modular…
Last Tuesday at 2 AM, I deleted 2,400 lines of A conversation we need to have about
code that Claude Code had just generated fo… architectural choices

Feb 11 2.4K 59 Jan 29 415 25

In Realworld AI Use Cases by Chris Dunlop Reza Rezvani

Senior Developers — The World 10 Claude Code Commands That


Owes You an Apology Cut My Dev Time 60%: A Practical…
Why senior developers still matter in the age Custom slash commands, subagents, and
of AI coding tools — and what junior… automation workflows that transformed my…

Feb 28 1.3K 52 Nov 20, 2025 1.5K 33

See more recommendations

You might also like