---
title: "Meaning & Key Takeaway of: Sometimes abstraction and encapsulation…"
description: "\"“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always a go..."
image: "https://sms4smile.com/quotes/i/e59/brian-goetz-35377_abstraction_sometimes-abstraction-and-encapsulation_2801221.jpg"
---

#  Sometimes abstraction and encapsulation are at odds with…

![“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always a good practice first to make your code right, and then make it fast.” quote by Brian Goetz](https://sms4smile.com/quotes/i/e59/brian-goetz-35377_abstraction_sometimes-abstraction-and-encapsulation_2801221.jpg)   [Download](https://sms4smile.com/quotes/i/e59/brian-goetz-35377_abstraction_sometimes-abstraction-and-encapsulation_2801221.jpg) [Open image](https://sms4smile.com/quotes/i/e59/brian-goetz-35377_abstraction_sometimes-abstraction-and-encapsulation_2801221.jpg)

> ““Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always a good practice first to make your code right, and then make it fast.””

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

## About This Quote

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

Prioritizes correctness in code before optimization, noting that abstraction and encapsulation rarely hinder performance as much as developers think.

**In simple terms:** Make code correct first, then optimize.

Key Takeaway

Write correct code before speeding it up.

Themes

software development performance abstraction encapsulation

Mood

analytical pragmatic

Type

technical instructional

When to use this quote

- System design
- code review
- performance tuning
- refactoring

Key Concepts

Software engineering principles performance optimization code correctness

Questions to Reflect On

- When should you prioritize performance over correctness?
- How do you balance abstraction with efficiency?

A Different Perspective

Overemphasis on correctness may delay needed performance improvements in time‑critical systems.

★ ★ ★ ★ ★   No ratings yet

[Abstraction](https://sms4smile.com/quotes/about/abstraction/) [Concurrency](https://sms4smile.com/quotes/about/concurrency/) [Programming](https://sms4smile.com/quotes/about/programming/) [Technology](https://sms4smile.com/quotes/about/technology/)

## Related quotes

> [“Once an object escapes, you have to assume that another class or thread may, maliciously or carelessly, misuse it. This is a compelling reason…](https://sms4smile.com/quotes/brian-goetz/once-an-object-escapes-you-have-to-assume-that-another-class-or/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in…](https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it…](https://sms4smile.com/quotes/brian-goetz/when-a-field-is-declared-volatile-the-compiler-and-runtime-are-put-on/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“It is far easier to design a class to be thread-safe than to retrofit it for thread safety later.”](https://sms4smile.com/quotes/brian-goetz/it-is-far-easier-to-design-a-class-to-be-thread-safe-than-to-retrofit/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.”](https://sms4smile.com/quotes/brian-goetz/locking-can-guarantee-both-visibility-and-atomicity-volatile/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Immutable objects are simple. They can only be in one state, which is carefully controlled by the constructor. One of the most difficult elements…](https://sms4smile.com/quotes/brian-goetz/immutable-objects-are-simple-they-can-only-be-in-one-state-which-is/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and…](https://sms4smile.com/quotes/brian-goetz/debugging-tip-for-server-applications-be-sure-to-always-specify-the/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Compound actions on shared state, such as incrementing a hit counter (read-modify-write) or lazy initialization (check-then-act), must be made atomic to avoid race conditions.…](https://sms4smile.com/quotes/brian-goetz/compound-actions-on-shared-state-such-as-incrementing-a-hit-counter/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Accessing shared, mutable data requires using synchronization; one way to avoid this requirement is to not share. If data is only accessed from a…](https://sms4smile.com/quotes/brian-goetz/accessing-shared-mutable-data-requires-using-synchronization-one-way/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“The possibility of incorrect results in the presence of unlucky timing is so important in concurrent programming that it has a name: a race…](https://sms4smile.com/quotes/brian-goetz/the-possibility-of-incorrect-results-in-the-presence-of-unlucky/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make…](https://sms4smile.com/quotes/brian-goetz/just-as-it-is-a-good-practice-to-make-all-fields-private-unless-they/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Whenever more than one thread accesses a given state variable, and one of them might write to it, they all must coordinate their access…](https://sms4smile.com/quotes/brian-goetz/whenever-more-than-one-thread-accesses-a-given-state-variable-and-one/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Using a method to change a property is another example of encapsulation whereby we can often improve the maintainability and extensibility of code by…](https://sms4smile.com/quotes/eric-freeman/using-a-method-to-change-a-property-is-another-example-of/)

[Eric Freeman](https://sms4smile.com/quotes/author/eric-freeman/)

> [ \[Logo\] is an encapsulation of an emotion. ](https://sms4smile.com/quotes/martin-lindstrom/logo-is-an-encapsulation-of-an-emotion/)

[Martin Lindstrom](https://sms4smile.com/quotes/author/martin-lindstrom/)

> [In my experience, you either have encapsulation and abstraction or you have neither. There is no middle ground.](https://sms4smile.com/quotes/steve-mcconnell/in-my-experience-you-either-have-encapsulation-and-abstraction-or-you/)

[Steve McConnell](https://sms4smile.com/quotes/author/steve-mcconnell/)

## More by Brian Goetz

> [“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in…](https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Whenever more than one thread accesses a given state variable, and one of them might write to it, they all must coordinate their access…](https://sms4smile.com/quotes/brian-goetz/whenever-more-than-one-thread-accesses-a-given-state-variable-and-one/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Once an object escapes, you have to assume that another class or thread may, maliciously or carelessly, misuse it. This is a compelling reason…](https://sms4smile.com/quotes/brian-goetz/once-an-object-escapes-you-have-to-assume-that-another-class-or/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make…](https://sms4smile.com/quotes/brian-goetz/just-as-it-is-a-good-practice-to-make-all-fields-private-unless-they/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“The possibility of incorrect results in the presence of unlucky timing is so important in concurrent programming that it has a name: a race…](https://sms4smile.com/quotes/brian-goetz/the-possibility-of-incorrect-results-in-the-presence-of-unlucky/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Accessing shared, mutable data requires using synchronization; one way to avoid this requirement is to not share. If data is only accessed from a…](https://sms4smile.com/quotes/brian-goetz/accessing-shared-mutable-data-requires-using-synchronization-one-way/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and…](https://sms4smile.com/quotes/brian-goetz/debugging-tip-for-server-applications-be-sure-to-always-specify-the/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Immutable objects are simple. They can only be in one state, which is carefully controlled by the constructor. One of the most difficult elements…](https://sms4smile.com/quotes/brian-goetz/immutable-objects-are-simple-they-can-only-be-in-one-state-which-is/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.”](https://sms4smile.com/quotes/brian-goetz/locking-can-guarantee-both-visibility-and-atomicity-volatile/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“It is far easier to design a class to be thread-safe than to retrofit it for thread safety later.”](https://sms4smile.com/quotes/brian-goetz/it-is-far-easier-to-design-a-class-to-be-thread-safe-than-to-retrofit/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it…](https://sms4smile.com/quotes/brian-goetz/when-a-field-is-declared-volatile-the-compiler-and-runtime-are-put-on/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

> [“Compound actions on shared state, such as incrementing a hit counter (read-modify-write) or lazy initialization (check-then-act), must be made atomic to avoid race conditions.…](https://sms4smile.com/quotes/brian-goetz/compound-actions-on-shared-state-such-as-incrementing-a-hit-counter/)

[Brian Goetz](https://sms4smile.com/quotes/author/brian-goetz/)

[Explore all 13 Brian Goetz quotes ](https://sms4smile.com/quotes/author/brian-goetz/)

## More Abstraction quotes

> [Everything in dancing is style, allusion, the essence of many thoughts and feelings. The abstraction of many moments.](https://sms4smile.com/quotes/alvin-ailey/everything-in-dancing-is-style-allusion-the-essence-of-many-thoughts/)

[Alvin Ailey](https://sms4smile.com/quotes/author/alvin-ailey/)

> [The premises from which we begin are not arbitrary ones, not dogmas, but real premises from which abstraction can only be made in the…](https://sms4smile.com/quotes/melchor-lim/the-premises-from-which-we-begin-are-not-arbitrary-ones-not-dogmas/)

[Melchor Lim](https://sms4smile.com/quotes/author/melchor-lim/)

> [Two elements are needed to form a truth - a fact and an abstraction](https://sms4smile.com/quotes/remy-de-gourmont/two-elements-are-needed-to-form-a-truth-a-fact-and-an-abstraction/)

[Remy de Gourmont](https://sms4smile.com/quotes/author/remy-de-gourmont/)

> [But we must not underestimate the potency of the mathematical process of abstraction. A surprising variety of things happen to have both magnitude and…](https://sms4smile.com/quotes/banesh-hoffmann/but-we-must-not-underestimate-the-potency-of-the-mathematical-process/)

Banesh Hoffmann

> [Sometimes I start in a very realistic fashion, and as I go on from one painting to another of the same kind, it becomes…](https://sms4smile.com/quotes/georgia-o-keeffe/sometimes-i-start-in-a-very-realistic-fashion-and-as-i-go-on-from-one/)

[Georgia O'Keeffe](https://sms4smile.com/quotes/author/georgia-o-keeffe/)

> [I like residing in abstraction.](https://sms4smile.com/quotes/sufjan-stevens/i-like-residing-in-abstraction/)

[Sufjan Stevens](https://sms4smile.com/quotes/author/sufjan-stevens/)

> [Cancer begins and ends with people. In the midst of scientific abstraction, it is sometimes possible to forget this one basic fact. Doctors treat…](https://sms4smile.com/quotes/june-goodfield/cancer-begins-and-ends-with-people-in-the-midst-of-scientific/)

[June Goodfield](https://sms4smile.com/quotes/author/june-goodfield/)

> [Yes, there was an element of abstraction and unreality in misfortune. But when an abstraction starts to kill you, you have to get to…](https://sms4smile.com/quotes/albert-camus/yes-there-was-an-element-of-abstraction-and-unreality-in-misfortune/)

[Albert Camus](https://sms4smile.com/quotes/author/albert-camus/)

> [Computer Science is a science of abstraction -creating the right model for a problem and devising the appropriate mechanizable techniques to solve it.](https://sms4smile.com/quotes/alfred-aho/computer-science-is-a-science-of-abstraction-creating-the-right-model/)

Alfred Aho

> [In 'Self Comes to Mind' I pay a lot of attention to simple creatures without brains or minds, because those 'cartooned abstractions of who…](https://sms4smile.com/quotes/antonio-damasio/in-self-comes-to-mind-i-pay-a-lot-of-attention-to-simple-creatures/)

[Antonio Damasio](https://sms4smile.com/quotes/author/antonio-damasio/)

> [Don't get stuck on the level of words. A word is no more than a means to an end. It's an abstraction. Not unlike…](https://sms4smile.com/quotes/eckhart-tolle/don-t-get-stuck-on-the-level-of-words-a-word-is-no-more-than-a-means/)

[Eckhart Tolle](https://sms4smile.com/quotes/author/eckhart-tolle/)

> [Holidays are in no sense an alternative to the congestion and bustle of the cities and work. Quite the contrary. People look to escape…](https://sms4smile.com/quotes/jean-baudrillard/holidays-are-in-no-sense-an-alternative-to-the-congestion-and-bustle/)

[Jean Baudrillard](https://sms4smile.com/quotes/author/jean-baudrillard/)

> [The pragmatist turns away from abstraction and insufficiency, from verbal solutions, from bad a priori reasons, from fixed principles, closed systems, and pretended absolutes…](https://sms4smile.com/quotes/william-james/the-pragmatist-turns-away-from-abstraction-and-insufficiency-from/)

[William James](https://sms4smile.com/quotes/author/william-james/)

> [ I'd say that \[Louis\] Brandeis practiced a kind of a "living originalism," to use the title of Jack Balkin's great book. He said you… ](https://sms4smile.com/quotes/jeffrey-rosen/i-d-say-that-louis-brandeis-practiced-a-kind-of-a-living-originalism/)

[Jeffrey Rosen](https://sms4smile.com/quotes/author/jeffrey-rosen/)

> [When novels deal in abstractions, they generally go off the rails.](https://sms4smile.com/quotes/philipp-meyer/when-novels-deal-in-abstractions-they-generally-go-off-the-rails/)

[Philipp Meyer](https://sms4smile.com/quotes/author/philipp-meyer/)

[Browse all 562 Abstraction quotes ](https://sms4smile.com/quotes/about/abstraction/)

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always a good practice first to make your code right, and then make it fast.”",
            "creator": {
                "@type": "Person",
                "name": "Brian Goetz"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/",
            "about": {
                "@type": "Thing",
                "name": "Abstraction"
            },
            "@id": "https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/e59/brian-goetz-35377_abstraction_sometimes-abstraction-and-encapsulation_2801221.jpg",
                "contentUrl": "https://sms4smile.com/quotes/i/e59/brian-goetz-35377_abstraction_sometimes-abstraction-and-encapsulation_2801221.jpg",
                "url": "https://sms4smile.com/quotes/i/e59/brian-goetz-35377_abstraction_sometimes-abstraction-and-encapsulation_2801221.jpg",
                "width": 1080,
                "height": 1080,
                "caption": "“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many…” — Brian Goetz",
                "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": "Brian Goetz",
                    "item": "https://sms4smile.com/quotes/author/brian-goetz/"
                },
                {
                    "@type": "ListItem",
                    "position": 4,
                    "name": "“Sometimes abstraction and encapsulation are at...",
                    "item": "https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/#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
            }
        }
    ]
}
```
