100% found this document useful (1 vote)
101 views

Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design 2nd Edition Dmitri Nesteruk download

The document is a promotional and informational text about the book 'Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design' by Dmitri Nesteruk. It includes links to download the book and mentions other related titles by the same author. The content also outlines the structure of the book, covering various design patterns and principles in modern C++.

Uploaded by

mameyirenalt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
101 views

Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design 2nd Edition Dmitri Nesteruk download

The document is a promotional and informational text about the book 'Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design' by Dmitri Nesteruk. It includes links to download the book and mentions other related titles by the same author. The content also outlines the structure of the book, covering various design patterns and principles in modern C++.

Uploaded by

mameyirenalt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Design Patterns in Modern C++20: Reusable

Approaches for Object-Oriented Software Design


2nd Edition Dmitri Nesteruk pdf download

https://ebookmeta.com/product/design-patterns-in-
modern-c20-reusable-approaches-for-object-oriented-software-
design-2nd-edition-dmitri-nesteruk-2/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Design Patterns in Modern C++20: Reusable Approaches


for Object-Oriented Software Design 2nd Edition Dmitri
Nesteruk

https://ebookmeta.com/product/design-patterns-in-
modern-c20-reusable-approaches-for-object-oriented-software-
design-2nd-edition-dmitri-nesteruk-2/

Design Patterns in .NET: Reusable Approaches in C# and


F# for Object-Oriented Software Design 1st Edition
Dmitri Nesteruk

https://ebookmeta.com/product/design-patterns-in-net-reusable-
approaches-in-c-and-f-for-object-oriented-software-design-1st-
edition-dmitri-nesteruk/

Design Patterns in .NET 6: Reusable Approaches in C#


and F# for Object-Oriented Software Design 3rd Edition
Dmitri Nesteruk

https://ebookmeta.com/product/design-patterns-in-net-6-reusable-
approaches-in-c-and-f-for-object-oriented-software-design-3rd-
edition-dmitri-nesteruk/

SCR 2022 Sustainibility and Climate Risk Book 1st


Edition Global Association Of Risk Professionals (Garp)

https://ebookmeta.com/product/scr-2022-sustainibility-and-
climate-risk-book-1st-edition-global-association-of-risk-
professionals-garp/
Anxiety: A Philosophical History 1st Edition Bettina
Bergo

https://ebookmeta.com/product/anxiety-a-philosophical-
history-1st-edition-bettina-bergo/

The Science and Art of Dreaming 1st Edition Mark.


Blagrove

https://ebookmeta.com/product/the-science-and-art-of-
dreaming-1st-edition-mark-blagrove/

Bound In Cabo 1st Edition Dana Isaly

https://ebookmeta.com/product/bound-in-cabo-1st-edition-dana-
isaly/

From Slave Ship to Supermax Mass Incarceration Prisoner


Abuse and the New Neo Slave Novel 1st Edition Patrick
Elliot Alexander

https://ebookmeta.com/product/from-slave-ship-to-supermax-mass-
incarceration-prisoner-abuse-and-the-new-neo-slave-novel-1st-
edition-patrick-elliot-alexander/

The End of World Order and American Foreign Policy 1st


Edition Robert D. Blackwill

https://ebookmeta.com/product/the-end-of-world-order-and-
american-foreign-policy-1st-edition-robert-d-blackwill/
Data Protection And Privacy: The Internet Of Bodies 1st
Edition Ronald Leenes

https://ebookmeta.com/product/data-protection-and-privacy-the-
internet-of-bodies-1st-edition-ronald-leenes/
Dmitri Nesteruk

Design Patterns in Modern C++20


Reusable Approaches for Object-Oriented Software
Design
2nd ed.
Dmitri Nesteruk
St. Petersburg, Russia

ISBN 978-1-4842-7294-7 e-ISBN 978-1-4842-7295-4


https://doi.org/10.1007/978-1-4842-7295-4

© Dmitri Nesteruk 2022

Cover designed by eStudioCalamar


Distributed to the book trade worldwide by Apress Media, LLC, 1 New
York Plaza, New York, NY 10004, U.S.A. Phone 1-800-SPRINGER, fax
(201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit
www.springeronline.com. Apress Media, LLC is a California LLC and the
sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail
booktranslations@springernature.com; for reprint, paperback, or audio
rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or
promotional use. eBook versions and licenses are also available for
most titles. For more information, reference our Print and eBook Bulk
Sales web page at http://www.apress.com/bulk-sales.

This work is subject to copyright. All rights are reserved by the


Publisher, whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other
physical way, and transmission or information storage and retrieval,
electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.

Trademarked names, logos, and images may appear in this book. Rather
than use a trademark symbol with every occurrence of a trademarked
name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark. The use in this publication
of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of
opinion as to whether or not they are subject to proprietary rights.

While the advice and information in this book are believed to be true
and accurate at the date of publication, neither the authors nor the
editors nor the publisher can accept any legal responsibility for any
errors or omissions that may be made. The publisher makes no
warranty, express or implied, with respect to the material contained
herein.

This Apress imprint is published by the registered company APress


Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub via the book’s
product page, located at www.apress.com/9781484272947. For more
detailed information, please visit http://www.apress.com/source-code.
Table of Contents
Chapter 1:​Introduction
Who This Book Is For
On Code Examples
On Developer Tools
Preface to the Second Edition
Important Concepts
Curiously Recurring Template Pattern
Mixin Inheritance
Old-Fashioned Static Polymorphism
Static Polymorphism with Concepts
Properties
The SOLID Design Principles
Single Responsibility Principle
Open-Closed Principle
Liskov Substitution Principle
Interface Segregation Principle
Dependency Inversion Principle
Part I: Creational Patterns
Chapter 2:​Builder
Scenario
Simple Builder
Fluent Builder
Communicating Intent
Groovy-Style Builder
Composite Builder
Builder Parameter
Builder Inheritance
Summary
Chapter 3:​Factories
Scenario
Factory Method
Factory
Factory Methods and Polymorphism
Nested Factory
Abstract Factory
Functional Factory
Object Tracking
Summary
Chapter 4:​Prototype
Object Construction
Ordinary Duplication
Duplication via Copy Construction
Virtual Constructor
Serialization
Prototype Factory
Summary
Chapter 5:​Singleton
Singleton As Global Object
Classic Implementation
Thread Safety
The Trouble with Singleton
Per-Thread Singleton
Ambient Context
Singletons and Inversion of Control
Monostate
Summary
Part II: Structural Patterns
Chapter 6:​Adapter
Scenario
Adapter
Adapter Temporaries
Bidirectional Converter
Summary
Chapter 7:​Bridge
The Pimpl Idiom
Bridge
Summary
Chapter 8:​Composite
Array-Backed Properties
Grouping Graphic Objects
Neural Networks
Shrink-Wrapping the Composite
Conceptual Improvements
Concepts and Global Operators
Composite Specification
Summary
Chapter 9:​Decorator
Scenario
Dynamic Decorator
Static Decorator
Functional Decorator
Summary
Chapter 10:​Façade
Magic Square Generator
Fine-Tuning
Building a Trading Terminal
An Advanced Terminal
Where’s the Façade?​
Summary
Chapter 11:​Flyweight
User Names
Boost.​Flyweight
String Ranges
Naïve Approach
Flyweight Implementation
Summary
Chapter 12:​Proxy
Smart Pointers
Property Proxy
Virtual Proxy
Communication Proxy
Value Proxy
Summary
Part III: Behavioral Patterns
Chapter 13:​Chain of Responsibility
Scenario
Pointer Chain
Broker Chain
Summary
Chapter 14:​Command
Scenario
Implementing the Command Pattern
Undo Operations
Composite Command
Command Query Separation
Summary
Chapter 15:​Interpreter
Parsing Integral Numbers
Numeric Expression Evaluator
Lexing
Parsing
Using the Lexer and Parser
Parsing with Boost.​Spirit
Abstract Syntax Tree
Parser
Printer
Summary
Chapter 16:​Iterator
Iterators in the Standard Library
Traversing a Binary Tree
Iteration with Coroutines
Summary
Chapter 17:​Mediator
Chat Room
Mediator with Events
Service Bus As Mediator
Summary
Chapter 18:​Memento
Bank Account
Undo and Redo
Memory Considerations
Using Memento for Interop
Summary
Chapter 19:​Null Object
Scenario
Null Object
shared_​ptr Is Not a Null Object
Design Improvements
Implicit Null Object
Interaction with Other Patterns
Summary
Chapter 20:​Observer
Property Observers
Observer<T>
Observable<T>
Connecting Observers and Observables
Dependency Problems
Unsubscription and Thread Safety
Reentrancy
Observer with Boost.​Signals2
Views
Summary
Chapter 21:​State
State-Driven State Transitions
Handmade State Machine
Switch-Based State Machine
State Machines with Boost.​MSM
Summary
Chapter 22:​Strategy
Dynamic Strategy
Static Strategy
Summary
Chapter 23:​Template Method
Game Simulation
Functional Template Method
Summary
Chapter 24:​Visitor
Intrusive Visitor
Reflective Printer
What Is Dispatch?​
Classic Visitor
Implementing an Additional Visitor
Acyclic Visitor
Variants and std::visit
Summary
Index
About the Author
Dmitri Nesteruk
is a quantitative analyst, developer,
course and book author, and an
occasional conference speaker. His
professional interests lie in software
development and integration practices in
the areas of computation, quantitative
finance, and algorithmic trading. His
technological interests include C# and
C++ programming as well as high-
performance computing using
technologies such as CUDA and FPGAs.
He has been a C# MVP since 2009.
About the Technical Reviewers
David Pazmino
has been developing software applications for 20 years in Fortune 100
companies. He is an experienced developer in front-end and back-end
development who specializes in developing machine learning models
for financial applications. David has developed many applications in
C++, STL, and ATL for companies using Microsoft technologies. He
currently develops applications in Scala and Python for deep learning
neural networks. David has a degree from Cornell University, a masters
from Pace University in Computer Science, and a masters from
Northwestern in Predictive Analytics.

Massimo Nardone
has more than 25 years of experience in security, web/mobile
development, cloud, and IT architecture. His true IT passions are
security and Android. He has been programming and teaching how to
program with Android, Perl, PHP, Java, VB, Python, C/C++, and MySQL
for more than 20 years. He holds a Master of Science degree in
Computing Science from the University of Salerno, Italy.
He has worked as a CISO, CSO, security executive, IoT executive,
project manager, software engineer, research engineer, chief security
architect, PCI/SCADA auditor, and senior lead IT security/cloud/SCADA
architect for many years. His technical skills include security, Android,
cloud, Java, MySQL, Drupal, Cobol, Perl, web and mobile development,
MongoDB, D3, Joomla, Couchbase, C/C++, WebGL, Python, Pro Rails,
Django CMS, Jekyll, Scratch, and more.
He worked as visiting lecturer and supervisor for exercises at the
Networking Laboratory of the Helsinki University of Technology (Aalto
University). He holds four international patents (PKI, SIP, SAML, and
Proxy areas). He is currently working for Cognizant as head of cyber
security and CISO to help both internally and externally with clients in
areas of information and cyber security, like strategy, planning,
processes, policies, procedures, governance, awareness, and so forth. In
June 2017 he became a permanent member of the ISACA Finland Board.
Other documents randomly have
different content
Corrig Oh, lor! Myles—Myles—what’s the matter—are you mad?
Myles No—that is—why—why did ye raise your hand at me in that
way?
Corrig I didn’t.
Myles I thought ye did—I’m mighty quick at takin’ thim hints, bein’
on me keepin’ agin the gaugers—go on—I didn’t hurt ye.
Corrig Not much.
Myles You want to find out who this girl is?
Corrig I’ll give £20 for the information—there’s ten on account.
[Gives money.
Myles Long life t’ye; that’s the first money I iver got from a lawyer,
and bad luck to me, but there’s a cure for the evil eye in thim pieces.
Corrig You will watch to-night?
Myles In five minutes I’ll be inside the cottage itself.
Corrig That’s the lad.
Myles [Aside.] I was goin’ there.
Corrig And to-morrow you will step down to my office with the
particulars?
Myles To-morrow you shall breakfast on them.
Corrig Good night, entirely. [Exit Corrigan, l.
Myles I’ll give ye a cowstail to swally, and make ye think it’s a
chapter in St. Patrick, ye spalpeen? When he called Eily the
misthress of Hardress Cregan, I nearly sthretched him—begorra, I
was full of sudden death that minute! Oh, Eily! acushla agrah
asthore machree! as the stars watch over Innisfallen, and as the
wathers go round it and keep it, so I watch and keep round you,
avourneen!
Song.—Myles.
Oh, Limerick is beautiful, as everybody knows,
The river Shannon’s full of fish, beside that city flows;
But it is not the river, nor the fish that preys upon my mind,
Nor with the town of Limerick have I any fault to find.
The girl I love is beautiful, she’s fairer than the dawn;
She lives in Garryowen, and she’s called the Colleen Bawn.
As the river, proud and bold, goes by that famed city,
So proud and cold, without a word, that Colleen goes by me!
Oh, hone! Oh, hone!

Oh, if I was the Emperor of Russia to command,


Or, Julius Cæsar, or the Lord Lieutenant of the land,
I’d give up all my wealth, my manes, I’d give up my army,
Both the horse, the fut, and the Royal Artillery;
I’d give the crown from off my head, the people on their knees,
I’d give my fleet of sailing ships upon the briny seas,
And a beggar I’d go to sleep, a happy man at dawn,
If by my side, fast for my bride, I’d the darlin’ Colleen Bawn.
Oh, hone! Oh, hone!

I must reach the cottage before the masther arrives; Father Tom is
there waitin’ for this keg o’ starlight—it’s my tithe; I call every tenth
keg “his riverince.” It’s worth money to see the way it does the old
man good, and brings the wather in his eyes, the only place I ever
see any about him—heaven bless him!
[Sings. Exit Myles, r.—Music.

SCENE III.—Interior of Eily’s Cottage on Muckross Head; fire


burning, r. 3 e.; table, r. c.; arm chair; two stools, r. of table; stool l.
of table; basin, sugar spoon, two jugs, tobacco, plate, knife, and
lemon on table.
Father Tom discovered smoking in arm chair, r. c.—Eily in balcony,
watching over lake.
Father Tom [Sings.] “Tobacco is an Injun weed.” And every weed
want’s wathering to make it come up; but tobacco bein’ an’ Injun
weed that is accustomed to a hot climate, water is entirely too cold
for its warrum nature—it’s whisky and water it wants. I wonder if
Myles has come; I’ll ask Eily. [Calls.] Eily, alanna! Eily, a suilish
machree!
Eily [Turning.] Is it me, Father Tom?
Father T Has he come?
Eily No; his boat is half a mile off yet.
Father T Half a mile! I’ll choke before he’s here.
Eily Do you mean Hardress?
Father T No, dear! Myles na Coppaleen—cum spiritu Hiberneuse—
which manes in Irish, wid a keg of poteen.
Enter Myles, r. u. e., down c.
Myles Here I am, your riverince, never fear. I tould Sheelah to hurry
up with the materials, knowin’ ye be dhry and hasty.
Enter Sheelah, with kettle of water, r. u. e.
Sheelah Here’s the hot water.
Myles Lave it there till I brew Father Tom a pint of mother’s milk.
Sheelah Well thin, ye’ll do your share of the work, an not a ha’porth
more.
Myles Didn’t I bring the sperrits from two miles and more? and I
deserve to have pref’rence to make the punch for his riverince.
Sheelah And didn’t I watch the kettle all night, not to let it off the
boil?—there now.
Myles [Quarreling with Sheelah.] No, you didn’t, etc.
Sheelah [Quarreling.] Yes, I did, etc.
Eily No, no; I’ll make it, and nobody else.
Father T Aisy now, ye becauns, and whist; Myles shall put in the
whisky, Sheelah shall put in the hot water, and Eily, my Colleen, shall
put the sugar in the cruiskeen. A blessin’ on ye all three that loves
the ould man. [Myles takes off hat—Women curtsey—they make
punch.] See now, my children, there’s a moral in everthing, e’en in a
jug of punch. There’s the sperrit, which is the sowl and strength of
the man. [Myles pours spirit from keg.] That’s the whisky. There’s the
sugar, which is the smile of woman; [Eily puts sugar.] without that
life is without taste or sweetness. Then there’s the lemon, [Eily puts
lemon.] which is love; a squeeze now and again does a boy no
harm; but not too much. And the hot water [Sheelah pours water.]
which is adversity—as little as possible if ye plaze—that makes the
good things better still.
Myles And it’s complate, ye see, for it’s a woman that gets into hot
wather all the while. [Pours from jug to jug.
Sheelah Myles, if I hadn’t the kettle, I’d bate ye.
Myles Then, why didn’t ye let me make the punch? There’s a guinea
for your riverince that’s come t’ye—one in ten I got a while ago—it’s
your tithe—put a hole in it, and hang it on your watch chain, for it’s
a mighty great charm entirely.
[They sit, Sheelah near fire, Colleen on stool beside her, Father Tom in
chair, Myles on stool, l. of table.
Father T Eily, look at that boy, and tell me, haven’t ye a dale to
answer for?
Eily He isn’t as bad about me as he used to be; he’s getting over it.
Myles Yes, darlin’, the storm has passed over, and I’ve got into
settled bad weather.
Father T Maybe, afther all, ye’d have done better to have married
Myles there, than be the wife of a man that’s ashamed to own ye.
Eily He isn’t—he’s proud of me. It’s only when I spake like the poor
people, and say or do anything wrong, that he’s hurt; but I’m gettin’
clane of the brogue, and learnin’ to do nothing—I’m to be changed
entirely.
Myles Oh! if he’d lave me yer own self, and only take away wid him
his improvements. Oh! murder—Eily, aroon, why wasn’t ye twins, an’
I could have one of ye, only nature couldn’t make two like ye—it
would be onreasonable to ax it.
Eily Poor Myles, do you love me still so much?
Myles Didn’t I lave the world to folley ye, and since then there’s
been neither night nor day in my life—I lay down on Glenna Point
above, where I see this cottage, and I lived on the sight of it. Oh!
Eily, if tears were pison to the grass there wouldn’t be a green blade
on Glenna Hill this day.
Eily But you knew I was married, Myles.
Myles Not thin, aroon—Father Tom found me that way, and sat
beside, and lifted up my soul. Then I confessed to him, and, sez he,
“Myles, go to Eily, she has something to say to you—say I sent you.”
I came, and ye tould me ye were Hardress Cregan’s wife, and that
was a great comfort entirely. Since I knew that [Drinks—voice in
cup.] I haven’t been the blackguard I was.
Father T See the beauty of the priest, my darlin’—videte et admirate
—see and admire it. It was at confession that Eily tould me she
loved Cregan, and what did I do?—sez I, “Where did you meet your
sweetheart?” “At Garryowen,” sez she. “Well,” says I; “that’s not the
place.” “Thrue, your riverince, it’s too public entirely,” sez she. “Ye’ll
mate him only in one place,” sez I; “and that’s the stile that’s behind
my chapel,” for, d’ye see, her mother’s grave was forenint the spot,
and there’s a sperrit round the place, [Myles drinks,] that kept her
pure and strong. Myles, ye thafe, drink fair.
Sheelah Come now, Eily, couldn’t ye cheer up his riverince wid the
tail of a song?
Eily Hardress bid me not sing any ould Irish songs, he says the
words are vulgar.
Sheelah Father Tom will give ye absolution.
Father T Put your lips to that jug; there’s only the strippens left.
Drink! and while that thrue Irish liquor warms your heart, take this
wid it. May the brogue of ould Ireland niver forsake your tongue—
may her music niver lave yer voice—and may a true Irishwoman’s
virtue niver die in your heart!
Myles Come, Eily, it’s my liquor—haven’t ye a word to say for it?
Song, Eily—“Cruiskeen Lawn.”

Let the farmer praise his grounds,


As the huntsman doth his hounds,
And the shepherd his fresh and dewy morn;
But I, more blest than they,
Spend each night and happy day.
With my smilin’ little Crusikeen Lawn, Lawn, Lawn.
Chorus [Repeat.] Gramachree, mavourneen, slanta gal avourneen,
Gramachree ma Cruiskeen Lawn, Lawn, Lawn,
With my smiling little Cruiskeen Lawn.

[Chorused by Myles, Father T., and Sheelah.


Myles.

And when grim Death appears,


In long and happy years,
To tell me that my glass is run,
I’ll say, begone you slave,
For great Bacchus gave me lave
To have another Cruiskeen Lawn—Lawn—Lawn.

Chorus.—Repeat.

Gramachree, &c., &c.


Hard [Without, l. u. e.] Ho! Sheelah—Sheelah!
Sheelah [Rising.] Whist! it’s the master.
Eily [Frightened.] Hardress! oh, my! what will he say if he finds us
here—run, Myles—quick, Sheelah—clear away the things.
Father T Hurry now, or we’ll get Eily in throuble.
[Takes keg—Myles takes jugs—Sheelah kettle.
Hard Sheelah, I say!
[Exeunt Father Tom and Myles, r. u. e., quickly.
Sheelah Comin’, Sir, I’m puttin’ on my petticoat.
[Exit Sheelah, r. u. e., quickly.
Enter Hardress and Danny, l. u. e. opening—Danny immediately goes
off, r. u. e.
Eily [c.] Oh, Hardress, asthore?
Hard [l. c.] Don’t call me by those confounded Irish words—what’s
the matter? you’re trembling like a bird caught in a trap.
Eily Am I, mavou—no I mean—is it tremblin’ I am, dear?
Hard What a dreadful smell of tobacco there is here, and the fumes
of whisky punch, too; the place smells like a shebeen. Who has been
here?
Eily There was Father Tom, an’ Myles dhropped in.
Hard Nice company for my wife—a vagabond.
Eily Ah! who made him so but me, dear? Before I saw you,
Hardress, Myles coorted me, and I was kindly to the boy.
Hard Damn it, Eily, why will you remind me that my wife was ever in
such a position?
Eily I won’t see him again—if yer angry, dear, I’ll tell him to go away,
and he will, because the poor boy loves me.
Hard Yes, better than I do you mean?
Eily No, I don’t—oh! why do you spake so to your poor Eily!
Hard Spake so! Can’t you say speak?
Eily I’ll thry, aroon—I’m sthrivin’—’tis mighty hard, but what wouldn’t
I undert-tee-ta—undergo for your sa-se—for your seek.
Hard Sake—sake!
Eily Sake—seek—oh, it is to bother people entirely they mixed ’em
up! Why didn’t they make them all one way?
Hard [Aside.] It is impossible! How can I present her as my wife?
Oh! what an act of madness to tie myself to one so much beneath
me—beautiful—good as she is—
Eily Hardress, you are pale—what has happened?
Hard Nothing—that is, nothing but what you will rejoice at.
Eily What d’ye mane?
Hard What do I mane! Mean—mean!
Eily I beg your pardon, dear.
Hard Well; I mean that after to-morrow there will be no necessity to
hide our marriage, for I shall be a beggar, my mother will be an
outcast, and amidst all the shame, who will care what wife a Cregan
takes?
Eily And d’ye think I’d like to see you dhragged down to my side—ye
don’t know me—see now—never call me wife again—don’t let on to
mortal that we’re married—I’ll go as a servant in your mother’s
house—I’ll work for the smile ye’ll give me in passing, and I’ll be
happy, if ye’ll only let me stand outside and hear your voice.
Hard You’re a fool. I told you that I was bethrothed to the richest
heiress in Kerry; her fortune alone can save us from ruin. To-night
my mother discovered my visits here, and I told her who you were.
Eily Oh! what did she say?
Hard It broke her heart.
Eily Hardress! is there no hope?
Hard None. That is none—that—that I can name.
Eily There is one—I see it.
Hard There is. We were children when we were married, and I could
get no priest to join our hands but one, and he had been disgraced
by his bishop. He is dead. There was no witness to the ceremony but
Danny Mann—no proof but his word, and your certificate.
Eily [Takes paper from her breast.] This!
Hard Eily! if you doubt my eternal love, keep that security; it gives
you the right to the shelter of my roof; but oh! if you would be
content with the shelter of my heart.
Eily And will it save ye, Hardress? And will your mother forgive me?
Hard She will bless you—she will take you to her breast.
Eily But you—another will take you to her breast.
Hard Oh, Eily, darling, d’ye think I could forget you, machree—forget
the sacrifice more than blood you give me?
Eily Oh! when you talk that way to me, ye might take my life, and
heart, and all. Oh! Hardress, I love you—take the paper and tare it.
Enter Myles c., opening. [Hardress takes paper.

Myles No. I’ll be damned if he shall.


Hard Scoundrel! you have been listening?
Myles To every word. I saw Danny, wid his ear agin that dure, so as
there was only one kay-hole, I adopted the windy. Eily, aroon, Mr.
Cregan will giv’ ye back that paper; you can’t tare up an oath; will ye
help him then to cheat this other girl, and to make her his mistress,
for that’s what she’ll be if ye are his wife. An’ after all, what is there
agin’ the crature? Only the money she’s got. Will you stop lovin’ him
when his love belongs to another? No! I know it by myself; but if ye
jine their hands together your love will be an adultry.
Eily Oh, no!
Hard Vagabond! outcast! jail bird! dare you prate of honor to me?
Myles [c.] I am an outlaw, Mr. Cregan—a felon, may be—but if you
do this thing to that poor girl that loves you so much—had I my neck
in the rope—or my fut on the deck of a convict ship—I’d turn round
and say to ye, “Hardress Cregan, I make ye a present of the
contimpt of a rogue.” [Snaps fingers.
Music till end Act.—Enter Father Tom, Sheelah and Danny, r. u. e.—
Hardress throws down paper—goes to table—takes hat.
Hard Be it so, Eily, farewell! until my house is clear of these vermin—
[Danny appears at back]—you will see me no more.
[Exit Hardress, l. c., followed by Danny.
Eily Hardress—Hardress! [Going up.] Don’t leave me, Hardress!
Father T [Intercepts her.] Stop, Eily!
Eily He’s gone—he’s gone! [Danny returns and listens.

Father T Give me that paper, Myles. [Myles picks it up—gives it.]


Kneel down there, Eily, before me—put that paper in your breast.
Eily [Kneeling.] Oh, what will I do—what will I do?
Father T Put your hand upon it now.
Eily Oh, my heart—my heart!
Father T Be thee hush, and spake after me—by my mother that’s in
heaven.
Eily By my mother that’s in heaven.
Father T By the light and the word.
Eily By the light and the word.
Father T Sleepin’ or wakin’.
Eily Sleepin’ or wakin’.
Father T This proof of my truth.
Eily This proof of my truth.
Father T Shall never again quit my breast.
Eily Shall never again quit my breast.
Eily utters a cry and falls—Tableau.
ACT II.

SCENE I.—[1st Grooves.]—Gap of Dunloe; same as 2d Scene, Act I.


—Music.
Enter Hardress and Danny, l. 1 e.
Hard [r.] Oh, what a giddy fool I’ve been! What would I give to
recall this fatal act which bars my fortune?
Danny [l.] There’s something throublin’ yez, Masther Hardress. Can’t
Danny do something to aise ye? Spake the word, and I’ll die for ye.
Hard Danny, I am troubled. I was a fool when I refused to listen to
you at the chapel of Castle Island.
Danny When I warned ye to have no call to Eily O’Connor?
Hard I was mad to marry her.
Danny I knew she was no wife for you. A poor thing widout any
manners, or money, or book larnin’, or a ha’porth o’ fortin’. Oh,
worra! I told ye that, but ye bate me off, and here now is the way of
it.
Hard Well, it’s done, and can’t be undone.
Danny Bedad, I dun know that. Wouldn’t she untie the knot herself—
couldn’t ye coax her?
Hard No.
Danny Is that her love for you? You that give up the divil an’ all for
her. What’s her ruin to yours? Ruin—goredoutha—ruin is it? Don’t I
pluck a shamrock and wear it a day for the glory of St. Patrick, and
then throw it away when it’s gone by my likin’s. What is she to be
ruined by a gentleman? Whoo! Mighty good for the likes o’ her.
Hard She would have yielded, but—
Danny Asy now, an’ I’ll tell ye. Pay her passage out to Quaybeck and
put her aboord a three-master, widout sayin’ a word. Lave it to me.
Danny will clear the road foreninst ye.
Hard Fool, if she still possesses that certificate—the proof of my first
marriage—how can I dare to wed another? Commit bigamy—
disgrace my wife—bastardize my children?
Danny Den by the powers, I’d do by Eily as wid the glove there on
yer hand; make it come off as it came on—an’ if it fits too tight, take
the knife to it.
Hard [Turning to him.] What do you mean?
Danny Only gi’ me the word, an’ I’ll engage that the Colleen Bawn
will never trouble ye any more; don’t ax me any questions at all.
Only—if you’re agreeable, take off that glove from yer hand an’ give
it to me for a token—that’s enough.
Hard [Throws off cloak; seizes him; throws him down.] Villain! Dare
you utter a word or meditate a thought of violence towards that
girl—
Danny Oh, murder! may I never die in sin, if—
Hard Begone! away, at once, and quit my sight. I have chosen my
doom! I must learn to endure it—but blood!—and hers! Shall I make
cold and still that heart that beats alone for me?—quench those eyes
that look so tenderly in mine? Monster! am I so vile that you dare to
whisper such a thought?
Danny Oh, masther! divil burn me if I meant any harm.
Hard Mark me well, now. Respect my wife as you would the queen
of the land—whisper a word such as those you uttered to me, and it
will be your last. I warn ye—remember and obey.
[Exit Hardress, r.
Danny [Rises—picks up cloak.] Oh, the darlin’ crature! would I
harrum a hair of her blessed head?—no! Not unless you gave me
that glove, and den I’d jump into the bottomless pit for ye.
[Exit Danny, r. Music—change.

SCENE II.—Room in Mrs. Cregan’s house; window, r., in flat, backed


by landscape; door, l., in flat; backed by interior. Lights up.
Enter Anne Chute, l. in flat.
Anne That fellow runs in my head. [Looking at window.] There he is
in the garden, smoking like a chimney-pot. [Calls.] Mr. Daly!
Kyrle [Outside window.] Good morning!
Anne [Aside.] To think he’d smile that way, after going Leandering all
night like a dissipated young owl. [Aloud.] Did you sleep well?
[Aside.] Not a wink, you villain, and you know it.
Kyrle I slept like a top.
Anne [Aside.] I’d like to have the whipping of ye. [Aloud.] When did
you get back?
Kyrle Get back! I’ve not been out.
Anne [Aside.] He’s not been out! This is what men come to after a
cruise at sea—they get sunburnt with love. Those foreign donnas
teach them to make fire-places of their hearts, and chimney-pots of
their mouths. [Aloud.] What are you doing down there? [Aside.] As if
he was stretched out to dry. [Kyrle puts down pipe outside.
Enter Kyrle through window, r., in flat.
Kyrle [r. c.] I have been watching Hardress coming over from Divil’s
Island in his boat—the wind was dead against him.
Anne [l. c.] It was fair for going to Divil’s Island last night, I believe.
Kyrle Was it?
Anne You were up late, I think?
Kyrle I was. I watched by my window for hours, thinking of her I
loved—slumber overtook me, and I dreamed of a happiness I never
can hope for.
Anne Look me straight in the face.
Kyrle Oh! if some fairy could strike us into stone now—and leave us
looking forever into each other’s faces, like the blue lake below and
the sky above it!
Anne Kyrle Daly! What would you say to a man who had two loves,
one to whom he escaped at night, and the other to whom he
devoted himself during the day—what would you say?
Kyrle I’d say he had no chance.
Anne Oh, Captain Cautious! Well answered. Isn’t he fit to take care
of anybody! his cradle was cut out of a witness-box.
Enter Hardress through window, r., in flat.
Kyrle [r.] Anne! I don’t know what you mean, but that I know that I
love you, and you are sporting with a wretchedness you can not
console. I was wrong to remain here so long, but I thought my
friendship for Hardress would protect me against your invasion—now
I will go. [Hardress advancing.
Hard [c.] No, Kyrle, you will stay. Anne, he loves you, and I more
than suspect you prefer him to me. From this moment you are free;
I release you from all troth to me: in his presence I do this.
Anne [l.] Hardress!
Hard There is a bar between us which you should have known
before, but I could not bring myself to confess. Forgive me, Anne—
you deserve a better man than I am. [Exit, l.
Anne A bar between us! What does he mean?
Kyrle He means that he is on the verge of ruin: he did not know how
bad things were till last night. His generous noble heart recoils from
receiving anything from you but love.
Anne And does he think I’d let him be ruined any way? Does he
think I wouldn’t sell the last rood of land—the gown off my back,
and the hair off my head, before that boy that protected and loved
me, the child, years ago, should come to a hap’orth of harrum?
[Crosses to r.
Kyrle Miss Chute!
Anne Well, I can’t help it. When I am angry the brogue comes out,
and my Irish heart will burst through manners, and graces, and
twenty stay-laces. [Crosses to l.] I’ll give up my fortune—that I will!
Kyrle You can’t—you’ve got a guardian who can not consent to such
a sacrifice.
Anne Have I? then I’ll find a husband that will.
Kyrle [Aside.] She means me—I see it in her eyes.
Anne [Aside.] He’s trying to look unconscious. [Aloud.] Kyrle Daly, on
your honor and word as a gentleman, do you love me and nobody
else?
Kyrle Do you think me capable of contaminating your image by
admitting a meaner passion into my breast?
Anne Yes, I do.
Kyrle Then you wrong me.
Anne I’ll prove that in one word. Take care, now; it’s coming.
Kyrle Go on.
Anne [Aside.] Now I’ll astonish him. [Aloud.] Eily!
Kyrle What’s that?
Anne “Shule, shule, agrah!”
Kyrle Where to?
Anne Three winks, as much as to say, “Are you coming?” and an
extinguisher above here means “Yes.” Now you see I know all about
it.
Kyrle You have the advantage of me.
Anne Confess now, and I’ll forgive you.
Kyrle I will; tell me what to confess, and I’ll confess it—I don’t care
what it is.
Anne [Aside.] If I hadn’t eye proof he’d brazen it out of me. Isn’t he
cunning? He’s one of those that would get fat where a fox would
starve.
Kyrle That was a little excursion into my past life—a sudden descent
on my antecedents, to see if you could not surprise an infidelity—but
I defy you.
Anne You do? I accept that defiance; and, mind me, Kyrle, if I find
you true as I once thought, there’s my hand; but if you are false in
this, Anne Chute will never change her name for yours. [He kisses
her hand.] Leave me now.
Kyrle Oh, the lightness you have given to my heart! The number of
pipes I’ll smoke this afternoon will make them think we’ve got a
haystack on fire. [Exit Kyrle, through window, r.
Anne [Rings bell on table, r.] Here, Pat, Barney, some one.
Enter Servant, l. door in flat.
Tell Larry Dolan, my groom, to saddle the black mare, Fireball, but
not bring her round the house—I’ll mount in the stables.
[Exit Servant, l. door in flat.
I’ll ride over to Muckross Head, and draw that cottage; I’ll know
what’s there. It mayn’t be right, but I haven’t a big brother to see
after me—and self-protection is the first law of nature.
[Exit Anne, r. 1 e.
Music. Enter Mrs. Cregan and Hardress, l. door in flat.
Mrs. C [r. c.] What do you say, Hardress?
Hard [l. c.] I say, mother, that my heart and faith are both already
pledged to another, and I can not break my engagement.
Mrs. C And this is the end of all our pride!
Hard Repining is useless—thought and contrivance are of no avail—
the die is cast.
Mrs. C Hardress, I speak not for myself, but for you—and I would
rather see you in your coffin than married to this poor, lowborn, silly,
vulgar creature. I know you, my son; you will be miserable when the
infatuation of first love is past; when you turn from her and face the
world, as one day you must do, you will blush to say, “This is my
wife.” Every word from her mouth will be a pang to your pride. You
will follow her movements with terror—the contempt and derision
she excites will rouse you first to remorse, and then to hatred—and
from the bed to which you go with a blessing, you will rise with a
curse.
Hard Mother! mother! [Throws himself in chair.
Mrs. C To Anne you have acted a heartless and dishonorable part—
her name is already coupled with yours at every fireside in Kerry.
Enter Servant, l. door in flat.
Serv Mr. Corrigan, ma’am.
Mrs. C He comes for his answer. Show him in.
[Exit Servant, l. door in flat.
The hour has come, Hardress—what answer shall I give him?
Hard Refuse him—let him do his worst.
Mrs. C And face beggary! On what shall we live? I tell you the prison
for debt is open before us. Can you work? No! Will you enlist as a
soldier, and send your wife into service? We are ruined—d’ye hear?—
ruined! I must accept this man only to give you and yours a shelter,
and under Corrigan’s roof I may not be ashamed, perhaps, to
receive your wife.
Enter Servant, showing in Mr. Corrigan, l. door in flat.
Corrig [l.] Good morning, ma’am; I am punctual, you perceive.
Mrs. C [c.] We have considered your offer, sir, and we see no
alternative—but—but—
Corrig Mrs. Cregan, I’m proud, ma’am, to take your hand.
Hard [Starting up.] Begone—begone, I say; touch her, and I’ll brain
you!
Corrig Squire! Sir! Mr. Hardress!
Hard Must I hurl you from the house?
Enter two Servants, door in flat.
Mrs. C Hardress, my darling boy, restrain yourself.
Corrig Good morning, ma’am. I have my answer. [To Servant.] Is Miss
Chute within?
Serv No, sir; she’s just galloped out of the stable yard.
Corrig Say I called to see her. I will wait upon her at this hour to-
morrow. [Looking at the Cregans.] To-morrow! to-morrow!
[Exit, followed by Servants, l. door in flat.
Mrs. C To-morrow will see us in Limerick Jail, and this house in the
hands of the sheriff.
Hard Mother, heaven guide and defend me! let me rest for a while—
you don’t know all yet, and I have not the heart to tell you.
[Crosses l.
Mrs. C With you, Hardress, I can bear anything—anything—but your
humiliation and your unhappiness—
Hard I know it, mother, I know it. [Exit, l. 1 e. Music.
Danny appears at window, r., in flat.
Danny Whisht—missiz—whisht.
Mrs. C [l. c.] Who’s there?
Danny It’s me, sure, Danny—that is—I know the throuble that’s in it.
I’ve been through it all wid him.
Mrs. C You know, then?
Danny Everything, ma’am; and, sure, I shtruv hard and long to
impache him from doing it.
Mrs. C Is he, indeed, so involved with this girl that he will not give
her up?
Danny No; he’s got over the worst of it, but she holds him tight, and
he feels kindly and soft-hearted for her, and daren’t do what another
would.
Mrs. C Dare not?
Danny Sure she might be packed off across the wather to Ameriky,
or them parts beyant? Who’d ever ax a word afther her?—barrin’ the
masther, who’d murdher me if he knew I whispered such a thing.
Mrs. C But would she go?
Danny Ow, ma’am, wid a taste of persuasion, we’d mulvather her
aboord. But there’s another way again, and if ye’d only coax the
masther to send me his glove, he’d know the manin’ of that token,
and so would I.
Mrs. C His glove?
Danny Sorra a ha’porth else. If he’ll do that, I’ll take my oath ye’ll
hear no more of the Colleen Bawn.
Mrs. C I’ll see my son. [Exit l. d. f.
Danny Tare an’ ’ouns, that lively girl, Miss Chute, has gone the road
to Muckross Head; I’ve watched her—I’ve got my eye on all of them.
If she sees Eily—ow, ow, she’ll get the ring itself in that helpin’
maybe, of kale-canon. By the piper, I’ll run across the lake, and get
there first; she’s got a long round to go, and the wind rising—a purty
blast entirely.
[Goes to window—Music.
Re-enter Mrs. Cregan, l. d. f., with glove.
Mrs. C [Aside.] I found his gloves in the hall, where he had thrown
them in his hat.
Danny Did ye ax him, ma’am?
Mrs. C I did—and here is the reply. [Holds out glove.
Danny He has changed his mind, then?
Mrs. C He has entirely.
Danny And—and—I am—to—do it?
Mrs. C That is the token.
Danny I know it—I’ll keep my promise. I’m to make away with her?
Mrs. C Yes, yes—take her away—away with her!
[Exit Mrs. Cregan, l. door in flat.
Danny Never fear, ma’am. [Going to window.] He shall never see or
hear again of the Colleen Bawn.
[Exit Danny through window—change.

SCENE III.—Exterior of Eily’s Cottage; Cottage, r. 3 e.; set pieces,


backed by Lake; table and two seats, r. c.
Sheelah and Eily discovered, knitting.
Sheelah [r.] Don’t cry, darlin’—don’t, alanna!
Eily [l.] He’ll never come back to me—I’ll never see him again,
Sheelah!
Sheelah Is it lave his own wife?

You might also like