“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

Brian Goetz - “From the perspective of a class C, an...” 1

Similar quotes

“Immutable objects are simple. They can only be in one state, which is carefully controlled by the constructor. One of the most difficult elements of program design is reasoning about the possible states of complex objects. Reasoning about the state of immutable objects, on the other hand, is trivial. Immutable objects are also safer. Passing a mutable object to untrusted code, or otherwise publishing it where untrusted code could find it, is dangerous — the untrusted code might modify its state, or, worse, retain a reference to it and modify its state later from another thread. On the other hand, immutable objects cannot be subverted in this manner by malicious or buggy code, so they are safe to share and publish freely without the need to make defensive copies.”

Brian Goetz
Read more

“...[F]riendship is a method of castration that doesn't use a sharp object.”

E. Lockhart
Read more

“Methods like this act as “factories” in that they take raw materials (such as row data, for example, orconfiguration information) and use them to produce objects. The term factory is applied to codedesigned to generate object instances.”

Matt Zandstra
Read more

“As students, we have all known two types of teachers, the pedantic and the inspiring. The former have a definite method and operate according to well-established habits; the latter need neither, because they know the subject through and through, Indeed, we may say that teaching methods, which generate subjective habits, are but poor substitutes for the kind of objective intimacy with the subject matter to be taught, which we call 'habitus”

Yves Simon
Read more

“The real purpose of the scientific method is to make sure nature hasn’t misled you into thinking you know something you actually don’t know.”

Robert M. Pirsig
Read more