<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2" -->

---
title: You Think This Is Good OOP… It’s Not | daily.dev
description: A walkthrough of six common object-oriented programming mistakes developers mistake for good design: using inheritance to borrow implementation details instead...
canonical: https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: You Think This Is Good OOP… It’s Not | daily.dev
og:description: A walkthrough of six common object-oriented programming mistakes developers mistake for good design: using inheritance to borrow implementation details instead...
og:url: https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2
og:image: https://api.daily.dev/og/posts/XiYI7LFz2.png
og:image:alt: You Think This Is Good OOP… It’s Not
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.

# You Think This Is Good OOP… It’s Not

**[ArjanCodes](https://daily.dev/sources/arjancodes)** · 19 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of six common object-oriented programming mistakes developers mistake for good design: using inheritance to borrow implementation details instead of composition, turning configuration values into subclass hierarchies, modeling independent features as inheritance chains, creating a god base class that forces one shape on everything, creating subtypes that violate the Liskov substitution principle, and abstracting before understanding real similarity. Each mistake is illustrated with Python code examples and refactored using composition, protocols, data classes, and plain functions instead of inheritance.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=RqcEK7sWesQ>

## Questions this post answers

### Why should I use composition instead of inheritance when a class only needs one method from another class?

Inheritance implies an is-a relationship, so inheriting just to reuse a method (like a report class inheriting from a database and a logger) misrepresents the relationship. Composition is preferable: pass the needed objects into the constructor and store them as instance attributes, then call their methods directly, which also makes the class easier to test by substituting dependencies.

_daily.dev surfaces design-pattern discussions like composition versus inheritance for developers refining their code structure._

### What is stamp coupling and why is a large base class with many methods a problem?

Stamp coupling occurs when a function receives an entire object with many methods but only needs one or two of them, such as passing a full base store integration class to a function that only requires an authenticate method. This risks accidental misuse of unrelated methods and creates cohesion and coupling problems. The fix is interface segregation: define small protocols for exactly the capabilities needed, like separate authenticated and inventory-source protocols.

_developers untangling coupling issues can find deep dives on interface segregation through daily.dev._

### How does the Liskov substitution principle apply to a read-only subclass that overrides a write method to raise an error?

A subclass violates Liskov substitution when it breaks a guarantee the parent type makes, such as a read-only queue subclass that overrides an add method to throw a runtime error instead of adding an item, even though it is still accepted anywhere the parent order queue is expected. The fix is separating contracts into distinct reader and writer protocols so incompatible behaviors are caught as type errors instead of runtime failures.

_daily.dev helps developers keep Liskov substitution and other design principles top of mind while refactoring class hierarchies._

## Similar posts on daily.dev

- [Fifty Shades of OOP](https://daily.dev/posts/fifty-shades-of-oop-o9n8jaztw) · Lobsters · 1 upvotes · 0 comments
- [Why Your Software Sucks: Inheritance](https://daily.dev/posts/why-your-software-sucks-inheritance-pnnmgu4k8) · Aaronontheweb · 28 upvotes · 3 comments
- [Python Inheritance Explained: Stop Rewriting the Same Code](https://daily.dev/posts/python-inheritance-explained-stop-rewriting-the-same-code-3cowc9agk) · Medium · 0 upvotes · 0 comments
- [Design and Guidance: Object-Oriented Programming in Python Quiz – Real Python](https://daily.dev/posts/design-and-guidance-object-oriented-programming-in-python-quiz-real-python-wtcacu1s6) · Real Python · 1 upvotes · 0 comments

---

Tags: [#general-programming](https://daily.dev/tags/general-programming), [#python](https://daily.dev/tags/python), [#design-patterns](https://daily.dev/tags/design-patterns)

[View this post on daily.dev](https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2)

```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":"You Think This Is Good OOP… It’s Not","url":"https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2"},"datePublished":"2026-08-28T15:02:22.412Z","dateModified":"2026-09-14T07:56:19.886Z","description":"A walkthrough of six common object-oriented programming mistakes developers mistake for good design: using inheritance to borrow implementation details instead...","image":"https://i.ytimg.com/vi/RqcEK7sWesQ/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/RqcEK7sWesQ/sddefault.jpg","isAccessibleForFree":true,"articleSection":"ArjanCodes","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":"ArjanCodes","logo":"https://media.daily.dev/image/upload/s--QX1BCjx9--/f_auto,q_auto/v1777800752/logos/arjancodes?_a=BAMAMiWQ0","url":"https://daily.dev/sources/arjancodes"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"general-programming,python,design-patterns","timeRequired":"PT19M","video":{"@type":"VideoObject","name":"You Think This Is Good OOP… It’s Not","description":"A walkthrough of six common object-oriented programming mistakes developers mistake for good design: using inheritance to borrow implementation details instead...","thumbnailUrl":"https://i.ytimg.com/vi/RqcEK7sWesQ/sddefault.jpg","uploadDate":"2026-08-28T15:02:22.412Z","duration":"PT19M","url":"https://api.daily.dev/r/XiYI7LFz2","embedUrl":"https://www.youtube.com/embed/RqcEK7sWesQ"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ArjanCodes","item":"https://daily.dev/sources/arjancodes"},{"@type":"ListItem","position":3,"name":"You Think This Is Good OOP… It’s Not"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/you-think-this-is-good-oop-it-s-not-xiyi7lfz2#faq","mainEntity":[{"@type":"Question","name":"Why should I use composition instead of inheritance when a class only needs one method from another class?","acceptedAnswer":{"@type":"Answer","text":"Inheritance implies an is-a relationship, so inheriting just to reuse a method (like a report class inheriting from a database and a logger) misrepresents the relationship. Composition is preferable: pass the needed objects into the constructor and store them as instance attributes, then call their methods directly, which also makes the class easier to test by substituting dependencies. daily.dev surfaces design-pattern discussions like composition versus inheritance for developers refining their code structure."}},{"@type":"Question","name":"What is stamp coupling and why is a large base class with many methods a problem?","acceptedAnswer":{"@type":"Answer","text":"Stamp coupling occurs when a function receives an entire object with many methods but only needs one or two of them, such as passing a full base store integration class to a function that only requires an authenticate method. This risks accidental misuse of unrelated methods and creates cohesion and coupling problems. The fix is interface segregation: define small protocols for exactly the capabilities needed, like separate authenticated and inventory-source protocols. developers untangling coupling issues can find deep dives on interface segregation through daily.dev."}},{"@type":"Question","name":"How does the Liskov substitution principle apply to a read-only subclass that overrides a write method to raise an error?","acceptedAnswer":{"@type":"Answer","text":"A subclass violates Liskov substitution when it breaks a guarantee the parent type makes, such as a read-only queue subclass that overrides an add method to throw a runtime error instead of adding an item, even though it is still accepted anywhere the parent order queue is expected. The fix is separating contracts into distinct reader and writer protocols so incompatible behaviors are caught as type errors instead of runtime failures. daily.dev helps developers keep Liskov substitution and other design principles top of mind while refactoring class hierarchies."}}]}
```

