---
title: "Meaning & Key Takeaway of: Favor composition over inheritance,"
description: "\"Favor composition over inheritance,\" — Joshua Bloch"
image: "https://sms4smile.com/quotes/i/fd8/joshua-bloch-43232_composition_favor-composition-over-inheritance-73148_731484.png"
---

#  Favor composition over inheritance,

![“Favor composition over inheritance,” quote by Joshua Bloch](https://sms4smile.com/quotes/i/fd8/joshua-bloch-43232_composition_favor-composition-over-inheritance-73148_731484.png)   [Download](https://sms4smile.com/quotes/i/fd8/joshua-bloch-43232_composition_favor-composition-over-inheritance-73148_731484.png) [Open image](https://sms4smile.com/quotes/i/fd8/joshua-bloch-43232_composition_favor-composition-over-inheritance-73148_731484.png)

> “Favor composition over inheritance,”

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

## About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

Prioritize designing code by composing smaller, reusable components rather than relying on inheritance hierarchies.

**In simple terms:** Prefer composition over inheritance in code design.

Key Takeaway

Use composition for flexible, maintainable software.

Themes

software design object‑oriented programming best practices

Mood

practical educational

Type

technical instructional

When to use this quote

- API design
- refactoring
- team collaboration
- system architecture

Key Concepts

composition inheritance code reuse

Questions to Reflect On

- When might inheritance be justified?
- How does composition improve testability?

A Different Perspective

Inheritance can create rigid, fragile structures.

★ ★ ★ ★ ★   No ratings yet

[Inheritance](https://sms4smile.com/quotes/about/inheritance/) [Inspirational](https://sms4smile.com/quotes/about/inspirational/)

## Related quotes

> [“I will give you some advice, Vorarbeiter. Advice that could change your life.” “Oui, mon général?” “Doing favors,” Leyers said. “They help wondrously over…](https://sms4smile.com/quotes/mark-t-sullivan/i-will-give-you-some-advice-vorarbeiter-advice-that-could-change-your/)

[Mark T. Sullivan](https://sms4smile.com/quotes/author/mark-t-sullivan/)

> [If you want to make a friend, let someone do you a favor.](https://sms4smile.com/quotes/benjamin-franklin/if-you-want-to-make-a-friend-let-someone-do-you-a-favor/)

[Benjamin Franklin](https://sms4smile.com/quotes/author/benjamin-franklin/)

> [In case anybody asks you about my position on capital punishment, you can tell them I favor it; and if they want to know…](https://sms4smile.com/quotes/ronald-reagan/in-case-anybody-asks-you-about-my-position-on-capital-punishment-you/)

[Ronald Reagan](https://sms4smile.com/quotes/author/ronald-reagan/)

> [The favor for the favor or One hand washes the other.](https://sms4smile.com/quotes/petronius/the-favor-for-the-favor-or-one-hand-washes-the-other/)

[Petronius](https://sms4smile.com/quotes/author/petronius/)

> [Forgiveness is a favor we do for ourselves, not a favor we do to the other party.](https://sms4smile.com/quotes/harold-s-kushner/forgiveness-is-a-favor-we-do-for-ourselves-not-a-favor-we-do-to-the/)

[Harold S. Kushner](https://sms4smile.com/quotes/author/harold-s-kushner/)

> [Perhaps the only thing in my favor is that I am very tenacious. I don't take 'no' very well.](https://sms4smile.com/quotes/kathryn-bigelow/perhaps-the-only-thing-in-my-favor-is-that-i-am-very-tenacious-i-don/)

[Kathryn Bigelow](https://sms4smile.com/quotes/author/kathryn-bigelow/)

> [Unfortunately, when someone asks me for a favor, I cant say no. Because of my upbringing - my Catholic guilt - if I dont…](https://sms4smile.com/quotes/bradley-cooper/unfortunately-when-someone-asks-me-for-a-favor-i-cant-say-no-because/)

[Bradley Cooper](https://sms4smile.com/quotes/author/bradley-cooper/)

> [So can you do me a favor? If I pull it together, make it sooner than later.](https://sms4smile.com/quotes/drake/so-can-you-do-me-a-favor-if-i-pull-it-together-make-it-sooner-than/)

[Drake](https://sms4smile.com/quotes/author/drake/)

> [One person can bring favor to many during the storm.](https://sms4smile.com/quotes/beth-moore/one-person-can-bring-favor-to-many-during-the-storm/)

[Beth Moore](https://sms4smile.com/quotes/author/beth-moore/)

> [I would favor a law that no one could ever buy a gun.](https://sms4smile.com/quotes/anonymous/i-would-favor-a-law-that-no-one-could-ever-buy-a-gun/)

[Anonymous](https://sms4smile.com/quotes/author/anonymous/)

> [I favor capital punishment. It saves lives.](https://sms4smile.com/quotes/nancy-reagan/i-favor-capital-punishment-it-saves-lives/)

[Nancy Reagan](https://sms4smile.com/quotes/author/nancy-reagan/)

> [At least once a month, do something for someone who will never know who did them the friendly favor.](https://sms4smile.com/quotes/robert-cheeke/at-least-once-a-month-do-something-for-someone-who-will-never-know/)

[Robert Cheeke](https://sms4smile.com/quotes/author/robert-cheeke/)

> [No favor can win gratitude from a cat.](https://sms4smile.com/quotes/jean-de-la-fontaine/no-favor-can-win-gratitude-from-a-cat/)

[Jean de La Fontaine](https://sms4smile.com/quotes/author/jean-de-la-fontaine/)

> [I'm all in favor of NATO.](https://sms4smile.com/quotes/donald-trump/i-m-all-in-favor-of-nato/)

[Donald Trump](https://sms4smile.com/quotes/author/donald-trump/)

> [In my estimation, there should always be a mixture of economic liberalism - which means small government, a great emphasis on markets - but…](https://sms4smile.com/quotes/john-howard/in-my-estimation-there-should-always-be-a-mixture-of-economic/)

[John Howard](https://sms4smile.com/quotes/author/john-howard/)

## More by Joshua Bloch

> [When in doubt, leave it out.](https://sms4smile.com/quotes/joshua-bloch/when-in-doubt-leave-it-out/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

> [“Builder pattern is more verbose than the telescoping constructor pattern, so it should be used only if there are enough parameters, say, four or…](https://sms4smile.com/quotes/joshua-bloch/builder-pattern-is-more-verbose-than-the-telescoping-constructor/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

> [The cleaner and nicer the program, the faster it's going to run. And if it doesn't, it'll be easy to make it fast.](https://sms4smile.com/quotes/joshua-bloch/the-cleaner-and-nicer-the-program-the-faster-it-s-going-to-run-and-if/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

> [When you choose a language, you're choosing more than a set of technical trade-offs-you're choosing a community.](https://sms4smile.com/quotes/joshua-bloch/when-you-choose-a-language-you-re-choosing-more-than-a-set-of/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

> [One advantage of static factory methods is that, unlike constructors, they have names.](https://sms4smile.com/quotes/joshua-bloch/one-advantage-of-static-factory-methods-is-that-unlike-constructors/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

> [What I do instead is I will cheerfully spend literally hours on identifier names: variable names, method names, and so forth, to make my…](https://sms4smile.com/quotes/joshua-bloch/what-i-do-instead-is-i-will-cheerfully-spend-literally-hours-on/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

> [It is hard to write even the smallest piece of code correctly.](https://sms4smile.com/quotes/joshua-bloch/it-is-hard-to-write-even-the-smallest-piece-of-code-correctly/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

> [“A second advantage of static factory methods is that, unlike constructors, they are not required to create a new object each time they're invoked.”](https://sms4smile.com/quotes/joshua-bloch/a-second-advantage-of-static-factory-methods-is-that-unlike/)

[Joshua Bloch](https://sms4smile.com/quotes/author/joshua-bloch/)

[Explore all 9 Joshua Bloch quotes ](https://sms4smile.com/quotes/author/joshua-bloch/)

## More Composition quotes

> [I put myself in the student's place and remember the frustrations, doubts, determination, and desires I felt when I was going through the initial…](https://sms4smile.com/quotes/ted-martinez/i-put-myself-in-the-student-s-place-and-remember-the-frustrations/)

Ted Martinez

> [“The composition of Shakespeare is a forest, in which oaks extend in the air, interspersed sometimes with weeds and brambles, and sometimes giving shelting…](https://sms4smile.com/quotes/samuel-johnson/the-composition-of-shakespeare-is-a-forest-in-which-oaks-extend-in/)

[Samuel Johnson](https://sms4smile.com/quotes/author/samuel-johnson/)

> [At the risk of some oversimplification, if the skill composition of our work force meshed fully with the needs of our increasingly complex capital-stock,…](https://sms4smile.com/quotes/alan-greenspan/at-the-risk-of-some-oversimplification-if-the-skill-composition-of/)

[Alan Greenspan](https://sms4smile.com/quotes/author/alan-greenspan/)

> [Writers and musicians know well the importance of extensive reading for successful writing or extensive listening for musical composition. Likewise, visual artists... understand that…](https://sms4smile.com/quotes/paul-laseau/writers-and-musicians-know-well-the-importance-of-extensive-reading/)

[Paul Laseau](https://sms4smile.com/quotes/author/paul-laseau/)

> [A composition is always more than the sum of its parts. In other words, a really good piece of music is more than itself.…](https://sms4smile.com/quotes/yo-yo-ma/a-composition-is-always-more-than-the-sum-of-its-parts-in-other-words/)

[Yo-Yo Ma](https://sms4smile.com/quotes/author/yo-yo-ma/)

> [When I start writing a new imaginary future, I have no idea what it is. The characters arrive first. They help me figure out…](https://sms4smile.com/quotes/william-gibson/when-i-start-writing-a-new-imaginary-future-i-have-no-idea-what-it-is/)

[William Gibson](https://sms4smile.com/quotes/author/william-gibson/)

> [Though I cannot claim to be a Christian in the sectarian sense, the example of Jesus suffering is a factor in the composition of…](https://sms4smile.com/quotes/mahatma-gandhi/though-i-cannot-claim-to-be-a-christian-in-the-sectarian-sense-the/)

[Mahatma Gandhi](https://sms4smile.com/quotes/author/mahatma-gandhi/)

> [I always look at money not as a motivating factor but as an element in the composition. You can't ignore it, but you've got…](https://sms4smile.com/quotes/damien-hirst/i-always-look-at-money-not-as-a-motivating-factor-but-as-an-element/)

[Damien Hirst](https://sms4smile.com/quotes/author/damien-hirst/)

> [The unary Photograph has every reason to be banal, 'unity' of composition being the first rule of vulgar (and notably, of academic) rhetoric: 'The…](https://sms4smile.com/quotes/roland-barthes/the-unary-photograph-has-every-reason-to-be-banal-unity-of/)

[Roland Barthes](https://sms4smile.com/quotes/author/roland-barthes/)

> [Musical compositions, it should be remembered, do not inhabit certain countries, certain museums, like paintings and statues. The Mozart Quintet is not shut up…](https://sms4smile.com/quotes/henri-rabaud/musical-compositions-it-should-be-remembered-do-not-inhabit-certain/)

Henri Rabaud

> [Science does not enter a chaotic society to put order into it anymore, to simplify its composition, and to put an end to controversies.…](https://sms4smile.com/quotes/bruno-latour/science-does-not-enter-a-chaotic-society-to-put-order-into-it-anymore/)

[Bruno Latour](https://sms4smile.com/quotes/author/bruno-latour/)

> [If measure and symmetry are absent from any composition in any degree, ruin awaits both the ingredients and the composition... Measure and symmetry are…](https://sms4smile.com/quotes/socrates/if-measure-and-symmetry-are-absent-from-any-composition-in-any-degree/)

[Socrates](https://sms4smile.com/quotes/author/socrates/)

> [If you really want to be a good archaeologist, you have to understand ancient DNA; you have to understand chemical analysis to figure out…](https://sms4smile.com/quotes/sarah-parcak/if-you-really-want-to-be-a-good-archaeologist-you-have-to-understand/)

[Sarah Parcak](https://sms4smile.com/quotes/author/sarah-parcak/)

> [Oil companies are radical because they're willing to alter the chemical composition of the atmosphere.](https://sms4smile.com/quotes/bill-mckibben/oil-companies-are-radical-because-they-re-willing-to-alter-the/)

[Bill McKibben](https://sms4smile.com/quotes/author/bill-mckibben/)

> [Composition is definitely what I'm born to do, and it came last.](https://sms4smile.com/quotes/david-friedman/composition-is-definitely-what-i-m-born-to-do-and-it-came-last/)

[David Friedman](https://sms4smile.com/quotes/author/david-friedman/)

Browse all 766 Composition quotes

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "Favor composition over inheritance,",
            "creator": {
                "@type": "Person",
                "name": "Joshua Bloch"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/joshua-bloch/favor-composition-over-inheritance/",
            "about": {
                "@type": "Thing",
                "name": "Composition"
            },
            "@id": "https://sms4smile.com/quotes/joshua-bloch/favor-composition-over-inheritance/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/fd8/joshua-bloch-43232_composition_favor-composition-over-inheritance-73148_731484.png",
                "contentUrl": "https://sms4smile.com/quotes/i/fd8/joshua-bloch-43232_composition_favor-composition-over-inheritance-73148_731484.png",
                "url": "https://sms4smile.com/quotes/i/fd8/joshua-bloch-43232_composition_favor-composition-over-inheritance-73148_731484.png",
                "width": 1080,
                "height": 1080,
                "caption": "“Favor composition over inheritance,” — Joshua Bloch",
                "creditText": "SMS4Smile Quotes",
                "creator": {
                    "@id": "https://sms4smile.com/quotes/#organization"
                }
            }
        },
        {
            "@type": "BreadcrumbList",
            "itemListElement": [
                {
                    "@type": "ListItem",
                    "position": 1,
                    "name": "Home",
                    "item": "https://sms4smile.com/"
                },
                {
                    "@type": "ListItem",
                    "position": 2,
                    "name": "Quotes",
                    "item": "https://sms4smile.com/quotes/"
                },
                {
                    "@type": "ListItem",
                    "position": 3,
                    "name": "Joshua Bloch",
                    "item": "https://sms4smile.com/quotes/author/joshua-bloch/"
                },
                {
                    "@type": "ListItem",
                    "position": 4,
                    "name": "Favor composition over inheritance,",
                    "item": "https://sms4smile.com/quotes/joshua-bloch/favor-composition-over-inheritance/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/joshua-bloch/favor-composition-over-inheritance/#breadcrumb"
        },
        {
            "@type": "WebSite",
            "@id": "https://sms4smile.com/quotes/#website",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "publisher": {
                "@id": "https://sms4smile.com/quotes/#organization"
            }
        },
        {
            "@type": "Organization",
            "@id": "https://sms4smile.com/quotes/#organization",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "logo": {
                "@type": "ImageObject",
                "url": "https://sms4smile.com/quotes/wp-content/themes/sq/assets/icons/icon-512.png",
                "width": 512,
                "height": 512
            }
        }
    ]
}
```
