Most Developers Misunderstand Abstraction (And It's Costing Them)
Here's a question:
When you use Google Maps, do you care about the satellite signals, routing algorithms, and database queries running behind the scenes?
No. You care about getting from Point A to Point B.
That's abstraction.
And most developers get it dangerously wrong.
π§ What Abstraction Actually Means
Abstraction is simply:
Identifying relevant details and ignoring irrelevant ones.
Not permanently. Not forever. Just for now.
Here's what most tutorials don't tell you:
Relevance changes based on context.
What's irrelevant in one situation becomes critical in another.
π Abstraction vs Decomposition
Let's clarify something important:
| Decomposition | Abstraction |
|---|---|
| Breaking problems INTO pieces | Deciding what to ignore IN each piece |
| "How do I divide this?" | "What matters right now?" |
| Creates smaller problems | Creates simpler views |
| Structural | Conceptual |
They work together:
- Decompose the problem into pieces
- Abstract away irrelevant details in each piece
- Solve each piece cleanly
π― The Two Types of Irrelevance
This is where most developers make mistakes.
πΉ Permanent Irrelevance
Details that never matter for your current context.
Example: Building a calculator app? You don't need to know the CPU instruction set for addition. Ever.
The abstraction is stable.
πΈ Conditional Irrelevance
Details that don't matter right now but might matter later.
This is where poor system design happens.
β οΈ The Case Study That Changes Everything
Let me walk you through something that exposes how most developers think about abstraction wrong.
An AI-Based Paper Checking System
You're building an AI system to grade student answer sheets.
What details matter?
- Student name? β (Irrelevant for grading)
- Roll number? β (Irrelevant for grading)
- Answers written? β (Critical)
- Handwriting quality? β (Maybe?)
Permanent irrelevance: Student name. Never affects the grade.
Conditional irrelevance: Handwriting quality.
Wait β why is handwriting conditional?
Because if the AI can't read the handwriting, suddenly it matters. A lot.
π§ͺ The Flaw Most Developers Miss
Here's what happens:
Developer builds the system assuming handwriting is permanently irrelevant.
System works great on typed answers.
Real deployment: Students upload handwritten papers.
System fails catastrophically.
Why? Because the developer made a permanent assumption about something that was only conditionally irrelevant.
π‘ The Lesson
Abstraction isn't about deciding what to ignore forever.
It's about deciding what to ignore for now, while keeping the door open to revisit that decision.
Senior engineers ask:
"What am I assuming is irrelevant? Will that assumption always hold?"
πΊοΈ Everyday Abstractions You Already Use
Google Maps
- Relevant: Routes, traffic, ETA
- Irrelevant: Satellite signals, database queries, routing algorithms
But if the GPS signal drops? Suddenly how maps work offline becomes relevant.
Calculator
- Relevant: Numbers, operations, result
- Irrelevant: Binary representation, CPU instructions
But if you're building a calculator for a resource-constrained embedded device? Suddenly binary representation matters.
Online Classes
- Relevant: Content, teacher's voice, presentation
- Irrelevant: Teacher's location, device being used
But if the audio cuts out? Suddenly the device and connection matter.
π§ The Developer's Version
Building a Payment System
Level 1: User view
- Relevant: Enter card, click pay, get confirmation
- Irrelevant: Encryption, bank APIs, fraud detection
Level 2: Integration view
- Relevant: API endpoints, request/response formats, error handling
- Irrelevant: UI design, user experience flows
Level 3: Security view
- Relevant: Encryption, tokenization, PCI compliance
- Irrelevant: Which bank the user chooses
Level 4: Database view
- Relevant: Transaction records, user IDs, payment status
- Irrelevant: API rate limits, third-party services
The art of abstraction is moving between these levels smoothly.
ποΈ Why Clean Architecture Works
This is exactly what clean architecture, hexagonal architecture, and layered design are about:
βββββββββββββββββββ
β UI Layer β β Knows about presentation, nothing else
βββββββββββββββββββ€
β Domain Layer β β Knows about business logic, nothing else
βββββββββββββββββββ€
β Data Layer β β Knows about databases, APIs, nothing else
βββββββββββββββββββ
Each layer abstracts away the details of other layers.
The UI doesn't know about databases. The database doesn't know about UI.
That's abstraction in practice.
π The Abstraction Trap
Most beginners (and way too many experienced devs) fall into this trap:
"I'll just create a generic function that handles everything."
That's not abstraction. That's leaky abstraction β the enemy of maintainable code.
Good abstraction answers:
- What does this piece do? (One clear thing)
- What does it NOT do? (Equally important)
- What can change without affecting it?
- What would break if I changed it?
π₯ Real Code Examples
β Bad Abstraction
function processUserData(user, action, options) {
// Does everything
if (action === 'save') { /* save to DB */ }
if (action === 'sendEmail') { /* send email */ }
if (action === 'calculateScore') { /* calculate */ }
// 100 more lines
}
β Good Abstraction
// Each does ONE thing
function saveUserToDatabase(user) { /* ... */ }
function sendWelcomeEmail(user) { /* ... */ }
function calculateUserScore(user) { /* ... */ }
// Composition handles complexity
function handleNewUser(user) {
saveUserToDatabase(user);
sendWelcomeEmail(user);
calculateUserScore(user);
}
The second version abstracts away the implementation details of each operation.
π€ Using AI The Right Way (Abstraction Edition)
Most developers ask AI:
"Write me a function that handles user authentication"
The AI gives you 200 lines of mixed concerns β database, validation, session management, email β all coupled together.
The right way:
"I need user authentication. Help me identify the different layers of abstraction:
- What does the UI need to know?
- What does the business logic handle?
- What does the data layer manage?
- What can I abstract away at each level?"
Then build each layer separately.
π§ͺ Test Your Abstraction Skills
Think about your current project. Ask:
-
If I changed the database tomorrow, what would break?
- If the answer is "everything," your data abstraction is wrong
-
If I changed the UI framework, what would break?
- If the answer is "business logic," your presentation abstraction is wrong
-
If I added a new platform (mobile, API, CLI), how much would I rewrite?
- If the answer is "most of it," your core abstraction is wrong
π The Abstraction Checklist
Before writing any code, ask:
- [ ] What's essential right now?
- [ ] What can I safely ignore for now?
- [ ] What assumptions am I making about what's irrelevant?
- [ ] Could those assumptions change later?
- [ ] Have I documented what's abstracted away?
- [ ] Can someone else understand my abstraction choices?
π The Senior Developer's Secret
Junior developers ask: "How do I make this work?"
Senior developers ask: "What should this piece know, and what should it NOT know?"
The "not know" part is abstraction.
And it's harder than writing code.
Because saying "this function doesn't handle that" is a design decision.
Saying "this layer doesn't depend on that" is architecture.
Saying "we'll solve that later" is strategy.
Abstraction is deciding what to defer, what to hide, and what to expose.
π Where Abstraction Fits in Your Journey
- Module 1.1: Concept of a Problem (What are we solving?)
- Module 1.2: Decomposition (Break it down)
- Module 1.3: Abstraction (What matters in each piece?)
- Up next: Algorithmic Thinking (Step-by-step solutions)
Each builds on the last.
Without problem definition, decomposition has no direction.
Without decomposition, abstraction has no structure.
Without abstraction, algorithms are messy.
π₯ The One Question That Changes Everything
Next time you write a function, ask:
"If I came back to this code in 6 months, what would I want hidden, and what would I want visible?"
The answer is your abstraction.
π¬ Final Thought
The best code isn't the code that's clever.
It's the code that hides the right complexity at the right time.
That's abstraction.
Not a programming concept.
A thinking concept.
Master it, and every system you build becomes simpler, cleaner, and more maintainable.
Ignore it, and you'll keep wondering why your code falls apart every time requirements change.
What's one abstraction in your current project that's leaking? Drop it in the comments β let's fix it together.
Top comments (0)