<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9" -->

---
title: Abstraction Is Not Merely Hiding Complex Code | daily.dev
description: Abstraction in real software services is more than hiding implementation details behind a function or class name — it's a deliberate decision about what to...
canonical: https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Abstraction Is Not Merely Hiding Complex Code | daily.dev
og:description: Abstraction in real software services is more than hiding implementation details behind a function or class name — it's a deliberate decision about what to...
og:url: https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9
og:image: https://api.daily.dev/og/posts/tvFKGxUC9.png
og:image:alt: Abstraction Is Not Merely Hiding Complex Code
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Abstraction Is Not Merely Hiding Complex Code

**[Medium](https://daily.dev/sources/medium_js)** · 17 min read · 0 upvotes · 1 comments

## Summary

Abstraction in real software services is more than hiding implementation details behind a function or class name — it's a deliberate decision about what to reveal versus conceal. Using a coupon-issuance service as a running example, the piece walks through common pitfalls: vague function names that erase meaning, leaking database or API types through interfaces, forcing dissimilar operations into one generic function, over-parameterized functions that hide complexity in options rather than removing it, premature abstraction for speculative future needs, and collapsing distinct failure types into one generic error. It argues that good abstraction places complexity where it belongs, keeps stable service roles separate from volatile implementations, and always weighs the indirection cost against the complexity it hides.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://vxdeveloper.medium.com/abstraction-is-not-merely-hiding-complex-code-b9519f526251>

## Questions this post answers

### How do I design a repository interface so it doesn't leak Prisma or database types into my business logic?

Define the repository interface using service-level concepts, such as a save method that accepts and returns a domain Coupon type, rather than Prisma-specific types like Prisma.CouponCreateInput or PrismaCoupon. The concrete Prisma implementation converts between database rows and the domain model internally, so callers depend only on the Coupon concept, not on database schema details.

_daily.dev surfaces practical patterns like this for developers refining their service boundaries._

### Why shouldn't I combine similar-looking functions like email and push notification sending into one generic function?

Combining them forces callers to understand type strings and conditional branches instead of a clear purpose, and couples code that may change for different reasons. Instead, define a role-based contract like notifyCouponIssued that different implementations (email, push, or multi-channel) can satisfy, so the use case depends on the notification purpose rather than delivery mechanics.

_Developers weighing shared code versus separate abstractions can find this kind of design reasoning on daily.dev._

### When should I avoid creating an abstraction like a strategy factory for a feature that only has one implementation?

Avoid it until a second implementation or concrete change requirement actually exists. Introducing a DiscountStrategyFactory for a single discount method is speculative design that adds indirection without current benefit, and if the real future need differs from the guess, the premature abstraction creates more code to rework than starting with a plain, concrete function.

_Teams debating when to abstract versus keep things concrete can track this reasoning on daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@nark3d** · 0 upvotes

> Exactly.  I tried folding two similar-looking operations into one function behind a flag and it read fine for about a month, then every caller started passing the flag to mean something slightly different and the body grew a branch per caller.  Splitting it back into two functions with honest names was less code than the flag ever needed.  The failure mode is treating the interface as the place to save typing rather than the place to decide what callers should be able to say.

## Similar posts on daily.dev

- [Abstractions That Heal, Abstractions That Harm](https://daily.dev/posts/abstractions-that-heal-abstractions-that-harm-byjb3ozq1) · We Are .NET · 58 upvotes · 3 comments
- [Your job isn't programming](https://daily.dev/posts/your-job-isn-t-programming-9tv8vusyc) · Lobsters · 1 upvotes · 1 comments
- [You're Not Building Netflix: Stop Coding Like You Are](https://daily.dev/posts/you-re-not-building-netflix-stop-coding-like-you-are-fvaumfnpy) · DEV · 672 upvotes · 56 comments
- [The 'Hidden' Costs of Great Abstractions](https://daily.dev/posts/the-hidden-costs-of-great-abstractions-u2wlkrp6a) · Hacker News · 1 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#typescript](https://daily.dev/tags/typescript), [#design-patterns](https://daily.dev/tags/design-patterns)

[View this post on daily.dev](https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Abstraction Is Not Merely Hiding Complex Code","url":"https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9"},"datePublished":"2026-09-11T00:02:14.071Z","dateModified":"2026-10-15T02:22:10.680Z","description":"Abstraction in real software services is more than hiding implementation details behind a function or class name — it's a deliberate decision about what to...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"architecture,typescript,design-patterns","timeRequired":"PT17M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Abstraction Is Not Merely Hiding Complex Code"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9","comment":[{"@type":"Comment","text":"Exactly.  I tried folding two similar-looking operations into one function behind a flag and it read fine for about a month, then every caller started passing the flag to mean something slightly different and the body grew a branch per caller.  Splitting it back into two functions with honest names was less code than the flag ever needed.  The failure mode is treating the interface as the place to save typing rather than the place to decide what callers should be able to say.","datePublished":"2026-09-19T16:27:21.484Z","url":"https://daily.dev/posts/tvFKGxUC9#c-ivuZ6EK2M","author":{"@type":"Person","name":"Adam","url":"https://daily.dev/nark3d","image":"https://avatars.githubusercontent.com/u/2162621?v=4"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/abstraction-is-not-merely-hiding-complex-code-tvfkgxuc9#faq","mainEntity":[{"@type":"Question","name":"How do I design a repository interface so it doesn't leak Prisma or database types into my business logic?","acceptedAnswer":{"@type":"Answer","text":"Define the repository interface using service-level concepts, such as a save method that accepts and returns a domain Coupon type, rather than Prisma-specific types like Prisma.CouponCreateInput or PrismaCoupon. The concrete Prisma implementation converts between database rows and the domain model internally, so callers depend only on the Coupon concept, not on database schema details. daily.dev surfaces practical patterns like this for developers refining their service boundaries."}},{"@type":"Question","name":"Why shouldn't I combine similar-looking functions like email and push notification sending into one generic function?","acceptedAnswer":{"@type":"Answer","text":"Combining them forces callers to understand type strings and conditional branches instead of a clear purpose, and couples code that may change for different reasons. Instead, define a role-based contract like notifyCouponIssued that different implementations (email, push, or multi-channel) can satisfy, so the use case depends on the notification purpose rather than delivery mechanics. Developers weighing shared code versus separate abstractions can find this kind of design reasoning on daily.dev."}},{"@type":"Question","name":"When should I avoid creating an abstraction like a strategy factory for a feature that only has one implementation?","acceptedAnswer":{"@type":"Answer","text":"Avoid it until a second implementation or concrete change requirement actually exists. Introducing a DiscountStrategyFactory for a single discount method is speculative design that adds indirection without current benefit, and if the real future need differs from the guess, the premature abstraction creates more code to rework than starting with a plain, concrete function. Teams debating when to abstract versus keep things concrete can track this reasoning on daily.dev."}}]}
```

