“One advantage of static factory methods is that, unlike constructors, they have names.”
“Learning the art of programming, like most other disciplines, consists of first learning the rules and then learning when to break them.”
“Collection or an appropriate subtype is generally the best return type for a public, sequence- returning method.”
“Writing concurrent programs in Java keeps getting easier, but writing concurrent programs that are correct and fast is as difficult as it ever was.”
“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.”
“If you export a nontrivial interface, you should strongly consider providing a skeletal implementation to go with it. To the extent possible, you should provide the skeletal implementation via default methods on the interface so that all implementors of the interface can make use of it.”
“Implementing a constant interface causes this implementation detail to leak into the class’s exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface.”
“You can put any element into a collection with a raw type, easily corrupting the collection’s type invariant (as demonstrated by the unsafeAdd method on page 119); you can’t put any ele- ment (other than null) into a Collection<?>.”
“arrays are covariant. This scary-sounding word means simply that if Sub is a subtype of Super, then the array type Sub[] is a subtype of the array type Super[]. Generics, by contrast, are invariant: for any two distinct types Type1 and Type2, List is neither a subtype nor a supertype of List. You might think this means that generics are deficient, but arguably it is arrays that are deficient.”
“A forEach operation that does anything more than present the result of the computation performed by a stream is a “bad smell in code,” as is a lambda that mutates state.”
“streams do not make iteration obsolete”
“premature optimization is the root of all evil. —Donald E. Knuth [”
“In other words, it is about 50 times slower to create and destroy objects with finalizers.”
“In fact, two-thirds of the uses of the close method in the Java libraries were wrong in 2007.”
“There is no way to extend an instantiable class and add a value component while preserving the equals contract, unless you’re willing to forgo the benefits of object-oriented abstraction.”
“Given all the problems associated with Cloneable, new interfaces should not extend it, and new extendable classes should not implement it.”
“It is too early to say whether modules will achieve widespread use outside of the JDK itself. In the meantime, it seems best to avoid them unless you have a compelling need.”
“Builder pattern is more verbose than the telescoping constructor pattern, so it should be used only if there are enough parameters, say, four or more.”
“I think nighttime is dark so you can imagine your fears with less distraction.”
“I have always shook with fright before human beings. Unable as I was to feel the least particle of confidence in my ability to speak and act like a human being, I kept my solitary agonies locked in my breast. I kept my melancholy and my agitation hidden, careful lest any trace should be left exposed. I feigned an innocent optimism; I gradually perfected myself in the role of the farcical eccentric.”
“One must gauge one's trust carefully.”
“The famous field altar came from the Jewish firm of Moritz Mahler in Vienna, which manufactured all kinds of accessories for mass as well as religious objects like rosaries and images of saints.
The altar was made up of three parts, lberally provided with sham gilt like the whole glory of the Holy Church.
It was not possible without considerable ingenuity to detect what the pictures painted on these three parts actually represented. What was certain was that it was an altar which could have been used equally well by heathens in Zambesi or by the Shamans of the Buriats and Mongols.
Painted in screaming colors it appeared from a distance like a coloured chart intended for colour-blind railway workers. One figure stood out prominently - a naked man with a halo and a body which was turning green, like the parson's nose of a goose which has begun to rot and is already stinking. No one was doing anything to this saint. On the contrary, he had on both sides of him two winged creatures which were supposed to represent angels. But anyone looking at them had the impression that this holy naked man was shrieking with horror at the company around him, for the angels looked like fairy-tale monsters and were a cross between a winged wild cat and the beast of the apocalypse.
Opposite this was a picture which was meant to represent the Holy Trinity. By and large the painter had been unable to ruin the dove. He had painted a kind of bird which could equally well have been a pigeon or a White Wyandotte. God the Father looked like a bandit from the Wild West served up to the public in an American film thriller.
The Son of God on the other hand was a gay young man with a handsome stomach draped in something like bathing drawers. Altogether he looked a sporting type. The cross which he had in his hand he held as elegantly as if it had been a tennis racquet.
Seen from afar however all these details ran into each other and gave the impression of a train going into a station.”
“Some Queen of the Pipes, I thought. I'd believed I was better than a mindless drone. But I was the mindless one, hiding away. Even now I referred to them as if I didn't belong.”
BookQuoters is a community of passionate readers who enjoy sharing the most meaningful, memorable and interesting quotes from great books. As the world communicates more and more via texts, memes and sound bytes, short but profound quotes from books have become more relevant and important. For some of us a quote becomes a mantra, a goal or a philosophy by which we live. For all of us, quotes are a great way to remember a book and to carry with us the author’s best ideas.
We thoughtfully gather quotes from our favorite books, both classic and current, and choose the ones that are most thought-provoking. Each quote represents a book that is interesting, well written and has potential to enhance the reader’s life. We also accept submissions from our visitors and will select the quotes we feel are most appealing to the BookQuoters community.
Founded in 2023, BookQuoters has quickly become a large and vibrant community of people who share an affinity for books. Books are seen by some as a throwback to a previous world; conversely, gleaning the main ideas of a book via a quote or a quick summary is typical of the Information Age but is a habit disdained by some diehard readers. We feel that we have the best of both worlds at BookQuoters; we read books cover-to-cover but offer you some of the highlights. We hope you’ll join us.