Download ebooks file Learning JavaScript Design Patterns A JavaScript and React Developer s Guide 2nd Edition Adnan Osmani all chapters
Download ebooks file Learning JavaScript Design Patterns A JavaScript and React Developer s Guide 2nd Edition Adnan Osmani all chapters
com
https://ebookname.com/product/learning-javascript-design-
patterns-a-javascript-and-react-developer-s-guide-2nd-
edition-adnan-osmani/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookname.com/product/learning-javascript-design-patterns-
addy-osmani/
ebookname.com
https://ebookname.com/product/pro-javascript-design-patterns-1st-
edition-ross-harmes/
ebookname.com
https://ebookname.com/product/learning-javascript-2nd-edition-shelley-
powers/
ebookname.com
https://ebookname.com/product/fundamentals-of-revision-hip-
arthroplasty-diagnosis-evaluation-and-treatment-1st-edition-david-
jacofsky/
ebookname.com
Limited Language Rewriting Design Responding to a Feedback
Culture 1st Edition Colin Davies
https://ebookname.com/product/limited-language-rewriting-design-
responding-to-a-feedback-culture-1st-edition-colin-davies/
ebookname.com
https://ebookname.com/product/human-embryogenesis-methods-and-
protocols-1st-edition-cathy-vaillancourt/
ebookname.com
https://ebookname.com/product/speech-out-of-doors-preserving-first-
amendment-liberties-in-public-places-1st-edition-timothy-zick/
ebookname.com
https://ebookname.com/product/pygmalion-webster-s-spanish-thesaurus-
edition-george-bernard-shaw/
ebookname.com
https://ebookname.com/product/gace-english-to-speakers-of-other-
languages-119-120-xam-gace-first-edition-new-edition-sharon-wynne/
ebookname.com
eBusiness Essentials 2nd Edition Mark Norris
https://ebookname.com/product/ebusiness-essentials-2nd-edition-mark-
norris/
ebookname.com
Se dit
E
co ion
nd
Learning
JavaScript
Design Patterns
A JavaScript and
React Developer's Guide
Addy Osmani
Learning JavaScript Design Patterns
Do you want to write beautiful, structured, and maintainable
JavaScript by applying modern design patterns to the “Addy’s book is a
language? Do you want clean, efficient, manageable pragmatic approach to
code? Want to stay up-to-date with the latest best fundamental concepts
practices? If so, the updated second edition of Learning that are useful across
JavaScript Design Patterns is the ideal place to start. myriad uses. JavaScript
Design Patterns are
Author Addy Osmani shows you how to apply modern intrinsic to developers
design patterns—including modules, mixins, observers, applying systems thinking
and mediators—to JavaScript and React. You’ll learn about to their own work. Any
performance and rendering patterns such as server-side developer reading this
rendering and Islands architecture. You’ll also learn how book will see incredible
architectural patterns like MVC, MVP, and MVVM are useful returns on the time
from the perspective of a modern web application developer. investment reading it.”
—Sarah Drasner
This book explores: Director of Engineering at Google
• Architectural patterns for structuring your components
“Addy Osmani strikes
and apps
again, and he has
• More than 20 design patterns in JavaScript and delivered a much
React, applicable for developers at any level appreciated update
• Different pattern categories including to his already classic
creational, structural, and behavioral
book on design patterns
in JavaScript.”
• Essential performance patterns including —Stoyan Stefanov
dynamic imports and code-splitting WebPageTest.org engineer and
author of JavaScript Patterns
• Rendering patterns such as server-side rendering,
hydration, Islands architecture, and more
Additionally, you’ll explore modern JavaScript syntax like Addy Osmani is an engineering
JavaScript modules, React patterns like Hooks, higher-order leader for Google, where he leads
the Chrome developer experience
components (HOCs), and more, to stay ahead in the teams, helping to keep the web
ever-evolving world of web development. fast and delightful to build upon.
Learning JavaScript
Design Patterns
A JavaScript and React Developer’s Guide
Addy Osmani
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Learning JavaScript Design Patterns,
the cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the author and do not represent the publisher’s views.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author 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.
978-1-098-13987-2
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
4. Anti-Patterns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
What Are Anti-Patterns? 15
Anti-Patterns in JavaScript 16
Summary 17
iii
Modules Loaded from Remote Sources 23
Static Imports 23
Dynamic Imports 23
Import on Interaction 24
Import on Visibility 24
Modules for the Server 24
Advantages of Using Modules 25
Classes with Constructors, Getters, and Setters 26
Classes in JavaScript Frameworks 28
Summary 29
Related Reading 29
iv | Table of Contents
The Facade Pattern 66
The Mixin Pattern 68
Subclassing 68
Mixins 69
Advantages and Disadvantages 72
The Decorator Pattern 73
Pseudoclassical Decorators 76
Interfaces 77
Abstract Decorators 78
Advantages and Disadvantages 81
Flyweight 82
Using Flyweights 83
Flyweights and Sharing Data 83
Implementing Classical Flyweights 83
Converting Code to Use the Flyweight Pattern 86
A Basic Factory 89
Managing the Extrinsic States 89
The Flyweight Pattern and the DOM 91
Example: Centralized Event Handling 91
Behavioral Patterns 93
The Observer Pattern 93
Differences Between the Observer and Publish/Subscribe Pattern 97
Advantages 100
Disadvantages 100
Publish/Subscribe Implementations 100
The Mediator Pattern 110
A Simple Mediator 111
Similarities and Differences 112
Event Aggregator Use 114
Mediator Use 114
Event Aggregator (Pub/Sub) and Mediator Together 115
Mediator/Middleware in Modern JavaScript 116
Mediator Versus Facade 117
The Command Pattern 117
Summary 119
Table of Contents | v
Controllers 128
What Does MVC Give Us? 128
Smalltalk-80 MVC in JavaScript 128
Summary of MVC 129
MVP 129
Models, Views, and Presenters 130
MVP or MVC? 131
MVVM 132
History 132
Model 133
View 133
ViewModel 134
Recap: The View and the ViewModel 134
ViewModel Versus Model 134
Pros and Cons 135
Advantages 135
Disadvantages 135
MVC Versus MVP Versus MVVM 135
Modern MV* Patterns 136
MV* and React.js 136
Summary 137
vi | Table of Contents
async/await Pipeline 150
async Retry 150
async/await Decorator 150
Additional Practical Examples 151
Making an HTTP Request 151
Reading a File from the Filesystem 151
Writing to a File on the Filesystem 151
Executing Multiple async Operations 152
Executing Multiple async Operations in Sequence 152
Caching the Result of an async Operation 152
Handling Events with async/await 153
Retrying an async Operation on Failure 153
Creating an async/await Decorator 153
Summary 154
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Table of Contents | ix
Preface
The world of JavaScript has come a long way since I wrote the first edition of Learn‐
ing JavaScript Design Patterns over 10 years ago. At that time, I was working on large-
scale web applications and found that the lack of structure and organization in
JavaScript code made it difficult to maintain and scale those applications.
Fast forward to today, and the web development landscape has changed dramatically.
JavaScript has become one of the most popular programming languages in the world
and is used for everything from simple scripts to complex web applications. The Java‐
Script language has evolved to include modules, promises, and async/await, which
has heavily influenced how we architect applications. The way developers write com‐
ponents, such as with React, has also significantly impacted how they think about
maintainability. This has resulted in the need for modern patterns that take these new
changes into account.
With the rise of modern libraries and frameworks like React, Vue, and Angular,
developers are now building applications that are more complex than ever before. I
recognized the need for an updated version of Learning JavaScript Design Patterns to
reflect the changes in JavaScript and web application development.
In this second edition of Learning JavaScript Design Patterns, I aim to help developers
apply modern design patterns to their JavaScript code and React applications. The
book covers more than 20 design patterns essential for building maintainable and
scalable applications. The book is not just about design patterns but also about ren‐
dering and performance patterns, which are critical to the success of modern web
applications.
The first edition of this book focused on classical design patterns, such as the Module
pattern, the Observer pattern, and the Mediator pattern. These patterns are still
important and relevant today, but the web development world has evolved signifi‐
cantly in the past decade, and new patterns have emerged. This new edition covers
these new patterns, such as promises, async/await, and the newer variations of the
xi
Module pattern. We also cover architectural patterns such as MVC, MVP, and
MVVM and discuss where modern frameworks fit with these architectural patterns.
Today’s developers are exposed to many library-specific or framework-specific
design patterns. React’s matured ecosystem and utilization of newer JS primitives
provide an excellent launchpad to talk about best practices and patterns in the frame‐
work or library context. In addition to classic design patterns, this book covers
modern React patterns, such as Hooks, Higher-Order Components, and Render
Props. These patterns are specific to React and essential for building modern web
applications using this popular framework.
This book is not just about patterns; it’s also about best practices. We cover topics
such as code organization, performance, and rendering, which are crucial for build‐
ing high-quality web applications. You will learn about dynamic imports, code-
splitting, server-side rendering, hydration, and Islands architecture, all of which are
essential for building fast and responsive web applications.
By the end of this book, you will have a deep understanding of design patterns and
how to apply them to your JavaScript code and React applications. You will also
know which patterns are relevant to the modern web and which are not. This book is
not just a reference for patterns; it’s also a guide to building high-quality web applica‐
tions. You will learn how to structure your code for maximum maintainability and
scalability and how to optimize your code for performance.
xii | Preface
• Chapter 6, “Categories of Design Patterns”: Delve into the different categories of
design patterns: creational, structural, and behavioral.
• Chapter 7, “JavaScript Design Patterns”: Study over 20 classic design patterns in
JavaScript and their modern adaptations.
• Chapter 8, “JavaScript MV* Patterns”: Learn about architectural patterns like
MVC, MVP, and MVVM and their significance in modern web development.
• Chapter 9, “Asynchronous Programming Patterns”: Understand the power of
asynchronous programming in JavaScript and various patterns for handling it.
• Chapter 10, “Modular JavaScript Design Patterns”: Discover patterns for organ‐
izing and modularizing your JavaScript code.
• Chapter 11, “Namespacing Patterns”: Learn various techniques for namespacing
your JavaScript code to avoid global namespace pollution.
• Chapter 12, “React.js Design Patterns”: Explore React-specific patterns, including
Higher-Order Components, Render Props, and Hooks.
• Chapter 13, “Rendering Patterns”: Understand different rendering techniques
like client-side rendering, server-side rendering, progressive hydration, and
Islands architecture.
• Chapter 14, “Application Structure for React.js”: Learn how to structure your
React application for better organization, maintainability, and scalability.
• Chapter 15, “Conclusions”: Wrap up the book with key takeaways and final
thoughts.
Throughout the book, practical examples are provided to illustrate the patterns and
concepts discussed. By the end of your journey, you’ll have a solid understanding of
JavaScript design patterns and be equipped to write elegant, maintainable, and scal‐
able code.
Whether you’re a seasoned web developer or just starting out, this book will provide
the knowledge and tools you need to build modern, maintainable, and scalable web
applications. I hope that this book will be a valuable resource for you as you continue
to develop your skills and build amazing web applications.
Preface | xiii
Constant width
Used for program listings, as well as within paragraphs to refer to program ele‐
ments such as variable or function names, databases, data types, environment
variables, statements, and keywords.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.
xiv | Preface
O’Reilly Online Learning
For more than 40 years, O’Reilly Media has provided technol‐
ogy 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, 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, visit https://oreilly.com.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
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/js_design_patterns_2e.
Email bookquestions@oreilly.com to comment or ask technical questions about this
book.
For news and information about our books and courses, visit https://oreilly.com.
Find us on LinkedIn: https://linkedin.com/company/oreilly-media
Follow us on Twitter: https://twitter.com/oreillymedia
Watch us on YouTube: https://youtube.com/oreillymedia
Acknowledgments
I would like to thank the amazing reviewers for the second edition, including Stoyan
Stefanov, Julian Setiawan, Viswesh Ravi Shrimali, Adam Scott, and Lydia Hallie.
The first edition’s passionate, talented technical reviewers included Nicholas Zakas,
Andrée Hansson, Luke Smith, Eric Ferraiuolo, Peter Michaux, and Alex Sexton.
They—as well as members of the community at large—helped review and improve
Preface | xv
this book, and the knowledge and enthusiasm they brought to the project was simply
amazing.
A special thanks to Leena Sohoni-Kasture for her contributions and feedback to the
editing of the second edition.
Finally, I would like to thank my wonderful wife, Elle, for all of her support while I
was putting together this publication.
xvi | Preface
CHAPTER 1
Introduction to Design Patterns
Good code is like a love letter to the next developer who will maintain it!
Design patterns provide a common vocabulary to structure code, making it easier to
understand. They help enhance the quality of this connection to other developers.
Knowledge of design patterns helps us identify recurring themes in requirements and
map them to definitive solutions. We can rely on the experience of others who have
encountered a similar problem and devised an optimized method to address it. This
knowledge is invaluable as it paves the way for writing or refactoring code to make it
maintainable.
Whether on the server or client, JavaScript is a cornerstone of modern web applica‐
tion development. The previous edition of this book focused on several popular
design patterns in the JavaScript context. Over the years, JavaScript has significantly
evolved as a language in terms of features and syntax. It now supports modules,
classes, arrow functions, and template literals that it did not previously. We also have
advanced JavaScript libraries and frameworks that have made life easy for many web
developers. How relevant, then, are design patterns in the modern JavaScript context?
It’s important to note that traditionally, design patterns are neither prescriptive nor
language-specific. You can apply them when you think they fit, but you don’t have to.
Like data structures or algorithms, you can still apply classic design patterns using
modern programming languages, including JavaScript. You may not need some of
these design patterns in modern frameworks or libraries where they are already
abstracted. Conversely, the use of specific patterns may even be encouraged by some
frameworks.
In this edition, we are taking a pragmatic approach to patterns. We will explore why
specific patterns may be the right fit for implementing certain features and if a pat‐
tern is still recommended in the modern JavaScript context.
1
As applications got more interactive, requiring a large amount of JavaScript, the lan‐
guage came under constant criticism for its negative impact on performance. Devel‐
opers are continuously looking for new patterns that can optimize JavaScript
performance. This edition highlights such improvements wherever relevant. We will
also discuss framework-specific patterns such as React Hooks and Higher-Order
Components that have become increasingly popular in the age of React.js.
Going back a step, let us start by exploring the history and importance of design pat‐
terns. If you’re already familiar with this history, feel free to skip to “What Is a Pat‐
tern?” on page 2 to continue reading.
What Is a Pattern?
A pattern is a reusable solution template that you can apply to recurring problems
and themes in software design. Similar to other programming languages, when build‐
What Is a Pattern? | 3
Popular design patterns can be improvised further by harnessing the collective experi‐
ences of developers using those patterns and contributing back to the community.
In some cases, this leads to the creation of entirely new design patterns, while in
others, it can lead to improved guidelines on the usage of specific patterns. This
can ensure that pattern-based solutions continue to become more robust than ad
hoc ones.
Summary | 5
CHAPTER 2
“Pattern”-ity Testing, Proto-Patterns,
and the Rule of Three
From the moment a new pattern is proposed to its potential widespread adoption, a
pattern may have to go through multiple rounds of deep inspection by the design
community and software developers. This chapter talks about this journey of a newly
introduced “proto-pattern” through a “pattern”-ity test until it is eventually recog‐
nized as a pattern if it meets the rule of three.
This and the next chapter explore the approach to structuring, writing, presenting,
and reviewing nascent design patterns. If you’d prefer to learn established design pat‐
terns first, you can skip these two chapters for the time being.
7
Random documents with unrelated
content Scribd suggests to you:
CHAPTER VIII
JANE GETS OFF THE FAIRWAY
Inasmuch (said the Oldest Member) as you have not forgotten the
events leading up to the marriage of William Bates and Jane
Packard, I will not repeat them. All I need say is that that curious
spasm of romantic sentiment which had caused Jane to fall
temporarily under the spell of a man who was not only a poet but
actually a non-golfer, appeared to have passed completely away,
leaving no trace behind. From the day she broke off her engagement
to Spelvin and plighted her troth to young Bates, nothing could have
been more eminently sane and satisfactory than her behaviour.
She seemed entirely her old self once more. Two hours after
William had led her down the aisle, she and he were out on the links,
playing off the final of the Mixed Foursomes which—and we all
thought it the best of omens for their married happiness—they won
hands down. A deputation of all that was best and fairest in the
village then escorted them to the station to see them off on their
honeymoon, which was to be spent in a series of visits to well-known
courses throughout the country.
Before the train left, I took young William aside for a moment. I
had known both him and Jane since childhood, and the success of
their union was very near my heart.
“William,” I said, “a word with you.”
“Make it snappy,” said William.
“You have learned by this time,” I said, “that there is a strong
romantic streak in Jane. It may not appear on the surface, but it is
there. And this romantic streak will cause her, like so many wives, to
attach an exaggerated importance to what may seem to you trivial
things. She will expect from her husband not only love and a
constant tender solicitude—”
“Speed it up,” urged William.
“What I am trying to say is that, after the habit of wives, she will
expect you to remember each year the anniversary of your wedding
day, and will be madder than a wet hen if you forget it.”
“That’s all right. I thought of that myself.”
“It is not all right,” I insisted. “Unless you take the most earnest
precautions, you are absolutely certain to forget. A year from now
you will come down to breakfast and Jane will say to you, ‘Do you
know what day it is to-day?’ and you will answer ‘Tuesday’ and reach
for the ham and eggs, thus inflicting on her gentle heart a wound
from which it will not readily recover.”
“Nothing like it,” said William, with extraordinary confidence. “I’ve
got a system calculated to beat the game every time. You know how
fond Jane is of white violets?”
“Is she?”
“She loves ’em. The bloke Spelvin used to give her a bunch every
day. That’s how I got the idea. Nothing like learning the shots from
your opponent. I’ve arranged with a florist that a bunch of white
violets is to be shipped to Jane every year on this day. I paid five
years in advance. I am therefore, speaking in the most conservative
spirit, on velvet. Even if I forget the day, the violets will be there to
remind me. I’ve looked at it from every angle, and I don’t see how it
can fail. Tell me frankly, is the scheme a wam or is it not?”
“A most excellent plan,” I said, relieved. And the next moment the
train came in. I left the station with my mind at rest. It seemed to me
that the only possible obstacle to the complete felicity of the young
couple had been removed.
Jane’s mind was in a whirl as she went home in the train. To have
met Rodney Spelvin again was enough in itself to stimulate into
activity that hidden pulse of romance in her. To discover that she had
been in his thoughts so continuously all these years and that she still
held such sway over his faithful heart that he had drawn the heroine
of his novel from her was simply devastating. Mechanically she got
out at the right station and mechanically made her way to the
cottage. She was relieved to find that William was still out on the
links. She loved William devotedly, of course, but just at the moment
he would have been in the way; for she wanted a quiet hour with The
Purple Fan. It was necessary for her to re-read in the light of this
new knowledge the more important of the scenes in which Eulalie
French figured. She knew them practically by heart already, but
nevertheless she wished to read them again. When William returned,
warm and jubilant, she was so absorbed that she only just had time
to slide the book under the sofa-cushion before the door opened.
Some guardian angel ought to have warned William Bates that he
was selecting a bad moment for his re-entry into the home, or at
least to have hinted that a preliminary wash and brush-up would be
no bad thing. There had been rain in the night, causing the links to
become a trifle soggy in spots, and William was one of those
energetic golfers who do not spare themselves. The result was that
his pleasant features were a good deal obscured by mud. An
explosion-shot out of the bunker on the fourteenth had filled his hair
with damp sand, and his shoes were a disgrace to any refined home.
No, take him for all in all, William did not look his best. He was fine if
the sort of man you admired was the brawny athlete straight from the
dust of the arena; but on a woman who was picturing herself the
heroine of The Purple Fan he was bound to jar. Most of the scenes
in which Eulalie French played anything like a fat part took place
either on moonlight terraces or in beautifully furnished studios
beneath the light of Oriental lamps with pink silk shades, and all the
men who came in contact with her—except her husband, a
clodhopping brute who spent most of his time in riding-kit—were
perfectly dressed and had dark, clean-cut, sensitive faces.
William, accordingly, induced in Jane something closely
approximating to the heeby-jeebies.
“Hullo, old girl!” said William, affectionately. “You back? What have
you been doing with yourself?”
“Oh, shopping,” said Jane, listlessly.
“See any one you knew?”
For a moment Jane hesitated.
“Yes,” she said. “I met Rodney Spelvin.”
Jealousy and suspicion had been left entirely out of William
Bates’s make-up. He did not start and frown; he did not clutch the
arm of his chair; he merely threw back his head and laughed like a
hyæna. And that laugh wounded Jane more than the most violent
exhibition of mistrust could have done.
“Good Lord!” gurgled William, jovially. “You don’t mean to say that
bird is still going around loose? I should have thought he would have
been lynched years ago. Looks like negligence somewhere.”
There comes a moment in married life when every wife gazes
squarely at her husband and the scales seem to fall from her eyes
and she sees him as he is—one of Nature’s Class A fatheads.
Fortunately for married men, these times of clear vision do not last
long, or there would be few homes left unbroken. It was so that Jane
gazed at William now, but unhappily her conviction that he was an
out-size in rough-neck chumps did not pass. Indeed, all through that
evening it deepened. That night she went to bed feeling for the first
time that, when the clergyman had said, “Wilt thou, Jane?” and she
had replied in the affirmative, a mean trick had been played on an
inexperienced girl.
And so began that black period in the married life of Jane and
William Bates, the mere recollection of which in after years was
sufficient to put them right off their short game and even to affect
their driving from the tee. To William, having no clue to the cause of
the mysterious change in his wife, her behaviour was inexplicable.
Had not her perfect robustness made such a theory absurd, he
would have supposed that she was sickening for something. She
golfed now intermittently, and often with positive reluctance. She was
frequently listless and distrait. And there were other things about her
of which he disapproved.
“I say, old girl,” he said one evening, “I know you won’t mind my
mentioning it, and I don’t suppose you’re aware of it yourself, but
recently you’ve developed a sort of silvery laugh. A nasty thing to
have about the home. Try to switch it off, old bird, would you mind?”
Jane said nothing. The man was not worth answering. All through
the pages of The Purple Fan, Eulalie French’s silvery laugh had
been highly spoken of and greatly appreciated by one and all. It was
the thing about her that the dark, clean-cut, sensitive-faced men
most admired. And the view Jane took of the matter was that if
William did not like it the poor fish could do the other thing.
But this brutal attack decided her to come out into the open with
the grievance which had been vexing her soul for weeks past.
“William,” she said, “I want to say something. William, I am feeling
stifled.”
“I’ll open the window.”
“Stifled in this beastly little village, I mean,” said Jane, impatiently.
“Nobody ever does anything here except play golf and bridge, and
you never meet an artist-soul from one year’s end to the other. How
can I express myself? How can I be myself? How can I fulfil myself?”
“Do you want to?” asked William, somewhat out of his depth.
“Of course I want to. And I shan’t be happy unless we leave this
ghastly place and go to live in a studio in town.”
William sucked thoughtfully at his pipe. It was a tense moment for
a man who hated metropolitan life as much as he did. Nevertheless,
if the solution of Jane’s recent weirdness was simply that she had
got tired of the country and wanted to live in town, to the town they
must go. After a first involuntary recoil, he nerved himself to the
martyrdom like the fine fellow he was.
“We’ll pop off as soon as I can sell the house,” he said.
“I can’t wait as long as that. I want to go now.”
“All right,” said William, amiably. “We’ll go next week.”