0% found this document useful (0 votes)
7 views

Instant Access to Think Java How to Think Like a Computer Scientist 2nd Edition Allen B. Downey ebook Full Chapters

The document promotes the ebook 'Think Java: How to Think Like a Computer Scientist, 2nd Edition' by Allen B. Downey, available on ebookmeta.com. It highlights the book's focus on introducing computer science concepts to beginners through a concise and structured approach. Additionally, it lists other related ebooks available for instant download on the same platform.

Uploaded by

paiterszkl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Instant Access to Think Java How to Think Like a Computer Scientist 2nd Edition Allen B. Downey ebook Full Chapters

The document promotes the ebook 'Think Java: How to Think Like a Computer Scientist, 2nd Edition' by Allen B. Downey, available on ebookmeta.com. It highlights the book's focus on introducing computer science concepts to beginners through a concise and structured approach. Additionally, it lists other related ebooks available for instant download on the same platform.

Uploaded by

paiterszkl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Get the full ebook with Bonus Features for a Better Reading Experience on ebookmeta.

com

Think Java How to Think Like a Computer Scientist


2nd Edition Allen B. Downey

https://ebookmeta.com/product/think-java-how-to-think-like-
a-computer-scientist-2nd-edition-allen-b-downey/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Think Python How to Think Like a Computer Scientist Allen


B Downey

https://ebookmeta.com/product/think-python-how-to-think-like-a-
computer-scientist-allen-b-downey/

ebookmeta.com

Think Python How to Think Like a Computer Scientist 2nd


Edition Allen B Downey

https://ebookmeta.com/product/think-python-how-to-think-like-a-
computer-scientist-2nd-edition-allen-b-downey/

ebookmeta.com

Think Python How to Think Like a Computer Scientist 2nd


Edition Allen B Downey

https://ebookmeta.com/product/think-python-how-to-think-like-a-
computer-scientist-2nd-edition-allen-b-downey-3/

ebookmeta.com

Taking Action Against Clinician Burnout: A Systems


Approach to Professional Well-Being 1st Edition National
Academies Of Sciences
https://ebookmeta.com/product/taking-action-against-clinician-burnout-
a-systems-approach-to-professional-well-being-1st-edition-national-
academies-of-sciences/
ebookmeta.com
The Work of Whiteness A Psychoanalytic Perspective 1st
Edition Helen Morgan

https://ebookmeta.com/product/the-work-of-whiteness-a-psychoanalytic-
perspective-1st-edition-helen-morgan/

ebookmeta.com

Basic Python for Data Management, Finance, and Marketing:


Advance Your Career by Learning the Most Powerful
Analytical Tool 1st Edition Art Yudin
https://ebookmeta.com/product/basic-python-for-data-management-
finance-and-marketing-advance-your-career-by-learning-the-most-
powerful-analytical-tool-1st-edition-art-yudin/
ebookmeta.com

The Ascetic Programmer How asceticism benefits programming


science and the arts Antonio Piccolboni

https://ebookmeta.com/product/the-ascetic-programmer-how-asceticism-
benefits-programming-science-and-the-arts-antonio-piccolboni/

ebookmeta.com

History of War: Book of The Napoleonic Wars - 6th Edition


History Of War

https://ebookmeta.com/product/history-of-war-book-of-the-napoleonic-
wars-6th-edition-history-of-war/

ebookmeta.com

Ships of the Royal Navy 5th Edition Ben Warlow

https://ebookmeta.com/product/ships-of-the-royal-navy-5th-edition-ben-
warlow/

ebookmeta.com
The End of Certainty Scott Morrison and Pandemic Politics
1st Edition Katharine Murphy

https://ebookmeta.com/product/the-end-of-certainty-scott-morrison-and-
pandemic-politics-1st-edition-katharine-murphy/

ebookmeta.com
Think Java
SECOND EDITION
How to Think Like a Computer Scientist

Allen B. Downey and Chris Mayfield


Think Java
by Allen B. Downey and Chris Mayfield
Copyright © 2020 Allen B. Downey and Chris Mayfield. All rights
reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles
(http://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
[email protected].
Acquisitions Editor: Suzanne McQuade

Development Editor: Corbin Collins

Production Editor: Christopher Faucher

Copyeditor: Sharon Wilkey

Proofreader: Christina Edwards

Indexers: Allen Downey and Chris Mayfield

Interior Designer: David Futato

Cover Designer: Karen Montgomery

Illustrator: Rebecca Demarest

May 2016: First Edition

December 2019: Second Edition


Revision History for the Second Edition
2019-11-27: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781492072508 for


release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Think Java, the cover image, and related trade dress are trademarks
of O’Reilly Media, Inc.
The views expressed in this work are those of the authors, and do
not represent the publisher’s views. While the publisher and the
authors have used good faith efforts to ensure that the information
and instructions contained in this work are accurate, the publisher
and the authors disclaim all responsibility for errors or omissions,
including without limitation responsibility for damages resulting from
the use of or reliance on this work. Use of the information and
instructions contained in this work is at your own risk. If any code
samples or other technology this work contains or describes is
subject to open source licenses or the intellectual property rights of
others, it is your responsibility to ensure that your use thereof
complies with such licenses and/or rights.
Think Java is available under the Creative Commons Attribution-
NonCommercial-ShareAlike 4.0 International License. The authors
maintain an online version at https://greenteapress.com/wp/think-
java-2e.
978-1-492-07250-8
[LSI]
Preface

Think Java is an introduction to computer science and programming


intended for readers with little or no experience. We start with the
most basic concepts and are careful to define all terms when they
are first used. The book presents each new idea in a logical
progression. Larger topics, like control flow statements and object-
oriented programming, are divided into smaller examples and
introduced over the course of several chapters.
This book is intentionally concise. Each chapter is 10–12 pages and
covers the material for one week of a college course. It is not meant
to be a comprehensive presentation of Java, but rather, an initial
exposure to programming constructs and techniques. We begin with
small problems and basic algorithms and work up to object-oriented
design. In the vocabulary of computer science pedagogy, this book
uses the objects late approach.
The Philosophy Behind the Book
Here are the guiding principles that make the book the way it is:

One concept at a time


We break down topics that give beginners trouble into a series
of small steps, so that they can exercise each new concept in
isolation before continuing.
Balance of Java and concepts
The book is not primarily about Java; it uses code examples to
demonstrate computer science. Most chapters start with
language features and end with concepts.
Conciseness
An important goal of the book is to be small enough so that
students can read and understand the entire text in a one-
semester college or AP course.
Emphasis on vocabulary
We try to introduce the minimum number of terms and define
them carefully when they are first used. We also organize them
in glossaries at the end of each chapter.
Program development
There are many strategies for writing programs, including
bottom-up, top-down, and others. We demonstrate multiple
program development techniques, allowing readers to choose
methods that work best for them.
Multiple learning curves
To write a program, you have to understand the algorithm,
know the programming language, and be able to debug errors.
We discuss these and other aspects throughout the book, and
summarize our advice in Appendix D.
Object-Oriented Programming
Some Java books introduce classes and objects immediately; others
begin with procedural programming and transition to object-oriented
more gradually.
Many of Java’s object-oriented features are motivated by problems
with previous languages, and their implementations are influenced
by this history. Some of these features are hard to explain when
people aren’t familiar with the problems they solve.
We get to object-oriented programming as quickly as possible
(beginning with Chapter 9). But we introduce concepts one at a
time, as clearly as possible, in a way that allows readers to practice
each idea in isolation before moving on. So it takes some time to get
there.
You can’t write Java programs (even Hello World) without
encountering object-oriented features. In some cases we explain a
feature briefly when it first appears, and then explain it more deeply
later on.
If you read the entire book, you will see nearly every topic required
for Java SE Programmer I certification. Supplemental lessons are
available in the official Java tutorials on http://thinkjava.org/tutorial.
This book is also well suited to prepare high school students for the
AP Computer Science A exam, which includes object-oriented design
and implementation. (AP is a registered trademark of The College
Board.) A mapping of Think Java section numbers to the AP course
is available on https://thinkjava.org.
Changes to the Second Edition
This new edition was written over several years, with feedback from
dozens of instructors and hundreds of students. A complete history
of all changes is available on GitHub. Here are some of the
highlights:
Chapters 2–4
We reordered the material in Chapter 1 to present a more
interesting balance of theory and practice. Chapters 2 and 3 are
much cleaner now too. Methods are now presented in a single
chapter, along with additional in-depth examples.
Chapters 5–8
We rearranged these chapters a lot, added many examples and
new figures, and removed unnecessary details. Strings are
covered earlier (before arrays) so that readers can apply them
to loop problems. The material on recursion is now a chapter,
and we added new sections to explain binary numbers and
CodingBat.
Chapters 9–12
Our main goal for these chapters was to provide better
explanations and more diagrams. Chapters 9 and 10 focus more
on immutable versus mutable objects, and we added new
sections on BigInteger and StringBuilder. The other content is
largely the same, but it should be easier to understand now.
Chapters 13–17
We balanced the amount of content in Chapters 13–14 by
moving ArrayLists earlier, and we implement the War card
game as another example. Chapters 15–17 are brand-new in
this edition; they cover more advanced topics including 2D
arrays, graphics, exceptions, abstract classes, interfaces, and
events.
Appendixes
We added Appendix B to explain documentation comments and
Javadoc in more detail. The other three appendixes that were
present in the first edition have been revised for clarity and
layout.
About the Appendixes
The chapters of this book are meant to be read in order, because
each one builds on the previous one. We also include several
appendixes with material that can be read at any time:
Appendix A, “Tools”
This appendix explains how to download and install Java so you
can compile programs on your computer. It also provides a brief
introduction to DrJava — an integrated development
environment (IDE) that is designed primarily for students — and
other development tools, including Checkstyle for code quality
and JUnit for testing.
Appendix B, “Javadoc”
It’s important to document your classes and methods so that
other programmers (including yourself in the future) will know
how to use them. This appendix explains how to read
documentation, how to write documentation, and how to use
the Javadoc tool.
Appendix C, “Graphics”
Java provides libraries for working with graphics and animation,
and these topics can be engaging for students. The libraries
require object-oriented features that students will not
completely understand until after Chapter 10, but they can be
used much earlier.
Appendix D, “Debugging”
We provide debugging suggestions throughout the book, but
this appendix provides many more suggestions on how to debug
your programs. We recommend that you review this appendix
frequently as you work through the book.
Using the Code Examples
Most of the code examples in this book are available from
https://github.com/ChrisMayfield/ThinkJavaCode2. Git is a “version
control system” that allows you to keep track of the files that make
up a project. A collection of files under Git’s control is called a
repository.
GitHub is a hosting service that provides storage for Git repositories
and a convenient web interface. It provides several ways to work
with the code:
You can create a copy of the repository on GitHub by clicking
the Fork button. If you don’t already have a GitHub account,
you’ll need to create one. After forking, you’ll have your own
repository on GitHub that you can use to keep track of code you
write. Then you can clone the repository, which downloads a
copy of the files to your computer.

Alternatively, you could clone the original repository without


forking. If you choose this option, you don’t need a GitHub
account, but you won’t be able to save your changes on GitHub.

If you don’t want to use Git at all, you can download the code in
a ZIP archive using the Download ZIP button on the GitHub
page, or this link: https://thinkjava.org/code2zip.

After you clone the repository or unzip the ZIP file, you should have
a directory named ThinkJavaCode2 with a subdirectory for each
chapter in the book.
The examples in this book were developed and tested using
OpenJDK 11. If you are using a more recent version, everything
should still work. If you are using an older version, some of the
examples might not.
If example code is offered with this book, you may use it in your
programs and documentation. You do not need to contact us for
permission unless you’re reproducing a significant portion of the
code. For example, writing a program that uses several chunks of
code from this book does not require permission. Selling or
distributing examples from O’Reilly books does require permission.
Answering a question by citing this book and quoting example code
does not require permission. Incorporating a significant amount of
example code from this book into your product’s documentation
does require permission.
We appreciate, but generally do not require, attribution. An
attribution usually includes the title, author, publisher, and ISBN. For
example: “Think Java by Allen B. Downey and Chris Mayfield.
(O’Reilly). Copyright 2020 Allen B. Downey and Chris Mayfield, 978-
1-492-07250-8.”
If you feel your use of code examples falls outside fair use or the
permission given above, feel free to contact us at
[email protected].
Conventions Used in This Book
The following typographical conventions are used in this book:

Italic
Indicates new terms, URLs, email addresses, filenames, and file
extensions.
Bold
Indicates vocabulary words defined at the end of each chapter.
Constant width
Used for program listings, as well as within paragraphs to refer
to program elements such as variable or function names,
databases, data types, environment variables, statements, and
keywords.
Constant width bold
Shows commands or other text that should be typed literally by
the user.
O’Reilly Online Learning

For more than 40 years, O’Reilly Media has provided technology and
business training, knowledge, and insight to help companies succeed.

Our unique network of experts and innovators share their knowledge


and expertise through books, articles, conferences, and our online
learning platform. O’Reilly’s online learning platform gives you on-
demand access to live training courses, in-depth learning paths,
interactive coding environments, and a vast collection of text and
video from O’Reilly and 200+ other publishers. For more information,
please visit http://oreilly.com.
How to Contact Us
Please address comments and questions concerning this book to the
publisher:
O’Reilly Media, Inc.

1005 Gravenstein Highway North

Sebastopol, CA 95472

800-998-9938 (in the United States or Canada)

707-829-0515 (international or local)

707-829-0104 (fax)

We have a web page for this book, where we list errata, examples,
and any additional information. You can access this page at
https://oreil.ly/think-java-2e.
Email [email protected] to comment or ask technical
questions about this book.
For more information about our books, courses, conferences, and
news, see our website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Another Random Document on
Scribd Without Any Related Topics
mass of obscenity which is not to be excused either by the manners
of the time nor by the exigencies of the story.
DON QUIXOTE
MIGUEL DE CERVANTES

Among works of prose fiction “Don Quixote” has undoubtedly the


most universal reputation. Mr. Henry Edward Watts, the latest and
best translator, considers it “the finest book,” and Justin McCarthy,
the recent editor of Shelton’s version, calls it “the noblest novel” in
the world. Probably this would be the verdict of a majority of the best
literary critics.

The Knight of the Sorrowful Countenance is more widely known and


recognized among mankind everywhere than any other single
character in fiction. And indeed there has never been any other
character more elaborately developed.

In the matter of plot, as well as personages, the scope of this work is


rather narrow. It is merely a series of adventures, and while the
priest, the barber, the bachelor, the duke, the duchess, and many
other persons appear incidentally, and while all of these are well
sketched, the work would be nothing except for the wonderful
sayings and doings of the mad knight and his squire. And the
contrast between the two sets forth in the strongest possible relief
the characteristics of each. Don Quixote, solemn, tall, lank, “with
cheeks that kissed each other on the inside,” and Sancho, short, fat,
round-bellied,—the knight filled with fine spiritual fire, his madness
enhanced by endless fasts and vigils; the squire sleeping, eating,
thinking of nothing but the facts of physical existence,—Don Quixote,
the dreamer, the idealist, the gentleman—for there is no one trait
which shines through all his madness as unmistakably as his
gentility; Sancho, a coarse, sensuous clod, an odd mixture of
simplicity and shrewdness, garrulous, full of proverbs, with a rustic
and very fleshly philosophy of his own, a squire who sometimes
cheats his master with false tales.

Don Quixote goes forth upon his battered Rocinante, to redress all
wrongs, actual or imaginary, to fight windmills, to engage in
desperate battles with flocks of sheep; to sail upon enchanted barks;
to fly through the air on a wooden horse; and perform a thousand
extravagances, travesties of the impossible prodigies recorded in
books of chivalry and enchantment.

The description of Don Quixote’s madness is masterly. His inability to


separate actual occurrences from the figments of his imagination
appears with wonderful power; for instance, in the scene of the
puppets, where he demolishes the apparatus of the show, and then
agrees to pay for the damage, and again refuses when the lady for
whom compensation is demanded has been already rescued, fact
and fancy contending with each other inextricably in his soul. As a
study in psychology, no character of fiction or drama outside of
Shakespeare is at all comparable to “Don Quixote.” Yet through all
his grotesque hallucinations appears his essential nobility. As
Sancho says of him, “He has a soul as clean as a pitcher. He can do
no harm to anyone, but good to all. He has no malice at all. A child
might persuade him it is night at noonday. And it is for this simplicity I
love him like my heartstrings, and cannot be handy at leaving him for
all the pranks he plays.” Thus do we love the simple-minded, even in
madness.

One of the clearest evidences of Cervantes’ genius is his power to


make even the vagaries of a madman so laughable. In any other
hands the adventures of Don Quixote would not be funny. I
remember once seeing a dramatic representation of the story, in
which Henry Irving impersonated the hero. It was well done, but it
was not amusing. The poor knight was so utterly wrapped in his
hallucinations that he was an object of pity rather than of laughter.
But in the novel itself the humor of Cervantes overcomes even our
sympathy. The wild reasoning of Don Quixote is often so irresistibly
absurd that his madness is forgotten. For instance, he does penance
in the Sierra Morena in honor of his Dulcinea, and proposes to
imitate Amadis and Orlando, who tore up trees by the roots, slew
shepherds, demolished houses, and performed a thousand other
extravagances. Sancho remarks that these knights of old had a
reason for their follies and penances, but that Don Quixote had
none, to which his master replies, “In this consists the refinement of
my plan. A knight errant that runs mad with cause deserves no
thanks, but to do so without reason is the point, giving my lady to
understand what I should perform in the wet, if I do this in the dry.”

The Spaniards say that “Don Quixote” is untranslatable. Of course a


masterpiece of this kind can not be enjoyed to the full, with all its
delicate aroma, in any other tongue, and in one sense it can not be
fully understood by any one who is not himself a Spaniard, who has
not the feelings, the surroundings, and perhaps the prejudices to
which the great book was addressed. But, judged by such a
standard, what masterpiece of past times can any of us fully enjoy?
In another sense, however, a foreigner can enjoy “Don Quixote”
better than a Spaniard; for some of its most characteristic features
are those which to one who lives amid the same surroundings will
pass unobserved. No one can judge of the perspective of a great
work unless he be far enough away to see it in its relations to the
rest of the world. In this larger sense, I think that Don Quixote can be
understood by an American of our century as well as by a Spaniard
of the time in which it was written. Something of the details will
escape him, but the beauty of the whole may be even more
apparent. The things that we lose in translation,—for instance, the
sonorous solemnity of the magniloquent diction of Don Quixote,—are
atoned for by the fact that Don Quixote himself is a more distinctive
type to us than he could have been to the people of his own age and
country.
I am not sure but that the Englishman or the American can grasp the
sum total of his qualities better through a good translation than even
in the original. The Spanish of “Don Quixote” is somewhat archaic,
and in places a little obscure, even to the most proficient in the living
tongue. So elusive is the pleasure which comes with the dry humor
of such a book that it must offer itself spontaneously, it must fit the
mood of the reader, it must be the luxury of an idle hour, or much of
the charm of it will escape. Therefore it is that I have found in
Shelton’s translation, and still more in the recent rendering of Mr.
Watts, a keener pleasure than I have ever been able to dig out of the
original mine.

“Don Quixote” is not without great faults. It was written carelessly.


This indeed often adds to the naturalness of the descriptions and the
situations, but the blemishes are sometimes self-evident and glaring.
For instance, after Sancho’s ass has been stolen by Ginés de
Pasamonte, the squire is represented, sometimes as walking,
sometimes as riding on the very animal he has lost. Some of
Cervantes’s commentators, like Clemencin, who are mathematical
rather than artistic in their criticisms, call our attention to the
numerous incongruities of this sort. But the greatest masters of
literature, even Homer and Shakespeare—have been guilty in the
same way.

Indeed, there is a good deal in “Don Quixote” which reminds one of


Shakespeare. Take for instance the following discourse between
Don Quixote and Sancho Panza:

“Prithee, tell me, hast thou not seen some comedy played wherein
are introduced kings, emperors, pontiffs, knights, ladies and
divers other personages? One plays the bully, another the knave;
one the merchant, one the soldier; others the witty fool and the
foolish lover; and, the comedy ended and their apparel put off, all
the players remain equal.”

“Yes, marry have I,” answered Sancho.

“But the same,” pursued Don Quixote, “happens in the comedy


and commerce of this world, wherein some play the emperors,
others the pontiffs; in short all the parts that can be introduced into
a drama; but on reaching the end, which is when life is done,
Death strips all of the robes which distinguished them, and they
remain equal in the grave.”

“A brave comparison!” cried Sancho, “though not so new but that I


have heard it many and divers times, like that of the game of
chess,—how, so long as the game lasts, each piece has its
particular office, and the game being finished, they are all mixed,
shuffled, and jumbled, and put away into a bag, which is much like
putting away life in the grave.”

“Every day, Sancho,” quoth Don Quixote, “thou becomest less


simple and more wise.”

The passages in “Macbeth,” “Sleep that knits up the ravelled sleeve


of care,” and “The sleeping and the dead are but as pictures,” find
their counterparts in the following dialogue, in which Sancho says to
his master:

“I only know that while I sleep I have no fear, nor hope, nor
trouble, nor glory; and good luck to him who invented sleep, a
cloak which covers all a man’s thoughts, the meat which takes
away hunger, the water which quenches thirst, the fire which
warms the cold, the cold which tempers the heat; to end up, the
general coin with which all things are bought, the balance and
weight which levels the shepherd with the king and the fool with
the wise man. There is only one thing, as I have heard say, is bad
about sleep, and it is that it looks like death, for between the
sleeping and the dead there is very little difference.”

The great fault of “Don Quixote” is its excessive prolixity. Provided


the best parts might be selected, it would be a better novel if it filled
only half the space. The same moralizing by the knight and his
squire is too often repeated; the same proverbs come forth again
and again. This is the reason why the work is read far less at the
present time than it used to be. In these busy days there is not much
place for the four volume novel.
Then, too, the long episodes, the story of Cardenio, the tale of the
captive and of Impertinent Curiosity, would be better told as separate
narratives rather than as parts of a book with which they have no
proper connection. The introduction of such stories was one of the
tricks of the time, but it is an artistic blemish. On the other hand,
Cervantes’s use of the Moorish historian, Ben Engeli, is a literary
device admirably employed, and the point at which he first
introduces Ben Engeli’s narrative is a delicious satire upon a literary
trick common to novelists even of the present time. For it will be
remembered that the terrible conflict between Don Quixote and the
Biscayan was left suspended, as it were, in mid-air, each of the
mighty combatants having raised his sword and being prepared to
dash at the other, at which point the narrative was interrupted, the
author being unable to learn anything of the outcome of the fray until
he discovered in the Alcazar of Toledo the manuscript of the Arabian
historiographer.

“Don Quixote” has been the model upon which many of the best
works of fiction have been based. One can see distinct traces of
Cervantes’s methods in “Pickwick Papers.” There are undoubtedly
many points of difference between Mr. Pickwick and Don Quixote,
yet the points of resemblance are very clear; and Sam Weller
corresponds more nearly to Sancho than any character in modern
fiction. The lugubrious episodes in the “Pickwick Papers” are not
wholly unlike those in “Don Quixote,” and the solemnity of these
episodes furnishes the same contrast to the merry absurdities of the
narrative itself.

Ichabod Crane is in some respects a Yankee “Knight of the


Sorrowful Figure,” though devoid of the madness and of the high
spiritual aims of his Castilian prototype.

“Don Quixote,” like many other masterpieces, like the “Odyssey,”


“Hamlet,” “Paradise Lost,” and the “Divine Comedy,” falters a little at
the end. Cervantes was evidently in a hurry to finish it, and the
conversion of the knight upon his death-bed is somewhat sudden.
But the defects in this great work are (to use a very hackneyed
simile) like the spots upon the sun. It will always remain one of the
world’s greatest masterpieces.
GIL BLAS
ALAIN RENÉ LE SAGE

If, as some say, the object of fiction is simply to amuse, no work of


fiction has better attained that object than “Gil Blas.” It is the greatest
and the most celebrated of that class of novels called the novela
picaresca, or rogue story, and consists of a succession of the
liveliest and merriest incidents, slenderly connected as parts of the
autobiography of a Spanish lackey, and narrated in a style that is a
model of luminous simplicity. The hero encounters every variety of
good and evil fortune, each following the other like the figures of a
kaleidoscope. From the moment when, as a simple youth, he is sent
forth into the world with a mule and forty ducats, he plunges into the
midst of ludicrous adventures. At the first town he entertains at
supper a parasite who calls him “the ornament of Oviedo,” “the torch
of philosophy,” “the eighth wonder of the world,” and who, after
gorging himself at the expense of the young student, laughs in his
face at his credulity. He is next decoyed into a cave of robbers,
where he is locked in and made to serve as the Ganymede of the
band, but before long he escapes and rescues a fair lady, Doña
Mencia, who gratefully gives him a thousand ducats and a valuable
ring. But he tells of his good fortune, and is fleeced of his money and
his ring in a confidence game skillfully played by one Camilla and by
Don Rafael, her pretended brother, acting in concert with his own
valet, Ambrose. In his misfortune he meets Fabricio, an old
schoolmate, who advises him to become a lackey rather than a tutor,
since the former calling opens a better career than teaching to a man
of shrewd wit. Gil Blas is convinced, and seeks a situation.

His first place is with the fat licentiate, Sedillo, where he serves
faithfully and leads a dog’s life in hopes of a legacy, as soon as his
master shall be carried off with the gout. He gets as the legacy his
master’s library, consisting of three books, “The Perfect Cook,” a
work on indigestion, and a breviary. Then he takes a situation with
Dr. Sangrado, the physician who has hastened Sedillo’s departure
from the world, from whom he learns in a word the whole art of
healing, to wit, bleeding profusely and administering vast quantities
of hot water, a system which Gil Blas puts into practice as
Sangrado’s deputy, kills most of his patients, and has to flee from
Valladolid in the night. After many adventures he arrives at Madrid,
becomes the servant of Don Mathias de Silva, a dissolute young
nobleman, and learns much of the ways of the world. Dressed in his
master’s clothes, he makes love to a great lady, as he supposes, but
finds that she is Laura, the maid of the actress Arsenia, whom his
master visits. Don Mathias is killed in a duel, whereupon our hero
takes service with the actress, and has fine times with his dear
Laura, but at last leaves the place because he is unwilling “to live
any longer with the seven mortal sins.” Next he takes a situation with
Don Vincent de Guzman, fancies that his master’s daughter Aurora
is in love with him, and makes a great fool of himself at a midnight
interview, where she seeks his aid in behalf of her passion for Don
Luis Pacheco. A very pretty story follows of her efforts in the guise of
a man to inspire Pacheco’s love, efforts which are not unlike those of
Rosalind with Orlando, and which in like manner are crowned with
success. Gil Blas then goes to live with Pacheco’s uncle, an
asthmatic old man, who looks “like the resurrection of Lazarus,” but
who loves the young and beautiful Euphrasia. Gil Blas finds another
gallant hidden in her room, and tells his master, but he is dismissed
for his pains.

Our hero now renders a service to a young nobleman, Don Alphonso


de Leyva, who is a fugitive from justice, and goes with him to a cave,
where Don Raphael and Ambrose are found disguised as hermits,
and the former gives a graphic account of his past life and rogueries.
At first Gil Blas and Don Alphonso join them in their rascally
enterprises. They all array themselves as inquisitors, and proceed to
appropriate the property of Samuel Simon, a converted Jew, whom
they charge with relapsing into heresy. The questions propounded in
behalf of the Holy Office are highly grotesque. But neither Gil Blas
nor Don Alphonso are willing to continue such a life, so they part
from their companions, and Don Alphonso, who is soon after happily
married to Seraphina (quite a long love story hangs thereby), makes
Gil Blas the intendant of his castle. But Gil Blas quarrels with
Seraphina’s maid, whereupon he leaves the service of his friend and
betakes himself to Granada, where he obtains a place as secretary
of the archbishop. The description of the learned prelate, short, fat,
and very vain of his oratorical gifts, is extremely lifelike, and the
following scene, where he requires Gil Blas to give him a warning of
his failing powers, is deservedly celebrated:

One evening he repeated before me with enthusiasm a homily


which he intended to pronounce next day in the cathedral. He was
not contented with asking me what I thought of it in a general way;
he obliged me to single out the particular places which I most
admired. I had the good luck to mention his favorite passages,
those which he looked upon as the best. By this means I passed
in his judgment for a man who had a delicate knowledge of the
true beauties of a work. “That,” he cried, “is what you call having
taste and sentiment! Go to, my friend, I assure you, you have not
got Boeotian ears.” In a word, he was so well satisfied with me
that he said to me, with some vivacity, “Gil Blas, give thyself no
uneasiness about thy fortune. I undertake to make it agreeable. I
love thee, and as a proof of my affection, make thee my
confidant.... Listen with attention to what I am going to say to thee.
My chief pleasure consists in preaching. The Lord gives a
blessing to my homilies. They touch the hearts of sinners and
make them seriously reflect and have recourse to penitence. I
have the satisfaction of seeing a miser, terrified by the images
which I represent to his avarice, open his treasures and squander
them with a prodigal hand. I have also turned a voluptuary from
his pleasures, filled hermitages with the ambitious, and
strengthened in her duty a wife who had been shaken by the
allurements of a lover. These conversions, which are frequent,
ought of themselves to arouse me to work. Nevertheless, I will
confess my weakness, I propose to myself another reward, a
reward which the delicacy of my virtue reproaches me with in
vain; I mean the esteem of the world for fine polished writing. The
honor of being regarded a perfect orator has many charms for me.
My works are found equally strong and delicate, but I would like to
avoid the fault of good authors who write too long, and I would
retire with all my reputation. Therefore, my dear Gil Blas,”
continued the prelate, “I exact one thing of thy zeal. When thou
shalt perceive that my pen smacks of old age, when thou shalt
see my genius flagging, don’t fail to advise me of it. I do not trust
my own judgment upon that point. My self-love may deceive me.
That observation requires a disinterested mind, and I make choice
of thine, which I know is good. I will rely upon thy judgment.... Do
not fear to be frank and sincere, for I shall receive thy advice as a
mark of thy affection for me. Besides, thy own interest is
concerned; if, unfortunately for thee, it should come to my ears
that they say in the city my discourses have no longer their
wonted force and it is high time for me to rest, I declare to thee
plainly that thou shalt lose my friendship as well as the fortune I
have promised. Such will be the fruit of thy foolish discretion.”

After the bishop has had an attack of apoplexy, and the time comes
for Gil Blas to perform his duty, this is what happens:

The only thing that embarrassed me now was how to break the
ice. Luckily the orator himself extricated me from that difficulty, by
asking what people said of him, and if they were satisfied with his
last discourse. I answered that his homilies were always admired,
but in my opinion the last had not succeeded so well as the rest,
in affecting the audience. “How, friend!” replied he, with
astonishment, “has it met with any Aristarchus?” “No, sir,” said I,
“by no means; such works as yours are not to be criticised;
everybody is charmed with them. Nevertheless, since you have
laid your injunctions upon me to be free and sincere, I will take the
liberty to tell you that your last discourse, in my judgment, has not
altogether the energy of your other performances. Are you not of
the same opinion?”

My master grew pale at these words; and said, with a forced


smile, “So then, Mr. Gil Blas, this piece is not to your taste?” “I
don’t say so, sir,” cried I, quite disconcerted; “I think it excellent,
although a little inferior to your other productions.” “I understand
you,” he replied, “you think I am failing, don’t you? Come, be
plain; you believe it is time for me to think of retiring.” “I should not
have been so bold,” said I, “as to speak so freely, if your grace
had not commanded me; I do no more, therefore, than obey you;
and I most humbly beg that you will not be offended at my
freedom.” “God forbid,” cried he with precipitation, “God forbid that
I should find fault with it. In so doing, I should be very unjust. I
don’t at all take it ill that you speak your sentiment; it is your
sentiment only that I find bad. I have been most egregiously
deceived in your narrow understanding.”

Though I was disconcerted, I endeavored to find some mitigation,


in order to set things to rights again; but how is it possible to
appease an incensed author, one especially who has been
accustomed to hear himself praised? “Say no more, my child,”
said he, “you are yet too raw to distinguish the true from the false.
Know that I never composed a better homily than that which you
disapprove; for my genius, thank Heaven, hath as yet lost nothing
of its vigor. Henceforth I will make a better choice of a confidant,
and keep one of greater ability than you. Go,” he added (pushing
me by the shoulders out of the room), “go tell my treasurer to give
you a hundred ducats, and may Heaven conduct you with that
sum. Adieu, Mr. Gil Blas, I wish you all manner of prosperity, with
a little more taste.”

And so the comedy goes on. One new face after another appears on
the scene, among them Captain Hannibal Chinchilla, with monstrous
moustache, who has left an eye in Naples, an arm in Lombardy, and
a leg in the Low Country; then Count Galiano, who is fonder of his
monkey than of his servants. Our hero becomes one of the
secretaries of the prime minister, the Duke of Lerma, where he
acquires great honor, but for a long time, no pay. Finally he sells his
influence, gets into court intrigues, rises step by step, until he is
about to marry the daughter of a rich jeweller, when he is arrested
and thrown into the tower of Segovia. Here he is found by his faithful
valet Scipio, who gets him released. He now determines to renounce
the court forever, and his old friend Don Alphonso gives him a small
estate at Lirias. But when the new king comes in, Gil Blas is tempted
back again, rises rapidly under Count Olivares, and when this
minister falls, follows him into retirement. Upon the death of the
count, Gil Blas returns to Lirias, where his marriage and his happy
life with his wife, Dorothea, close the story.

Many of the personages of the tale reappear at the most unlooked


for places and in the most unexpected characters. For instance, the
two rascals, Don Raphael and Ambrose, turn up as monks in a
convent, where they have led a life of great piety and penitence for
over a year. But Don Raphael is the treasurer and Ambrose is the
porter of the monastery, and soon these worthy brothers disappear
with all the funds. They come to their deserts, however, for the last
that is seen of them they are walking with other culprits to an auto da
fe, their heads decorated with the carochas or pasteboard caps upon
which are painted the flames and devils of eternal punishment.

Another interesting character who comes in at different parts of the


story is the schoolmate of Gil Blas, Fabricio, the son of the barber
Nunez. At first a valet, he next turns up as a poet, having composed
a worthless comedy which was a great success, from which he
judged the public was a good milch cow. Some amusing descriptions
follow of Fabricio’s opinion as to what constitutes a fine style. He
reads a sonnet which Gil Blas cannot understand, but the son of the
barber Nunez insists that this shows its excellence—that obscurity is
the charm of all works that aim to be sublime, and that it is quite
enough if the poet thinks they have a meaning. There are amusing
portraits of Fabricio’s friends, who imagine themselves great authors
and who dispute and fight at their host’s table over the comparative
merits of their wretched productions. Next Fabricio is found in the
hospital; he has abandoned the Muses and written an ode to bid
them an eternal adieu. But as soon as he is well he is back at his old
occupation, and gets a place with a liberal patron, Gómez de Ribera.
He writes a play, which, being fortunately hissed and hooted by the
populace, gets him a good pension from his patron, who obstinately
admires it and says, “Victrix causa Diis placuit sed victa Catoni.”
There is an amusing account of a dinner which Fabricio gives to his
literary friends, where they discuss the question what constitutes the
chief interest in the Iphigenia of Euripides, one of the guests
solemnly maintaining that it was not the peril of the heroine, but the
wind. “I take the part of the Greeks,” says Melchior de Villegas. “I
espouse their purpose. I only wish for the departure of their fleet, and
I look with an indifferent eye upon Iphigenia in her peril, since her
death is a means of obtaining from the gods a favorable wind.”

Le Sage is almost as hard upon the doctors as Molière. Dr.


Sangrado has become a type. He was so expeditious that he did not
often give time for any of his patients to call a notary in order to
make a will. After they had been bled to death, he always insisted
that they died because they had not been bled enough and had not
taken enough hot water. The doctor admitted to Gil Blas that he did
not often cure his patients, and that if he were not so sure of his
principles he might have been tempted to think that his bleeding and
hot water had really injured them, but that he could not change his
methods because he had published a book! In his last interview with
Gil Blas, the good doctor (now retired from practice) deplores the
decadence of medicine, but is caught by his own pupil drinking wine
in violation of his own precepts.

All through the book stories of the events of their own lives are told
by the principal characters. The robbers in the cave, Doña Mencia,
Don Alphonso, Don Raphael, Scipio, and others, all give us their
histories, which resemble in miniature the principal narrative. The
novel is a very long one, and although it is well written everywhere,
the latter part contains some incidents which seem like repetitions,
and the interest is not held quite up to the standard of the earlier
books.

“Gil Blas” is an admirable prose satire, a satire written with the light
raillery of Horace rather than the invective of Juvenal. It sparkles
everywhere with French wit, and though the scene is laid in Spain
(the model for that kind of story being the early Spanish tales like
“Lazarillo de Tormes”), yet the style and the characters are
essentially French, and many of the latter are taken from the
acquaintance of the author himself. The illusion, however, is well
maintained, and it is only upon rare occasions (such as the raillery of
the petits maîtres) that one notices characteristics which do not
seem quite at home in Spain. Near the close of the book there are a
number of historical characters (Spanish, of course), but these are
by no means the liveliest or best. Indeed, it may well be doubted
whether “Gil Blas” has not rather suffered than gained by the
introduction of its historical features.

I have noticed that while I can enjoy “Don Quixote” perhaps better in
the translation than the original, “Gil Blas,” on the other hand, sounds
more natural to me in a Spanish version than in the original French.
This may be mere fancy, or perhaps it may be attributed to this, that
“Gil Blas,” being a foreign production, seems more natural after
having been acclimated, as it were, by translation into the language
of the country in which its scenes are laid. “Don Quixote,” on the
other hand, being thoroughly Spanish does not lose its national
characteristics, no matter what the language in which it is
communicated to the reader.
ROBINSON CRUSOE
DANIEL DEFOE

The main feature of this story—an account of the efforts of a


castaway to live comfortably without human aid,—is extremely
attractive to the young. Many of the scenes are very vivid,—the
shipwreck, the lonely island, the birds startled at the sound of the
gun, the wildcat that observes the new intruder; his efforts to provide
for himself food, clothing, and shelter; the construction of his strange
dwelling, the planting of his crops, the care of his goats, the building
of his canoe, and most of all, the account of the wild man Friday,
whom he secures for his servant,—all these things are ingeniously
and attractively described. But the repetitions which occur
throughout the book make it in places very tedious. Crusoe tells us in
his diary the same story which he has already related in the
preceding narrative; he moralizes again and again upon his folly in
disregarding the advice of his good father; he computes over and
over the evils and the blessings that have befallen him; and tells
many times and at great length the story of how he became a
Christian and learned to pray. Much of the book is a sermon of
Puritan dimensions. This is one of the works where the abridgement
is better than the original. The homilies are commonplace, there are
few striking passages and the style, though occasionally
picturesque, is often dry and involved.

Of course in such a work there can be little portraiture of character.


Robinson Crusoe himself is not a specially interesting person. His
ingenuity is all that attracts us. In one or two places his jumbled
motives are described with unconscious naïveté. For instance, he
says, when he saw Friday escaping from the two savages who had
intended to make a meal of him: “It came very firmly upon my
thoughts, and indeed irresistibly, that now was the time to get me a
servant and perhaps a companion or assistant, and that I was called
plainly by Providence to save this poor creature’s life.” So he killed
the pursuers and appropriated Friday.

The description of Friday is well conceived. This interesting


barbarian worships his master’s gun and talks to it, desiring it not to
kill him. He says of Benamuckee, the creator, “All things say ‘Oh!’ to
him,” and the objections of this child of nature to his master’s
theology are very lifelike. “If God much stronger than the devil, why
God no kill the devil, so make him no more do wicked?” And after
Crusoe had replied, “God will at last punish him severely; he is
reserved for the judgment and is to be cast into the bottomless pit, to
dwell with everlasting fire,” Friday’s rejoinder has never yet, I think,
been successfully answered,—“Why not kill the devil now, not kill
great ago?” It was natural that Crusoe should say, “Here I was run
down again by him to the last degree.”
GULLIVER’S TRAVELS
JONATHAN SWIFT

I suppose the human mind is naturally inclined to a belief in dwarfs


and giants. There are legends about them in the folk-lore of nearly
every people. It requires only an exaggeration of the things we know
to believe in larger men and smaller men than we have ever seen. In
“Gulliver’s Travels” Swift has worked out the details of comparative
size with great particularity, and the book is an illustration of the
principle that even a palpable fiction may be made so definite and
circumstantial that it will almost command belief.

The figure of the great Man-Mountain dragging the tiny fleet of


Lilliput is vivid and lifelike, and when in Brobdignag the same giant
becomes a helpless dwarf, is carried like a mouse in the mouth of a
dog, and has fierce struggles with a frog and a rat, the scenes do not
seem at all impossible. The art of the story-teller gives probability to
the wildest fancies, and you can hardly doubt, as you read, that the
kingdoms of the big people and the little people must have existed,
so plain are the scenes before your eyes.

But Swift’s description of the physical characteristics of these


peoples is not more vivid than his account of their customs and
social peculiarities.

Much of his satire was meant to set off certain follies of his own time,
but to us the most valuable part of it is that which portrays the
general frailties of humanity. He holds up to nature a mirror which,
while it distorts the features a little, still makes the caricature
extremely lifelike. Even where the Lilliputians are most absurd we
recognize their similarity to ourselves. The quarrels between the
partisans of low and high heeled shoes, the revolution and obstinate
war concerning the proper manner of opening an egg, are not a whit
more nonsensical than some of our own social and theological
controversies. The Lilliputians bury their dead with the head down in
order that the body may be in the right position for the resurrection,
just as the Mahometan faces Mecca in his prayers, the Christian
builds his church according to certain points of the compass, and the
ritualist makes his genuflexions in carefully prescribed forms, for
reasons quite as cogent and unanswerable.

The “little people” well knew there were no other regions of the earth
than Lilliput and Blefuscu, and here, too, we are like them. Most of
us consider that all there is of importance in the universe is that
which falls within our own spheres of observation.

No one can read Swift’s story without reflecting that our own little
world must seem much like Lilliput to the great eye which looks upon
this planet as only one among the islands of the firmament.

In Laputa we see ourselves even more clearly. We can find


counterparts of the great lord of wide attainments and eminent
services, who was accounted ignorant and stupid because he had so
ill an ear for music that he beat time in the wrong place. The
philosophers who moved about the earth with one eye turned inward
and the other upward toward the zenith, and who constantly required
a flapper to bring them to their senses, are old and familiar
acquaintances.

The proposition to impose a tax upon men’s vices has been put into
practice many a time, and the scheme of a general raffle to secure
the prizes of patronage would seem to be a tolerable refuge from our
former system of political appointments.

You might also like