Voltaire's opinion of Dr. Pangloss's endlessly optimistic philosophical view of the world can be found in chapter 19 of Candide.
"Optimism," said Cacambo, "what is that?"
"Alas!" said Candide, "it is the madness of insisting that everything is at its best when it is at its worst."
The philosophy that Dr. Pangloss teaches to Candide is a simplified, simplistic version of the writings and teachings of a number of philosophers of the Age of Enlightenment (also known as the Age of Reason), which was prevalent in Europe in the seventeenth through nineteenth centuries. Notable among these philosophers, and the primary target of Voltaire's withering satire, is Gottfried Wilhelm von Leibniz (1646–1716).
Leibniz asserted that God exists and that—since God is benevolent, omnipotent, and omniscient—out of all the worlds that God could have created, the world that he created must necessarily be the best of all possible worlds.
Leibniz posited further that everything that happens in this world, and, by extension, in the universe—no matter how bad, evil, unfortunate, devastating, or horrible an event appears to be—is all a part of God's plan, and must also necessarily be for the best.
Leibniz reasoned that the times that man sees imperfections in the world are due to man's limited perception and his own failure to understand God's grand plan.
Throughout Candide, Voltaire attacks and satirizes these kinds of philosophies and the philosophers that espouse them, the hypocrisy of religion and corrupt religious leaders, and the mindless adherence of the general public to absurd philosophies and flawed religious doctrines.
Voltaire believed in God, but he believed that God created the world, then left the world and the people who populate it to their own devices.
In the neighborhood lived a famous dervish who passed for the best philosopher in Turkey; they went to consult him: Pangloss, who was their spokesman, addressed him thus:
"Master, we come to entreat you to tell us why so strange an animal as man has been created?"
"Why do you trouble your head about it?" said the dervish; "is it any business of yours?"
"But, Reverend Father," said Candide, "there is a horrible deal of evil on the earth."
"What does it matter," said the dervish, "whether there is evil or good? When His Highness sends a ship to Egypt does he trouble his head whether the rats in the vessel are comfortable or not?"
Ultimately, the real-world disasters that Candide experiences and the life lessons that he learns overcome his mindless optimism, and he recognizes the utter nonsense and futility of Dr. Pangloss's "best of all possible worlds" philosophy.
Pangloss sometimes said to Candide:
"There is a concatenation of events in this best of all possible worlds: for if you had not been kicked out of a magnificent castle for love of Miss Cunegonde: if you had not been put into the Inquisition: if you had not walked over America: if you had not stabbed the Baron: if you had not lost all your sheep from the fine country of El Dorado: you would not be here eating preserved citrons and pistachio-nuts."
"All that is very well," answered Candide, "but let us cultivate our garden."