---
title: "Meaning & Key Takeaway of: From the perspective of a class C, an…"
description: "\"“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in other classes as well a..."
image: "https://sms4smile.com/quotes/i/bde/brian-goetz-35377_concurrency_from-the-perspective-of-a-class-c-an-ali_646170.jpg"
---

#  From the perspective of a class C, an alien method is one…

![“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in other classes as well as overrideable methods (neither private nor final) in C itself. Passing an object to an alien method must also be considered publishing that object…” quote by Brian Goetz](https://sms4smile.com/quotes/i/bde/brian-goetz-35377_concurrency_from-the-perspective-of-a-class-c-an-ali_646170.jpg)   [Download](https://sms4smile.com/quotes/i/bde/brian-goetz-35377_concurrency_from-the-perspective-of-a-class-c-an-ali_646170.jpg) [Open image](https://sms4smile.com/quotes/i/bde/brian-goetz-35377_concurrency_from-the-perspective-of-a-class-c-an-ali_646170.jpg)

> ““From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in other classes as well as overrideable methods (neither private nor final) in C itself. Passing an object to an alien method must also be considered publishing that object. Since you can’t know what code will actually be invoked, you don’t know that the alien method won’t publish the object or retain a reference to it that might later be used from another thread.””

[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.

An alien method’s behavior is unspecified, making it unsafe to pass objects because they may be published or retained, leading to thread‑safety risks.

**In simple terms:** Unsafe to share objects with unknown methods.

Key Takeaway

Avoid passing objects to unknown code.

Themes

software engineering concurrency security

Mood

analytical cautious

Type

technical educational

When to use this quote

- code reviews
- secure coding guidelines
- multithreaded testing

Key Concepts

thread safety object publishing API design

Questions to Reflect On

- How can you verify method safety?
- What design patterns mitigate these risks?

A Different Perspective

May limit flexibility in API usage.

★ ★ ★ ★ ★   No ratings yet

[Alien](https://sms4smile.com/quotes/about/alien/) [Concurrency](https://sms4smile.com/quotes/about/concurrency/) [Habits](https://sms4smile.com/quotes/about/habits/) [Programming](https://sms4smile.com/quotes/about/programming/) [Technology](https://sms4smile.com/quotes/about/technology/)

## Related quotes

> [“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/)

> [“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/)

> [“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always…](https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/)

[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/)

> [“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/)

> [“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/)

> [“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/)

> [I've met some serious aliens in my life, for sure. I'm sure you've seen a UFO. Haven't all of us seen something flying in…](https://sms4smile.com/quotes/alicia-keys/i-ve-met-some-serious-aliens-in-my-life-for-sure-i-m-sure-you-ve-seen/)

[Alicia Keys](https://sms4smile.com/quotes/author/alicia-keys/)

> [I don't know if I'd go with an alien to space. I would have to feel the alien's vibe. I'm a vibe person.](https://sms4smile.com/quotes/alicia-keys/i-don-t-know-if-i-d-go-with-an-alien-to-space-i-would-have-to-feel/)

[Alicia Keys](https://sms4smile.com/quotes/author/alicia-keys/)

> [When I learned that aliens really do exist, I wasn't too surprised. But what did shock me when I started investigating extra-terrestrial reports a…](https://sms4smile.com/quotes/edgar-mitchell/when-i-learned-that-aliens-really-do-exist-i-wasn-t-too-surprised-but/)

[Edgar Mitchell](https://sms4smile.com/quotes/author/edgar-mitchell/)

## More by 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/)

> [“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always…](https://sms4smile.com/quotes/brian-goetz/sometimes-abstraction-and-encapsulation-are-at-odds-with-performance/)

[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 Alien quotes

> [If you're going to immerse yourself in a project for three years, why not stake out a chunk of the world that is completely…](https://sms4smile.com/quotes/richard-powers/if-you-re-going-to-immerse-yourself-in-a-project-for-three-years-why/)

[Richard Powers](https://sms4smile.com/quotes/author/richard-powers/)

> [“If you are an alien, how come you sound like you're from the north?' 'Lots of planets have a north!”](https://sms4smile.com/quotes/russell-t-davies/if-you-are-an-alien-how-come-you-sound-like-you-re-from-the-north/)

[Russell T Davies](https://sms4smile.com/quotes/author/russell-t-davies/)

> [Some pundits have proposed that the aliens have come here to breed with us. Apparently, too much bike riding or something similar has rendered…](https://sms4smile.com/quotes/seth-shostak/some-pundits-have-proposed-that-the-aliens-have-come-here-to-breed/)

[Seth Shostak](https://sms4smile.com/quotes/author/seth-shostak/)

> [North Korea is still my homeland, my country. I suffered on the outside because I was alien, without identity. I was nobody. I was…](https://sms4smile.com/quotes/lee-hyeon-seo/north-korea-is-still-my-homeland-my-country-i-suffered-on-the-outside/)

[Lee Hyeon-seo](https://sms4smile.com/quotes/author/lee-hyeon-seo/)

> [I don't want to be the embarrassment of the galaxy to have had the power to deflect an asteroid, and then not and end…](https://sms4smile.com/quotes/neil-degrasse-tyson/i-don-t-want-to-be-the-embarrassment-of-the-galaxy-to-have-had-the/)

[Neil deGrasse Tyson](https://sms4smile.com/quotes/author/neil-degrasse-tyson/)

> [Whatever is not commonly seen is condemned as alien.](https://sms4smile.com/quotes/iris-chang/whatever-is-not-commonly-seen-is-condemned-as-alien/)

[Iris Chang](https://sms4smile.com/quotes/author/iris-chang/)

> [Alien's a great one. That's a scary movie.](https://sms4smile.com/quotes/judd-nelson/alien-s-a-great-one-that-s-a-scary-movie/)

[Judd Nelson](https://sms4smile.com/quotes/author/judd-nelson/)

> [As far as I can tell, the only unambiguous consequence of the claimed invasion of Earth by beings from another star system has been…](https://sms4smile.com/quotes/seth-shostak/as-far-as-i-can-tell-the-only-unambiguous-consequence-of-the-claimed/)

[Seth Shostak](https://sms4smile.com/quotes/author/seth-shostak/)

> [Rick stared at him. "Your brother is an alien." "Yeah, but he's a cute one.](https://sms4smile.com/quotes/mira-grant/rick-stared-at-him-your-brother-is-an-alien-yeah-but-he-s-a-cute-one/)

[Mira Grant](https://sms4smile.com/quotes/author/mira-grant/)

> [You tell me you love me, but Im not sure you know what love is, or how fast it flies, or how much it…](https://sms4smile.com/quotes/hussein-nishah/you-tell-me-you-love-me-but-im-not-sure-you-know-what-love-is-or-how/)

[Hussein Nishah](https://sms4smile.com/quotes/author/hussein-nishah/)

> [Give consideration to the fact that alien astronomers could have scrutinized Earth for more than 4 billion years without detecting any radio signals, despite…](https://sms4smile.com/quotes/seth-shostak/give-consideration-to-the-fact-that-alien-astronomers-could-have/)

[Seth Shostak](https://sms4smile.com/quotes/author/seth-shostak/)

> [“When I was a kid, I used to watch that show, sitting on the couch in my pajamas and wishing more than anything that…](https://sms4smile.com/quotes/michael-thomas-ford/when-i-was-a-kid-i-used-to-watch-that-show-sitting-on-the-couch-in-my/)

[Michael Thomas Ford](https://sms4smile.com/quotes/author/michael-thomas-ford/)

> [We of alien looks or words must stick together.](https://sms4smile.com/quotes/c-j-sansom/we-of-alien-looks-or-words-must-stick-together/)

[C.J. Sansom](https://sms4smile.com/quotes/author/c-j-sansom/)

> [One of the most interesting things for me in playing another species is that you want to make them different enough to be alien…](https://sms4smile.com/quotes/jaime-murray/one-of-the-most-interesting-things-for-me-in-playing-another-species/)

[Jaime Murray](https://sms4smile.com/quotes/author/jaime-murray/)

> [In a movie, it's often important to have aliens whose gestures and facial expressions can be 'read' by humans. And in the days before…](https://sms4smile.com/quotes/seth-shostak/in-a-movie-it-s-often-important-to-have-aliens-whose-gestures-and/)

[Seth Shostak](https://sms4smile.com/quotes/author/seth-shostak/)

[Browse all 709 Alien quotes ](https://sms4smile.com/quotes/about/alien/)

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in other classes as well as overrideable methods (neither private nor final) in C itself. Passing an object to an alien method must also be considered publishing that object. Since you can’t know what code will actually be invoked, you don’t know that the alien method won’t publish the object or retain a reference to it that might later be used from another thread.”",
            "creator": {
                "@type": "Person",
                "name": "Brian Goetz"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/",
            "about": {
                "@type": "Thing",
                "name": "Alien"
            },
            "@id": "https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/bde/brian-goetz-35377_concurrency_from-the-perspective-of-a-class-c-an-ali_646170.jpg",
                "contentUrl": "https://sms4smile.com/quotes/i/bde/brian-goetz-35377_concurrency_from-the-perspective-of-a-class-c-an-ali_646170.jpg",
                "url": "https://sms4smile.com/quotes/i/bde/brian-goetz-35377_concurrency_from-the-perspective-of-a-class-c-an-ali_646170.jpg",
                "width": 1080,
                "height": 1080,
                "caption": "“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This…” — 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": "“From the perspective of a class...",
                    "item": "https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/brian-goetz/from-the-perspective-of-a-class-c-an-alien-method-is-one-whose/#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
            }
        }
    ]
}
```
