100% found this document useful (7 votes)
37 views

(Ebook) Client-Server Web Apps with JavaScript and Java: Rich, Scalable, and RESTful by Saternos, Casimir ISBN 9781449369330, 1449369332 all chapter instant download

The document provides information on various ebooks available for download, including titles related to client-server web applications, JavaScript, Java, and RESTful services. It highlights the features of each ebook, including their ISBNs and links for access. Additionally, it outlines the content structure of 'Client-Server Web Apps with JavaScript and Java' by Casimir Saternos, detailing chapters on JavaScript tools, REST, Java tools, client-side frameworks, and API design.

Uploaded by

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

(Ebook) Client-Server Web Apps with JavaScript and Java: Rich, Scalable, and RESTful by Saternos, Casimir ISBN 9781449369330, 1449369332 all chapter instant download

The document provides information on various ebooks available for download, including titles related to client-server web applications, JavaScript, Java, and RESTful services. It highlights the features of each ebook, including their ISBNs and links for access. Additionally, it outlines the content structure of 'Client-Server Web Apps with JavaScript and Java' by Casimir Saternos, detailing chapters on JavaScript tools, REST, Java tools, client-side frameworks, and API design.

Uploaded by

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

Download Full Version ebook - Visit ebooknice.

com

(Ebook) Client-Server Web Apps with JavaScript and


Java: Rich, Scalable, and RESTful by Saternos,
Casimir ISBN 9781449369330, 1449369332

https://ebooknice.com/product/client-server-web-apps-with-
javascript-and-java-rich-scalable-and-restful-55585992

Click the button below to download

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Client-Server Web Apps with JavaScript and Java by


Casimir Saternos ISBN 9781449369330, 1449369332

https://ebooknice.com/product/client-server-web-apps-with-javascript-
and-java-4670268

ebooknice.com

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason;


Viles, James ISBN 9781459699816, 9781743365571,
9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT


II Success) by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

ebooknice.com

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena


Alfredsson, Hans Heikne, Sanna Bodemyr ISBN 9789127456600,
9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

ebooknice.com
(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master
the SAT Subject Test: Math Levels 1 & 2) by Arco ISBN
9780768923049, 0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094

ebooknice.com

(Ebook) Cambridge IGCSE and O Level History Workbook 2C -


Depth Study: the United States, 1919-41 2nd Edition by
Benjamin Harrison ISBN 9781398375147, 9781398375048,
1398375144, 1398375047
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

ebooknice.com

(Ebook) Building RESTful Web Services with Java EE 8:


Create modern RESTful web services with the Java EE 8 API
by Mario-Leander Reimer ISBN 9781789532883, 1789532884
https://ebooknice.com/product/building-restful-web-services-with-java-
ee-8-create-modern-restful-web-services-with-the-java-
ee-8-api-10416642
ebooknice.com

(Ebook) Building Versatile Mobile Apps with Python and


REST: RESTful Web Services with Django and React by Art
Yudin ISBN 9781484263327, 1484263324
https://ebooknice.com/product/building-versatile-mobile-apps-with-
python-and-rest-restful-web-services-with-django-and-react-52951278

ebooknice.com

(Ebook) Node: Up and Running: Scalable Server-Side Code


with JavaScript by Tom Hughes-Croucher, Mike Wilson ISBN
9781449398583, 1449398588
https://ebooknice.com/product/node-up-and-running-scalable-server-
side-code-with-javascript-2560794

ebooknice.com
Client-Server Web Apps with JavaScript and Java
by Casimir Saternos
Copyright © 2014 EzGraphs, LLC. 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://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or [email protected].
Editors: Simon St. Laurent and Allyson MacDonald Indexer: Judith McConville
Production Editor: Kristen Brown Cover Designer: Karen Montgomery
Copyeditor: Gillian McGarvey Interior Designer: David Futato
Proofreader: Amanda Kersey Illustrator: Rebecca Demarest

April 2014: First Edition

Revision History for the First Edition:


2014-03-27: First release

See http://oreilly.com/catalog/errata.csp?isbn=9781449369330 for release details.

Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Client-Server Web Apps with JavaScript and Java, the image of a large Indian civet, and related
trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark
claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.

ISBN: 978-1-449-36933-0
[LSI]
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

1. Change Begets Change. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


Web Users 2
Technology 3
Software Development 4
What Has Not Changed 5
The Nature of the Web 6
Server-Driven Web Development Considered Harmful 7
Why Client-Server Web Applications? 8
Code Organization/Software Architecture 8
Flexibility of Design/Use of Open Source APIs 8
Prototyping 9
Developer Productivity 9
Application Performance 9
Conclusion 11

2. JavaScript and JavaScript Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13


Learning JavaScript 14
JavaScript History 15
A Functional Language 16
Scope 17
First-Class Functions 18
Function Declarations and Expressions 20
Function Invocations 22
Function Arguments 22
Objects 23
JavaScript for Java Developers 23
HelloWorld.java 23

iii
HelloWorld.java (with Variables) 27
Development Best Practices 29
Coding Style and Conventions 29
Browsers for Development 29
Integrated Development Environments 30
Unit Testing 31
Documentation 31
Project 31

3. REST and JSON. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37


What Is REST? 38
Resources 38
Verbs (HTTP Request Methods) 38
Uniform Resource Identifiers 39
REST Constraints 40
Client–Server 41
Stateless 41
Cacheable 42
Uniform Interface 42
Layered 42
Code on Demand 43
HTTP Response Codes 43
What Is Success? 43
JSON (JavaScript Object Notation) 44
HATEOAS 46
REST and JSON 47
API Measures and Classification 48
Functional Programming and REST 49
Project 50
Other Web API Tools 54
Constraints Redux 54

4. Java Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Java Language 58
Java Virtual Machine (JVM) 58
Java Tools 60
Build Tools 61
Benefits of Maven 63
Functionality of Maven 64
Version Control 65
Unit Testing 65
JSON Java Libraries 66

iv | Table of Contents
Projects 66
Java with JSON 66
JVM Scripting Languages with JSON 69
Conclusion 72

5. Client-Side Frameworks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Overview 75
Starting Point One: Responsive Web Design 77
HTML5 Boilerplate 78
Bootstrap 79
Starting Point Two: JavaScript Libraries and Frameworks 79
Browser Compatibility 79
Frameworks 80
Functionality 80
Popularity 81
Obtaining Starter Projects 82
Download Directly from Repositories 82
Download from Starter Sites 82
IDE-Generated Starter Projects 83
The Rise of the Front-End Engineer 83
Client-Side Templating 84
Asset Pipelines 84
Development Workflow 85
Project 85
Conclusion 88

6. Java Web API Servers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89


Simpler Server-Side Solutions 90
Java-Based Servers 91
Java HTTP Server 92
Embedded Jetty Server 93
Restlet 95
Roo 96
Embedded Netty Server 100
Play Server 102
Other Lightweight Server Solutions 105
JVM-Based Servers 105
Jython 106
Web Application Servers 107
Development Usage 107

Table of Contents | v
Conclusion 107

7. Rapid Development Practices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109


Developer Productivity 109
Optimizing Developer and Team Workflow 112
Example: Web Application Fix 114
Example: Testing Integration 115
Example: Greenfield Development 116
Productivity and the Software Development Life Cycle 117
Management and Culture 117
Technical Architecture 118
Software Tools 119
Performance 120
Testing 120
Underlying Platform(s) 122
Conclusion 122

8. API Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123


A Decision to Design 124
Practical Web APIs Versus RESTful APIs 125
Guidelines 127
Nouns as Resources; Verbs as HTTP Actions 127
Query Parameters as Modifiers 128
Web API Versions 129
HTTP Headers 130
Linking 130
Responses 130
Documentation 130
Formatting Conventions 131
Security 131
Project 131
Running the Project 132
Server Code 132
Curl and jQuery 134
Theory in Practice 135

9. jQuery and Jython. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137


Server Side: Jython 138
Python Web Server 138
Jython Web Server 138
Mock APIs 139
Client Side: jQuery 140

vi | Table of Contents
DOM Traversal and Manipulation 141
Utility Functions 142
Effects 142
Event Handling 143
Ajax 143
jQuery and Higher-Level Abstractions 143
Project 144
Basic HTML 145
JavaScript and jQuery 145
Conclusion 147

10. JRuby and Angular. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149


Server Side: JRuby and Sinatra 150
Workflow 150
Interactive Ruby Shell 151
Ruby Version Manager (RVM) 151
Packages 152
Sinatra 153
JSON Processing 154
Client Side: AngularJS 155
Model 155
Views 156
Controllers 156
Services 156
Comparing jQuery and Angular 156
DOM Versus Model Manipulation 157
Unobtrusiveness of Angular 157
Project 158
Conclusion 165

11. Packaging and Deployment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167


Java and JEE Packaging 167
JEE Deployment 169
GUI Administration 171
Command-Line Administration 173
Non-JEE Deployment 174
Server Outside 175
Server Alongside 176
Server Inside 177
Implications of Deployment Choice 178
Load Balancing 178
Automating Application Deployment 180

Table of Contents | vii


Project 181
Client 181
Server 182
Conclusion 182

12. Virtualization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183


Full Virtualization 183
Virtual Machine Implementations 185
VMWare 185
VirtualBox 185
Amazon EC2 186
Management of Virtual Machines 186
Vagrant 186
Packer 186
DevOps Configuration Management 187
Containers 188
LXC 188
Docker 189
Project 190
Docker Help 191
Image and Container Maintenance 191
Java on Docker 192
Docker and Vagrant Networking 194
Conclusion 195

13. Testing and Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197


Types of Testing 198
Formal Versus Informal 198
Extent of Testing 198
Who Tests What for Whom? 199
Testing as an Indicator of Organizational Maturity 199
CMM to Assess Process Uniformity 200
Maven to Promote Uniform Processes 200
BDD to Promote Uniform Processes 202
Testing Frameworks 203
JUnit 204
Jasmine 205
Cucumber 205
Project 206
JUnit 207
Jasmine 207
Cucumber 209

viii | Table of Contents


Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
Maven Site Reports 209
Conclusion 210

14. Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211


Community 211
History 212
Coda 212

A. JRuby IRB and Java API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

B. RESTful Web API Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

C. References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

Table of Contents | ix
Preface

There are only two hard things in Computer


Science: cache invalidation and naming things.
—Phil Karlton
While cache invalidation is not a difficulty encountered when writing a book, choosing
a suitable title is. The title of this book is intended to represent a broad area of changes
in web development that have resulted in a new approach to designing web applications.
Of course, many aspects of web development can be considered new. Developers scram‐
ble to keep up with enhancements to desktop browsers, new mobile device clients,
evolving programming languages, the availability of faster processors, and an increas‐
ingly discerning audience of users with growing expectations about usability and in‐
teractivity. These changes require developers to continually innovate when coming up
with solutions for their specific projects. But many of these solutions have broader
implications and are not isolated to any particular project.
Therefore, I chose “client-server” as the term which in many ways captures the changes
to web development that have occurred in response to these innovations. Other de‐
scriptions of modern development practices currently in vogue don’t adequately rep‐
resent the problem domain. Web application development is associated with desktop
browsers, but excludes the increasingly relevant area of mobile applications.
The terms Single Page Application and Single Page Interface have been used to distin‐
guish modern web applications from earlier static websites. These terms correctly iden‐
tify modern sites as far more dynamic and interactive than their predecessors.
However, many modern dynamic applications are made up of multiple pages rather
than a single page. The focus in these terms is on the page, the client portion of an
application. They make no specific statement about corresponding server-side devel‐
opment. There are JavaScript frameworks that are also associated with highly dynamic
pages (such as Angular, Ember, and Backbone), but these are also concerned with the

xi
client tier. I wanted the title of this book to encompass more than front-end innovations
and to recognize the corresponding server-side design and web service messaging.
The method of communication captured by the popular acronym REST (Representa‐
tional State Transfer) does suggest the web service messaging style. But the definition
of REST as specified by its author Roy Fielding is very limiting. On his blog, Fielding
lists specific restrictions to REST that are commonly violated in so-called RESTful APIs.
And some even question whether a JSON API can be truly RESTful due to the fact that
it does not satisfy all of the constraints associated with the style of architecture. There
is a continuum by which REST services can be described; so that an API can be described
as RESTful only to the degree that it adheres to the constraints. REST does include client-
server as one of its constraints, and the verb and URL naming conventions are certainly
applicable.
So a JavaScript client consuming messages from a pragmatic “RESTful” API is a signif‐
icant part of the method of development. What about the server component?
Java Enterprise Edition (JEE) includes the JAX-RS API, which uses Java’s flavor of REST
(which is not inherently strict) and is demonstrable using the Jersey reference imple‐
mentation. But limiting to JAX-RS web application development ignores frameworks
and alternate JVM language solutions that are available and particularly appealing for
quick prototypes.
And so crystallizing the intentions of a book in a simple, catchy title is not an easy task.
Fortunately, James Ward did a presentation at OSCON 2012 in which he described the
development of “Client-Server Web Applications with HTML5 and Java.” He listed the
benefits of a method of web application development that is increasingly popular, a
method that I have been involved with in recent years on various projects. And the
phrase “client-server” is the key to understanding what this method is. It captures the
fundamental architectural changes that include aspects of the terms listed above, but
represents the distinct partitioning between the client and server and considers each of
the roles significant.
A client-server architecture of web applications requires a shift (in some cases seismic)
in the way programmers work. This book was written to enable developers to deal with
this revolution. Specifically, it is intended to provide a proper perspective in building
the latest incarnation of modern web applications.

Who Is This Book For?


This book is written for web application developers who are are familiar with the Java
programming language, as well as HTML, JavaScript, and CSS. It is geared toward those
who “learn by doing” and prefer to see and create specific examples of new technologies
and techniques integrated with standard tools. If you want a better understanding of

xii | Preface
recent developments in JavaScript and how the language and its development process
compare with those of Java, this book is for you.
A bit of a balancing act is evident as you read this book. On the one hand, the most
important thing you can take away is a sense of the “big picture”—the influences and
trends causing a shift in the technologies in use. On the other hand, technologies are
often best understood by seeing specific examples. If you are interested in an overview
of how these technologies actually fit together, you will benefit from this book.
My goal in writing this is to help you to make informed decisions. Good decisions result
in the right technologies being used on new projects. They allow you to avoid pitfalls
caused by mixing incompatible technologies or having the wrong expectations about
the implications of a given decision. They help you to step into projects in process and
better support existing code. In short, informed decisions will make you a more pro‐
ductive programmer. They help you make effective use of your time in researching areas
of specific interest in your work now and in the future.

How This Book Is Organized


Chapter 1 provides a general overview of the client-server web application architecture.
It discusses the history of web development and provides a justification for the paradigm
shift in development. This leads into the next three chapters that will describe the tools
used in the development process.
Chapter 2 describes JavaScript and the tools used in JavaScript development.
Chapter 3 introduces web API design, REST, and the tools used when developing
RESTful applications over HTTP.
Chapter 4 pertains to Java and other software that’s used in the remainder of this book.
The next section of the book discusses higher-level constructs (such as client libraries
and application servers) and how these provide separation and allow for rapid devel‐
opment.
Chapter 5 describes major client-side JavaScript frameworks.
Chapter 6 addresses Java API servers and services.
Chapter 7 discusses rapid development practices.
Chapter 8 delves into API design in greater depth.
With an understanding of libraries and a process for speedy development of prototypes,
the next several chapters apply these to specific projects using various JVM languages
and frameworks. The next two chapters use lightweight web servers and microframe‐
works instead of traditional Java web application packaging and servers.
Chapter 9 provides an overview of a project using jQuery and Jython.

Preface | xiii
Chapter 10 documents the development of a project using JRuby and Angular.
The final chapters detail projects using traditional Java web application servers and
libraries.
Chapter 11 looks at the range of packaging and deployment options available in the Java
ecosystem.
Chapter 12 explores virtualization and innovations emerging from the management of
large server environments.
Chapter 13 draws attention to testing and documentation.
Chapter 14 wraps up with some final thoughts on responding to the tumultuous changes
to Internet-related technologies and software development.
Appendix A describes how to explore and manipulate Java classes interactively.

Conventions Used in This Book


The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to variables, method
names, and other code elements, as well as the contents of files.
Constant width bold
Highlights new code in an example.
Constant width italic
Shows text that should be replaced with user-supplied values.

This element signifies a tip, suggestion, or general note.

This element indicates a warning or caution.

xiv | Preface
Code Examples
Projects and code examples in this book are hosted on https://github.com/java-
javascript/client-server-web-apps. You can view them online or download a .zip file for
local use. The assets are organized by chapter.
The code examples provided in this book are geared toward illustrating specific func‐
tionality rather than addressing all concerns of a fully functional application. Differ‐
ences include:

• Production systems include greater refinement of selected data types, validation


rules, exception handing routines, and logging mechanisms.
• Most production systems will include one or more backend datastores. To limit the
scope of discussion, databases are not accessed in most of the examples.
• The modern web application includes a large amount of infrastructure geared to‐
ward mobile device access and browser compatibility. Again, unless these are the
specific topic of discussion, responsive design is eschewed for a more minimal
design.
• The practice of some degree of unobtrusive JavaScript to separate CSS and Java‐
Script from HTML is a generally accepted best practice. In the examples in this
book, they are frequently commingled because all aspects of a given application can
be immediately apprised by viewing a single file.
• Unit tests and testing examples are only included when they are directly related to
the topic under discussion. Production systems would include far greater test cov‐
erage and extensive testing in general.

That said, this book is intended to help you get your job done. In general, you may use
the code in this book in your programs and documentation. You do not need to contact
us for permission unless you are reproducing a significant portion of the code. For
example, writing a program that uses several sections of code from this book does not
require permission. Selling or distributing a CD-ROM of 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 do not require, attribution. An attribution usually includes the
title, author, publisher, and ISBN. For example: “Client-Server Web Apps with JavaScript
and Java” by Casimir Saternos (O’Reilly). Copyright 2014 EzGraphs, LLC.,
978-1-449-36933-0.”
If you feel your use of code examples falls outside fair use or the permission given here,
feel free to contact us at [email protected].

Preface | xv
Long Command Formats
Code displayed inline will be adjusted to be readable in this context. One convention
used is that of backslashes to allow newlines in operating system commands. So for
instance, the following commands are equivalent and would execute the same way in a
bash session. (Bash is a standard operating system shell that you see when accessing a
Linux server or Mac OS X at the command line.)
ls -l *someVeryLongName*
...
ls -l \
*someVeryLongName*
The same convention also appears in other settings where OS commands are used, such
as Dockerfiles.
Similarly, JSON strings, being valid JavaScript, can be broken up to fit on multiple lines:
o={"name": "really long string here and includes many words"}

// The following, as expected, evaluates to true.


JSON.stringify(o)=='{"name":"really long string here and includes many words"}'

// The same string broken into multiple lines is equivalent.


// So the following statement also evaluates to true.
JSON.stringify(o)=='{"name":' +
'"some really long ' +
'JSON string is here' +
' and includes many, many words"}'

Safari® Books Online


Safari Books Online is an on-demand digital library that
delivers expert content in both book and video form from
the world’s leading authors in technology and business.
Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research, prob‐
lem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organi‐
zations, government agencies, and individuals. Subscribers have access to thousands of
books, training videos, and prepublication manuscripts in one fully searchable database
from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Pro‐
fessional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John
Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT
Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technol‐
ogy, and dozens more. For more information about Safari Books Online, please visit us
online.

xvi | Preface
How to Contact Us
Every example in this book has been tested, but occasionally you may encounter prob‐
lems. Mistakes and oversights can occur and we will gratefully receive details of any that
you find, as well as any suggestions you would like to make for future editions. 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 http://oreil.ly/client-server-web-apps-js.
To comment or ask technical questions about this book, send email to bookques
[email protected].
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

Acknowledgments
Thank you to the following people:

• Meg, Ally, Simon, and the gang at O’Reilly for the opportunity to write this book.
• My brother Neal Saternos and Dr. James Femister for the early suggestions from
days gone by that I might be able to do the “programming thing.”
• Michael Bellomo, Don Deasey, and Scott Miller for their time and expertise as
technical reviewers.
• Charles Leo Saternos for taking a break from Lua game development to do some
fine image and design work.
• Caleb Lewis Saternos for inspiration in perserverence (early morning run anyone?)
and editorial work.
• David Amidon for the first opportunity to work as a software developer and Doug
Pelletier for first the opportunity to develop Java web apps.

Preface | xvii
• All the folks that headed up the projects that inspired this book, including managers
Wayne Hefner, Tony Powell, Dave Berry, Jay Colson, and Pat Doran, and chief
software architects Eric Fedok and Michael Bellomo.
• Geoffrey Grosenbach from PluralSight, Nat Dunn from Webucator, Caroline Kvit‐
ka (and others from Oracle and Java Magazine) for technical writing opportunities
over the past several years that led to the current one.
• My parents Leo and Clara Saternos for bringing me up in a loving household that
included a Radio Shack Color Computer when having a PC at home was still a
novelty and my sister Lori for reminders of important things that have nothing to
do with programming.

My love and thanks to my wonderful wife Christina and children Clara Jean, Charles
Leo, Caleb Lewis, and Charlotte Olivia for the consistent love, support, patience, and
inspiration while this project was underway.
Finally, J.S. Bach serves as a creative inspiration on many levels. Not the least of which
is the dedication that would appear at the beginning of his works—and so I say with
him, Soli Deo Gloria.

xviii | Preface
Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
CHAPTER 1
Change Begets Change

The entrepreneur always searches for a change,


responds to it, and exploits it as an opportunity.
—Peter Drucker
What kinds of changes encourage developers to adopt a client-server approach? Shifts
in user behavior, technology, and software development process are the significant
forces that have driven developers to change their patterns of design. Each of these
factors, in a unique and significant way, makes established patterns obsolete. Together
they have encouraged related innovations and a convergence in practice despite the
absence of enforcement or mandated standardization.
Web users have changed. In the early days of the Web, users were satisfied with static
pages and primitive user interfaces. The modern web user has come to expect a high-
performance, interactive, well-designed, dynamic experience. These higher expecta‐
tions were met with an explosion in new technologies and expansion of web browser
capabilities. Today’s web developer needs to use tools and a development approach that
are aligned with the modern web scene.
Technology has changed. Browsers and JavaScript engines are faster. Workstations and
laptops are far more powerful, to say nothing of the plethora of mobile devices now
being used to surf the Web. Web service APIs are the expectation for a modern web
application rather than a rare additional feature. Cloud computing is revolutionizing
the deployment and operation of web applications.

1
Software development has changed. The now popular “Agile Manifesto” values:

• Individuals and interactions over processes and tools


• Working software over comprehensive documentation
• Customer collaboration over contract negotiation
• Responding to change over following a plan

It is now possible to quickly spin up web applications that prove—at least on a small
scale—the viability of a given technology. There is tremendous value to prototyping. As
Fred Brooks, author of The Mythical Man Month (Addison-Wesley Professional), fa‐
mously stated: “Plan to throw one away; you will, anyhow.” A prototype can allow for
early customer or end user interaction that helps solidify requirements early in the
process. It is no longer an insurmountable task to write a functional web application in
a matter of minutes.

Web Users
Modern web application users have well-defined expectations about how they will be
able to interact with a web application:

• Web applications will be available across multiple platforms.


• They will provide a consistent experience across devices.
• They will respond with little or no latency.

The Gartner group claims that in 2014, the personal cloud will replace the PC at the
center of users’ digital lives. There are many implications for web app development.
Users are more technologically savvy and have high expectations for site responsiveness.
They are less passive than in previous years and instead are interactive and engaged.
Websites need to be designed in a way that suggests no limitations in the ability of a
browser to mimic native application experience.
Users expect an application to be exposed in various ways and available in different
situations. Responsive design and support for multiple browsers, platforms, and devices
are the new norm. The use of JavaScript libraries and frameworks is essential to support
the wide variety of target clients.
The New York Times recently reported on the impatience of web users. Among its
findings: a company’s website will be visited less often than that of a close competitor if
it is slower by more than 250 milliseconds. Performance needs to be a key consideration
in web application development.

2 | Chapter 1: Change Begets Change


Technology
Java web application developers are typically familiar with server-side dynamic content.
J2EE and JSP have been refined into JEE and JSF. Projects such as Spring provide ad‐
ditional capabilities geared toward server-side development. This mode of development
made a great deal of sense in the early days of the Web, when web pages were relatively
static, servers were relatively fast, JavaScript engines were slow, and there were few
libraries and techniques to address browser incompatibilities.
By way of contrast, a modern client-server approach involves a server largely responsible
for providing access to resources (typically communicated as messages in XML or
JSON) in response to client requests. In the old server-driven approach, the browser
requested an entire page and it was generated (along with relevant data) for rendering
in the browser. In the client-server approach, the server initially serves pages with little
data. The pages make asynchronous requests to the server as the user interacts with it
and the server simply responds to these events with messages that cause the current
page to be updated.
Initial web development efforts consisted of the creation of static HTML sites. Later,
these sites were augmented with dynamic content using server-side processing (CGI,
Java Servlets). Subsequently, more structured language integration emerged using
server-side templating (ASP, PHP, JSP) and MVC frameworks. More recent technologies
continue in the same tradition and provide additional abstractions of one sort or
another.
Based upon a desire to shield developers from design concerns and the underlying
architecture of the Web, component-based frameworks have emerged. Tag libraries were
an early innovation, and now a component-based approach has been widely adopted
in several popular frameworks:

• Java Server Faces (JSF), an XML-based templating system and component frame‐
work with centralized configurable navigation.
• The Google Web Toolkit is another component framework that leverages the abil‐
ities of Java programmers by letting them focus on Java coding with little need to
directly modify HTML, CSS, or JavaScript.

Each of these frameworks has its place and has been used successfully in production
systems. But like many solutions that try to hide underlying complexities, their usage
is problematic in situations where you need greater control (such as the ability to inte‐
grate large amounts of JavaScript) or you do not conform to the framework assumptions
(for instance, availability of server sessions). This is because these solutions attempt to
hide the fundamental architecture of the Web, which uses an HTTP request-response
protocol following the client-server computing model.

Technology | 3
Browser innovations also led to a shift of responsibility from the server to the client. In
the late 1990s, Microsoft developed the underlying technologies that led to Ajax (a term
coined on February 18, 2005 by Jesse James Garrett). Ajax is an acronym for “asyn‐
chronous JavaScript and XML,” but is more generally applied to various technologies
used to communicate with the server within the context of a given web page. This
allowed small messages to be sent, which made better use of bandwidth when designing
JavaScript-based web applications. Browser performance has increased significantly due
to processor improvements and optimizations to JavaScript engines, so it has made
sense to offload more work from the server to the browser. User interface responsiveness
has evolved to a new level of sophistication.
Mobile device browsers have also provided an additional incentive to further isolate
client-side code from the server. In some cases, a well-designed application leveraging
responsive design principles can be created. If this is not an option, a single consistent
API available for all device clients is very appealing.
Roy Fielding’s doctoral dissertation in 2000 led Java EE 6 to new APIs that deviated from
the previous component-based trajectory. JAX-RS (Java API for RESTful Web Services)
and Jersey (a “production quality reference implementation”) are designed to create
applications reflecting a client-server architecture with RESTful communications.

Software Development
In the past, setting up a new Java project was a rather monumental task. A vast array of
configuration options made it tedious and error-prone. Very little was automated, as
the assumption was that each project would have unique characteristics that developers
would want to account for to meet their specific requirements.
Later influences led to innovations that made setting up a project much simpler. “Con‐
vention over configuration” was an influential mantra of the Ruby on Rails community.
Maven and other Java projects also chose sensible defaults and target easy setup for a
subset of popular use cases.
The availability of scripting languages on the JVM makes it possible to speed develop‐
ment by bypassing the somewhat rigorous type checking of Java. Languages like Groovy,
Python (Jython), and Ruby are loosely typed and constructed in a manner that requires
less code to accomplish equivalent functionality. So-called microframeworks like Sina‐
tra or Play provide minimal Domain Specific Languages (DSLs) to quickly write web
applications and services. And so today, it is a trivial task to set up a minimal set of web
services in a development environment.
The failure of enough large-scale waterfall-style software projects has also made it clear
that there are many advantages to producing a small-scale version of the final product.
A prototype (or prototypes) of the final product can serve many purposes:

4 | Chapter 1: Change Begets Change


• Verify technical foundation of the project
• Create constructs that bridge disparate technologies to be used together
• Allow end user interaction to clarify intended usage and user interface design
• Allow system designers to clarify the interfaces and data structures to be passed
between systems
• Allow programmers to work on different parts of the application in parallel

Prototypes have numerous benefits:

• They are a specific, tangible asset representing the final system to be designed. As
such, they incorporate information that is otherwise stored in design documents,
diagrams, and other artifacts (and frequently in more informal locations like email
and people’s memories of water-cooler conversations).
• Prototypes are concrete implementations. As such, they present the requirements
in a much more tangible form. This can lead to a better understanding of the extent
and quality of the requirements gathered, and can suggest areas where there is need
of clarification.
• Prototypes can immediately expose potential points of failure that are not apparent
before attempting a specific implementation.
• The preceding benefits can lead to better estimates and scheduling due to a more
comprehensive understanding of what is intended.

Prototyping can be leveraged extensively in client-server web application development


because of the clear and unambiguous separation between the client and server. Pro‐
totypes of the server can be provided to the client developers (and vice versa) while
development proceeds in parallel. Or if development is not proceeding in parallel,
server-side calls can be quickly stubbed out so that client-side code can be developed.

What Has Not Changed


The fundamental nature of the Web (a client-server architecture transmitted over
HTTP) has not changed.
New technology does not change everything. High-level programming languages have
not removed the need to understand operating system specifics. Object-relational map‐
ping frameworks have not removed the need to understand relational databases and
SQL. In like manner, there have been consistent attempts to ignore the underlying ar‐
chitecture of the Web in an effort to emulate the experience of desktop applications.

What Has Not Changed | 5


Medium Specificity
Medium specificity is a term that appears in aesthetics and modern art criticism but
which can be applied to technology as well. It indicates the “appropriateness” of a given
artistic subject to be presented by a given medium. The idea has been around for cen‐
turies. Gotthold Ephraim Lessing states in his Lacoon:
[B]odies, with their visible properties, are the legitimate subjects of painting. [A]ctions
are [therefore] the legitimate subjects of poetry.
— The Limits of Poetry and Painting
Its application in modern art is usually to challenge traditional limits that appeared in
the arts. Technology is a creative activity, but our primary concern is working systems,
not abstract beauty. The idea of medium specificity is important in that, if you ignore
the underlying nature of a platform, the resulting system will never perform in an optimal
manner or will not work at all. This has become painfully obvious in many areas of
technology. The goal of this book is to promote web application design strategies that
are aligned with the way the Web itself is designed. Such applications operate well be‐
cause they work within the Web’s fundamental constraints rather than ignoring them.

The Nature of the Web


The essence of the Web has not changed. It is still made up of servers that serve HTML
documents to clients via the HTTP protocol. See Figure 1-1.

Figure 1-1. HTTP request and response

A client-server web architecture more closely maps to the underlying architecture of


the Web itself. Although not technically protocol-specific, REST was developed based
upon and in conjunction with HTTP. REST essentially defines constraints on the usage
of HTTP. It seeks to describe a well-designed web application: a reliable application that
performs well, scales, has a simple elegant design, and can be easily modified
(Figure 1-2).

6 | Chapter 1: Change Begets Change


Figure 1-2. REST request and response

In fact, to more accurately emphasize the challenges in the modern web environment,
we need to consider multiple devices and cloud deployments. See Figure 1-3.

Figure 1-3. Multiple devices and cloud deployments

The specific area of “medium specificity” that has been ignored in web development in
general (and in component frameworks in particular) is the stateless, client-server na‐
ture of the Web itself.

Server-Driven Web Development Considered Harmful


Just because a given feature is available does not mean that it should be used. In many
cases, a server-driven, component-based approach to web development should be re‐
placed with a client-server one. Server-driven approaches obscure the nature of the Web
itself, which is a client-server technology built on the HTTP protocol. Ignoring or ob‐
scuring the fundamental underlying architecture of the Web makes development, de‐
bugging, and support of software systems more difficult. The intention, to make the
Web somehow simpler or easier to understand, breaks down rather quickly in any non‐
trivial system where there needs to be a clear understanding what functionality is avail‐
able and how the system actually works.

What Has Not Changed | 7


Considered Harmful
In 1968, Edsger W. Dijkstra published a letter entitled “Go To Statement Considered
Harmful.” Besides being of interest because it made a considerable impact on reducing
the use of the goto statement in structured programming, it introduced the phrase
“considered harmful” into hacker culture. Tom Christiansen argued against program‐
ming in csh. Douglas Crawford published a blog post entitled “with Statement Consid‐
ered Harmful”. The phrase has appeared in many other settings as well, and despite the
amusingly self-referential “‘Considered Harmful’ Essays Considered Harmful” by Eric
A. Meyer, the phrase continues to appear.
Although “Considered Harmful” attention articles are not always of equal merit, the
theme arises out of a valid recognition that just because a language feature or technical
solution is available, does not mean it is a great general purpose, long-term solution.

Why Client-Server Web Applications?


There are a number of advantages to a client-server approach to web development.

Code Organization/Software Architecture


There are clear advantages to being able to decouple logical sections of code and promote
higher cohesion both in the original construction and ongoing support of any system.
The clear separation between client and server tiers makes for manageable, modular
sections of code. In addition, data and display markup can be more clearly separated.
The data can be delivered in JSON rather than inline. This is consistent with the modern
JavaScript notion of unobtrusive JavaScript where a page’s behavior, structure, and pre‐
sentation are separated.
Flexibility and code reuse are a logical outcome of good code organization. There is
flexibility at many stages in the application life cycle when sections of code can be de‐
veloped in relative isolation (APIs can be exposed, mobile device clients created, new
versions of sections of the application tested and released independently). Code reuse
is more likely when there are clear components. At minimum, the same RESTful APIs
can be used to serve data to a wide variety of browsers and mobile devices.
Component approaches tend to introduce brittle coupling and are less adaptable. There
is no way to plug in a different frontend easily.

Flexibility of Design/Use of Open Source APIs


Component-based approaches include tightly integrated server-side code that requires
specific JavaScript technology. They also generate HTML and CSS that limits the options

8 | Chapter 1: Change Begets Change


available from a design and behavior perspective. A distinct client running JavaScript
can take advantage of the latest libraries that ease browser compatibility, standardize
DOM manipulation, and provide complex widgets.

Prototyping
Prototyping works well with client-server web applications due to the clear separation
between tiers. As previously mentioned, prototypes can test and verify initial ideals.
They help clarify vague notions and facilitate clear communication regarding require‐
ments. They can inspire and generate new ideas as people interact with something more
concrete than a long text description or a series of pictures. Bad ideas and inconsistencies
can be quickly recognized and eliminated. Used correctly, prototypes can save time,
money, and resources and result in a better final product.

Developer Productivity
Besides the ability to prototype either the client portion or the server component (or
both), work can be split clearly, and development can progress in parallel. The separation
allows sections of code to be built in isolation. This prevents the problem in component
approaches where a server build is required every time a page is changed during de‐
velopment. Development tasks require less time and effort, changes are less complex,
and troubleshooting is simplified.
This is especially evident when a need arises to replace, upgrade, or relocate server-side
code. Such changes can be done independently, without affecting the client. The only
limitation is that the original interface, specifically the URL and message data structure,
must remain available.

Application Performance
User experience is greatly impacted by the perceived performance of a page in the
browser. Faster JavaScript engines allow the client to perform computationally intensive
operations so server workload can be effectively offloaded to the client. Ajax requires
relatively small amounts of data to be retrieved when needed so full page reloads can
occur infrequently and less data is sent in the intervening requests. Users perceive a
snappier, more immediate response as they interact with an application.
There are many benefits to stateless design that ease the lives of developers and support
staff. Resources dedicated to session management can be freed up. This simplifies load-
balancing and configuration that would otherwise be required. Servers can be easily
added to accommodate increased load allowing for horizontal scalability. This replaces
the unwieldy process of hardware upgrades traditionally used to increase throughput
and performance.

Why Client-Server Web Applications? | 9


Random documents with unrelated
content Scribd suggests to you:
otherwise. She had had a reconciliation with her old antagonists the
Pankhurst section of the suffragettes, and she had paid twenty
annual subscriptions to their loyal and outspoken publication
Britannia, directing twelve copies to be sent to suitable recipients—
Oswald was one of the favoured ones—and herself receiving and
blue-pencilling the remaining eight before despatching them to such
public characters as she believed would be most beneficially cowed
or instructed by the articles she had marked. She also subscribed
liberally to the British Empire Union, an organization so patriotic
that it extended its hostility to Russians, Americans, Irishmen,
neutrals, President Wilson, the League of Nations, and similar
infringements of the importance and dignity of Lady Charlotte and
her kind. She remained at Chastlands, where she had laid in an
ample store of provisions quite early in the war—two sacks of mouldy
flour and a side of bacon in an advanced state of decomposition had
been buried at night by Cashel—all through the Zeppelin raids; and
she played a prominent rather than a pacifying part in the Red Cross
politics of that part of Surrey. She induced several rich Jewesses of
Swiss, Dutch, German or Austrian origin to relieve the movement of
their names and, what was still better, of the frequently quite
offensively large subscriptions with which they overshadowed those
who had the right to lead in such matters. She lectured also in the
National Economy campaign on several occasions—for like most
thoughtful women of her class and type, she was deeply shocked by
the stories she had heard of extravagance among our over-paid
munition workers. After a time the extraordinary meanness of the
authorities in restricting her petrol obliged her in self-respect to
throw up this branch of her public work. She was in London during
one of the early Gotha raids, but she conceived such a disgust at the
cowardice of the lower classes on this occasion that she left town the
next day and would not return thither.
The increasing scarcity of petrol and the onset of food rationing,
which threatened to spread all over England, drove her to Ulster—in
spite of the submarine danger that might have deterred a less stout-
hearted woman. She took a small furnished house in a congenial
district, and found herself one of a little circle of ultra-patriotic
refugees, driven like herself from England by un-English restrictions
upon the nourishment of the upper classes and the spread of the
pacifist tendencies of Lord Lansdowne. “If the cowards must make
peace,” said Lady Charlotte, “at least give me leave to be out of it.”
Considering everything, Ulster was at that time as comfortably and
honourably out of the war as any part of the world, and all that
seemed needed to keep it safely out to the end was a little tactful
firmness in the Dublin Convention. There was plenty of everything in
the loyal province at that time—men, meat, butter, Dublin stout, and
self-righteousness; and Lady Charlotte expanded again like a flower
in the sun. She reverted to driving in a carriage; it was nice to sit
once more behind a stout able-bodied coachman with a cockade,
with a perfect excuse for neutrality, and she still did her best for old
England from eleven to one and often from five to six by writing
letters and dabbling in organization. Oswald she kept in mind
continually. Almost daily he would get newspaper cuttings from her
detailing Sinn Fein outrages, or blue-marked leading articles
agitating for a larger share of the munition industries for Belfast, or
good hot stuff, deeply underlined, from the speeches of Sir Edward
Carson. One dastardly Sinn Feiner, Oswald learnt, had even starved
himself to death in gaol, a most unnatural offence to Lady Charlotte.
She warmed up tremendously over the insidious attempts of the
Prime Minister and a section of the press to get all the armies in
France and Italy under one supreme generalissimo and end the
dislocated muddling that had so long prolonged the war. It was a
change that might have involved the replacement of regular generals
by competent ones, and it imperilled everything that was most dear
to the old lady’s heart. It was “an insult to the King’s uniform,” she
wrote. “A revolution. I knew that this sort of thing would begin if we
let those Americans come in. We ought not to have let them come in.
What good are they to us? What can they know of war? A crowd of
ignorant republican renegades! British generals to be criticized and
their prospects injured by French Roman Catholics and Atheists
and chewing, expectorating Yankees and every sort of low
foreigner. What is the world coming to? Sir Douglas Haig has been
exactly where he is for two years. Surely he knows the ground
better than any one else can possibly do.”
Once the theme of Lady Charlotte got loose in Oswald’s poor old
brain, it began a special worry of its own. He found his mind
struggling with assertions and arguments. As this involved trying to
remember exactly what she had said in this letter of hers, and as it
was in his pocket, he presently chose the lesser of two evils and took
it out to read over:—
“I suppose you have read in the papers what is happening in
Clare. The people are ploughing up grass-land. It is as bad as that
man Prothero. They raid gentlemen’s houses to seize arms; they
resist the police. That man Devil-era—so I must call him—speaks
openly of a republic. Devil-era and Devil-in; is it a coincidence
merely? All this comes of our ill-timed leniency after the Dublin
rebellion. When will England learn the lesson Cromwell taught her?
He was a wicked man, he made one great mistake for which he is no
doubt answering to his Maker throughout all eternity, but he
certainly did know how to manage these Irish. If he could come
back now he would be on our side. He would have had his lesson.
Your Bolshevik friends go on murdering and cutting throats, I see,
like true Republicans. Happily the White Guards seem getting the
upper hand in Finland. In the end I suppose we shall be driven to a
peace with the Huns as the worst of two evils. If we do, it will only
be your Bolsheviks and pacifists and strikers and Bolos who will be
to blame.
“The whining and cowardice of the East Enders disgusts me more
and more. You read, I suppose, the account of the disgraceful panic
during the air raid the other day in the East End, due entirely to
foreigners of military age, mostly, no doubt, your Russian
Bolsheviks. I am well away from such a rabble. I suffer from
rheumatism here. I know it is rheumatism; what you say about
gout is nonsense. In spite of its loyalty Ulster is damp. I pine more
and more for the sun and warmth of Italy. Unwin must needs make
herself very tiresome and peevish nowadays. These are not cheerful
times for me. But one must do one’s bit for one’s country, I suppose,
unworthy though it be.
“So Mr. Peter is back in England again wounded after his flying
about in the air. I suppose he is tasting the delights of matrimony,
such as they are! What an affair! Something told me long ago that it
would happen. I tried to separate them. My instincts warned me,
and my instincts were right. Breed is breed, and the servant strain
came out in her. You can’t say I didn’t warn you. Why you let them
marry I cannot imagine!!! I am sure the young lady could have
dispensed with that ceremony!!!! I still think at times of that queer
scene I passed on the road when I came to Pelham Ford that
Christmas. A second string,—no doubt of it. But Peter was her great
chance, of course, thanks to your folly. Well, let us hope that in the
modern way they won’t have any children, for nothing is more
certain than that these inter-breeding marriages are most harmful,
and whether we like it or not you have to remember they are first
cousins, if not in the sight of the law at any rate in the sight of God,
which is what matters in this respect. Mr. Grimes, who has studied
these things in his leisure time, tells me that there is a very great
probability indeed that any child will be blind or malformed or
consumptive, let us hope the latter, if not actually still-born, which,
of course, would be the best thing that could possibly happen....”
§5
At this point Oswald became aware of Joan coming out of the
house towards him.
He looked at his watch. “Much too early yet, Joan,” he said.
“Yes, but I want to be meeting him,” said Mrs. Joan....
So they walked down to the station and waited for a long time on
the platform. And Joan said very little to Oswald because she was
musing pleasantly.
When the train came in neither Joan nor Peter took much notice of
Oswald after the first greeting. I do not see what else he could have
expected; they were deeply in love and they had been apart for a
couple of weeks, they were excited by each other and engrossed in
each other. Oswald walked beside them up the road—apart. “I’ve got
some work,” he said abruptly in the hall. “See you at lunch,” and
went into his study and shut the door upon them, absurdly
disappointed.
§6
Peter came on Wednesday. It was not until Friday that Oswald
found an opportunity to deliver his valediction. But he had rehearsed
it, or rather he had been rehearsing experimental fragments of it for
most of the night before. On Thursday night the cloudy malaise of his
mind broke and cleared. Things fell into their proper places in his
thoughts, and he could feel that his ideas were no longer distorted
and confused. The valediction appeared, an ordered discourse. If
only he could hold out through a long talk he felt he would be able to
make himself plain to them....
He lay in the darkness putting together phrase after phrase,
sentence after sentence, developing a long and elaborate argument,
dipping down into parentheses, throwing off footnotes, resuming his
text. For the most part Joan and Peter remained silent hearers of this
discourse; now his ratiocination glowed so brightly that they were
almost forgotten, now they came into the discussion, they assisted,
they said helpful and understanding things, they raised simple and
obvious objections that were beautifully overcome.
“What is education up to?” he would begin. “What is education?”
Then came a sentence that he repeated in the stillness of his mind
quite a number of times. “Consider this beast we are, this thing
man!” He did not reckon with Peter’s tendency to prompt replies.
He would begin in the broadest, most elementary way. “Consider
this beast we are, this thing man!” so he framed his opening: “a
creature restlessly experimental, mischievous and destructive, as
sexual as a monkey, and with no really strong social instincts, no
such tolerance of his fellows as a deer has, no such instinctive self-
devotion as you find in a bee or an ant. A solitary animal, a selfish
animal. And yet this creature has now made for itself such conditions
that it must be social. Must be. Or destroy itself. Continually it
invents fresh means by which man may get at man to injure him or
help him. That is one view of the creature, Peter, from your biological
end.” Here Peter was to nod, and remain attentively awaiting the
next development. “And at the same time, there grows upon us all a
sense of a common being and a common interest. Biologically
separate, we unify spiritually. More and more do men feel, ’I am not
for myself! There is something in me—that belongs to a greater being
than myself—of which I am a part.’... I won’t philosophize. I won’t
say which may be in the nature of cause and which of effect here. You
can put what I have said in a dozen different ways. We may say, ’The
individual must live in the species and find his happiness there’—that
is—Biologese. Our language, Peter. Or we can quote, ’I am the True
Vine and ye are the Branches.’” Oswald’s mind rested on that for a
time. “That is not our language, Peter, but it is the same idea.
Essentially it is the same idea. Or we can talk of the ’One and the
Many.’ We can say we all live in the mercy of Allah, or if you are a
liberal Jew that we are all a part of Israel. It seems to me that all
these formulæ are so much spluttering and variation over one idea.
Doesn’t it to you? Men can quarrel mortally even upon the question
of how they shall say ’Brotherhood.’...” Here for a time Oswald’s
mind paused.
He embarked upon a great and wonderful parenthesis upon
religious intolerance in which at last he lost himself completely.
“I don’t see that men need fall out about religion,” was his main
proposition.
“There was a time when I was against all religions. I denounced
priestcraft and superstition and so on.... That is past. That is past. I
want peace in the world.... Men’s minds differ more about initial
things than they do about final things. Some men think in images,
others in words and abstract ideas—but yet the two sorts can think
out the same practical conclusions. A lot of these chapels and
churches only mean a difference in language.... Difference in
dialect.... Often they don’t mean the same things, those religious
people, by the same words, but often contrariwise they mean the
same things by quite different words. The deaf man says the dawn is
bright and red, and the blind man says it is a sound of birds. It is the
same dawn. The same dawn.... One man says ’God’ and thinks of a
person who is as much of a person as Joan is, and another says ’God’
and thinks of an idea more abstract than the square root of minus
one. That’s a tangle in the primaries of thought and not a difference
in practical intention. One can argue about such things for ever....
One can make a puzzle with a bit of wire that will bother and
exasperate people for hours. Is it any wonder, then, if stating what is
at the root of life bothers and exasperates people?...
“Personally, I should say now that all religions are right, and none
of them very happy in the words and symbols they choose. And none
of them are calm enough—not calm enough. Not peaceful enough.
They are all floundering about with symbols and metaphors, and it is
a pity they will not admit it.... Why will people never admit their
intellectual limitations in these matters?... All the great religions
have this in common, this idea in common; they profess to teach the
universal brotherhood of man and the universal reign of justice. Why
argue about phrases? Why not put it in this fashion?”...
For a long time Oswald argued about phrases before he could get
back to the main thread of his argument....
“Men have to be unified. They are driven to seek Unity. And they
are still with the individualized instincts of a savage.... See then what
education always has to be! The process of taking this imperfectly
social, jealous, deeply savage creature and socializing him. The
development of education and the development of human societies
are one and the same thing. Education makes the social man. So far
as schooling goes, it is quite plainly that. You teach your solitary
beast to read and write, you teach him to express himself by drawing,
you teach him other languages perhaps, and something of history
and the distribution of mankind. What is it all but making this
creature who would naturally possess only the fierce, narrow
sociability of a savage family in a cave, into a citizen in a greater
community? That is how I see it. That primarily is what has been
done to you. An uneducated man is a man who can talk to a few score
familiar people with a few hundred words. You two can talk to a
quarter of mankind. With the help of a little translation you can get
to understandings with most of mankind.... As a child learns the
accepted language and the accepted writing and the laws and rules of
life it learns the community. Watching the education of you two has
made me believe more and more in the idea that, over and above the
enlargement of expression and understanding, education is the state
explaining itself to and incorporating the will of the individual....
“Yes—but what state? What state? Now we come to it....”
Oswald began to sketch out a universal history. There is no limit to
these intellectual enterprises of the small hours.
“All history is the record of an effort in man to form communities,
an effort against resistance—against instinctive resistance. There
seems no natural and proper limit to a human community. (That’s
my great point, that. That is what I have to tell them.) That is the
final teaching of History, Joan and Peter; the very quintessence of
History; that limitlessness of the community. As soon as men get a
community of any size organized, it begins forthwith to develop
roads, wheels, writing, ship-building, and all manner of things which
presently set a fresh growth growing again. Let that, too, go on.
Presently comes steam, mechanical traction, telegraphy, the
telephone, wireless, aeroplanes; and each means an extension of
range, and each therefore demands a larger community.... There
seems no limit to the growth of states. I remember, Peter, a talk we
had; we agreed that this hackneyed analogy people draw between the
life and death of animals and the life and death of states was bad and
silly. It isn’t the same thing, Joan, at all. An animal, you see, has a
limit of size; it develops no new organs for further growth when it
has reached that limit, it breeds its successors, it ages naturally;
when it dies, it dies for good and all and is cleared away. Exactly the
reverse is true of a human community. Exactly? Yes, exactly. If it can
develop its educational system steadily—note that—if it can keep up
communications, a State can go on indefinitely, conquering, ousting,
assimilating. Even an amoeba breaks up after growth, but a human
community need not do so. And so far from breeding successors it
kills them if it can—like Frazer’s priest—where was it?—Aricia? The
priest of Diana. The priest of The Golden Bough....”
Oswald picked up his thread again after a long, half dreaming
excursion in Frazer-land.
“It is just this limitlessness, this potential immortality of States
that makes all the confusion and bloodshed of history. What is
happening in the world today? What is the essence of it all? The
communities of today are developing range, faster than ever they
did: aeroplanes, guns, swifter ships, everywhere an increasing range
of action. That is the most important fact to grasp about the modern
world. It is the key fact in politics. From the first dawn of the human
story you see man in a kind of a puzzled way—how shall I put it?—
pursuing the boundary of his possible community. Which always
recedes. Which recedes now faster than ever. Until it brings him to a
fatal war and disaster. Over and over again it is the same story. If you
had a coloured historical atlas of the world, the maps would be just a
series of great dabs of empire, spreading, spreading—coming against
resistances—collapsing. Each dab tries to devour the world and fails.
There is no natural limit to a human community, no limit in time or
space—except one.
“Genus Homo, species Sapiens, Mankind, that is the only limit.”
(Peter, perhaps, might be led up to saying that.)...
“What has the history of education always been? A series of little
teaching chaps trying to follow up and fix the fluctuating boundaries
of communities”—an image came into Oswald’s head that pleased
him and led him on—“like an insufficient supply of upholsterers
trying to overtake and tack down a carpet that was blowing away in
front of a gale. An insufficient supply of upholsterers.... And the
carpet always growing as it blows. That’s good.... They were trying to
fix something they hadn’t clearly defined. And you have a lot of them
still hammering away at their tacks when the edge of the carpet has
gone on far ahead.... That was really the state of education in
England when I took you two young people in hand; the carpet was
in the air and most of the schoolmasters, schoolmistresses, writers,
teachers, journalists, and all who build up and confirm ideas were
hammering in tacks where the carpet had been resting the day before
yesterday.... But a lot were not even hammering. No. They just went
easy. Yes, that is what I mean when I say that education was
altogether at loose ends.... But Germany was different; Germany was
teaching and teaching in schools, colleges, press, everywhere, this
new Imperialism of hers, a sort of patriotic melodrama, with Britain
as Carthage and Berlin instead of Rome. They pointed the whole
population to that end. They taught this war. All over the world a
thousand other educational systems pointed in a thousand
directions....
“So Germany set fire to the Phœnix....
“Only one other great country had any sort of state education. Real
state education that is. The United States was also teaching
citizenship, on a broader if shallower basis; a wider citizenship—
goodwill to all mankind. Shallower. Shallower certainly. But it was
there. A republican culture. Candour ... generosity.... The world has
still to realize its debt to the common schools of America....
“This League of Free Nations, of which all men are dreaming and
talking, this World Republic, is the rediscovered outline, the proper
teaching of all real education, the necessary outline now of human
life.... There is nothing else to do, nothing else that people of our sort
can do at all, nothing but baseness, grossness, vileness, and slavery
unless we live now as a part of that process of a world peace. Our
lives have got to be political lives. All lives have to be made political
lives. We can’t run about loose any more. This idea of a world-wide
commonwealth, this ideal of an everlasting world-peace in which we
are to live and move and have our being, has to be built up in every
school, in every mind, in every lesson. ‘You belong. You belong. And
the world belongs to you.’...”
What ought one to teach when one teaches geography, for
instance, but the common estate of mankind? Here, the teacher
should say, are mountains and beautiful cities you may live to see.
Here are plains where we might grow half the food of mankind! Here
are the highways of our common life, and here are pleasant bye-ways
where you may go! All this is your inheritance. Your estate. To rejoice
in—and serve. But is that how geography is taught?...
“We used to learn lists of the British possessions, with their total
exports and imports in money. I remember it as if it were
yesterday.... Old Smugs—a hot New Imperialist—new then....
“Then what is history but a long struggle of men to find peace and
safety, and how they have been prevented by baseness and greed and
folly? Is that right? No, folly and baseness—and hate.... Hate
certainly.... All history is one dramatic story, of man blundering his
way from the lonely ape to the world commonwealth. All history is
each man’s adventure. But what teacher makes history much more
than a dwarfish twaddle about boundaries and kings and wars?
Dwarfish twaddle. History! It went nowhere. It did nothing. Was
there ever anything more like a crowd of people getting into an
omnibus without wheels than the History Schools at Oxford? Or your
History Tripos?”... Oswald repeated his image and saw that it was
good....
“What is the teaching of a language again but teaching the
knowledge of another people—an exposition of the soul of another
people—a work of union?... But you see what I mean by all this; this
idea of a great world of co-operating peoples; it is not just a
diplomatic scheme, not something far off that Foreign Offices are
doing; it is an idea that must revolutionize the lessons of a child in
the nursery and alter the maps upon every schoolroom wall. And
frame our lives altogether. Or be nothing. The World Peace. To that
we all belong. I have a fancy— As though this idea had been hovering
over the world, unsubstantial, unable to exist—until all this blood-
letting, this torment and disaster gave it a body....
“What I am saying to you the University ought to have said to you.
“Instead of Universities”—he sought for a phrase and produced
one that against the nocturnal dark seemed brilliant and luminous.
“Instead of the University passant regardant, we want the
University militant. We want Universities all round and about the
world, associated, working to a common end, drawing together all
the best minds and the finest wills, a myriad of multi-coloured
threads, into one common web of a world civilization.”
§7
Also that night Oswald made a discourse upon the English.
“Yours is a great inheritance, Joan and Peter,” he said to the
darkness. “You are young; that is a great thing in itself. The world
cries out now for the young to enter into possession. And also—do
you ever think of it?—you are English, Joan and Peter....
“Let me say something to you before we have done, something out
of my heart. Have I ever canted patriotism to you? No! Am I an
aggressive Imperialist? Am I not a Home Ruler? For Ireland. For
India. The best years of my life have been spent in saving black men
from white—and mostly those white men were of our persuasion,
men of the buccaneer strain, on the loot. But now that we three are
here together with no one else to hear us, I will confess. I tell you
there is no race and no tradition in the whole world that I would
change for my English race and tradition. I do not mean the brief
tradition of this little Buckingham Palace and Westminster system
here that began yesterday and will end tomorrow, I mean the great
tradition of the English that is spread all over the earth, the tradition
of Shakespeare and Milton, of Newton and Bacon, of Runnymede
and Agincourt, the tradition of the men who speak fairly and act
fairly, without harshness and without fear, who face whatever odds
there are against them and take no account of Kings. It is in
Washington and New York and Christchurch and Sydney, just as
much as it is in Pelham Ford.... Well, upon us more than upon any
other single people rests now for a time the burthen of human
destiny. Upon us and France. France is the spear head but we are the
shaft. If we fail, mankind may fail. We English have made the
greatest empire that the world has ever seen; across the Atlantic we
have also made the greatest republic. And these are but phases in our
task. The better part of our work still lies before us. The weight is on
us now. It was Milton who wrote long ago that when God wanted
some task of peculiar difficulty to be done he turned to his
Englishmen. And he turns to us today. Old Milton saw English shine
clear and great for a time and then pass into the darkness.... He
didn’t lose his faith.... Church and crown are no part of the real
England which we inherit....
“We have no reason to be ashamed of our race and country, Joan
and Peter, for all the confusion and blundering of these last years.
Our generals and politicians have missed opportunity after
opportunity. I cannot talk yet of such things.... The blunderings....
The slackness.... Hanoverian England with its indolence, its dulness,
its economic uncleanness, its canting individualism, its contempt for
science and system, has been an England darkened, an England
astray——. Young England has had to pay at last for all those wasted
years—and has paid.... My God! the men we have expended already
in fighting these Germans, the brave, beautiful men, the jesting
common men, the fresh boys, so cheerful and kind and gallant!...
And the happiness that has died! And the shame of following after
clumsy, mean leadership in the sight of all the world!... But there
rests no stain on our blood. For our people here and for the
Americans this has been a war of honour. We did not come into this
war for sordid or narrow ends. Our politicians when they made base
treaties had to hide them from our people.... Even in the face of the
vilest outrages, even now the English keep a balanced justice and will
not hate the German common men for things they have been forced
to do. Yesterday I saw the German prisoners who work at Stanton
getting into the train and joking with their guard. They looked well
fed and healthy and uncowed. One carried a bunch of primroses. No
one has an ill word for these men on all the countryside.... Does any
other people in the world treat prisoners as we treat them?...
“Well, the time has come for our people now to go on from Empire
and from Monroe doctrine, great as these ideas have been, to
something still greater; the time has come for us to hold out our
hands to every man in the world who is ready for a disciplined
freedom. The German has dreamt of setting up a Cæsar over the
whole world. Against that we now set up a disciplined world
freedom. For ourselves and all mankind....
“Joan and Peter, that is what I have been coming to in all this
wandering discourse. Yours is a great inheritance. You and your
generation have to renew and justify England in a new world. You
have to link us again in a common purpose with our kind
everywhere. You have to rescue our destinies, the destinies of the
world, from these stale quarrels; you have to take the world out of
the hands of these weary and worn men, these old and oldish men,
these men who can learn no more. You have to reach back and touch
the England of Shakespeare, Milton, Raleigh, and Blake—and that
means you have to go forward. You have to take up the English
tradition as it was before church and court and a base imperialism
perverted it. You have to become political. Now. You have to become
responsible. Now. You have to create. Now. You, with your fresh
vision, with the lessons you have learnt still burning bright in your
minds, you have to remake the world. Listen when the old men tell
you facts, for very often they know. Listen when they reason, they
will teach you many twists and turns. But when they dogmatize,
when they still want to rule unquestioned, and, above all, when they
say ’impossible,’ even when they say ’wait—be dilatory and discreet,’
push them aside. Their minds squat crippled beside dead
traditions.... That England of the Victorian old men, and its empire
and its honours and its court and precedences, it is all a dead body
now, it has died as the war has gone on, and it has to be buried out of
our way lest it corrupt you and all the world again....”
§8
We underrate the disposition of youth to think for itself.
Oswald set himself to deliver this Valediction of his after dinner on
Friday evening....
Joan was hesitating between a game of Demon Patience with Peter
—in which she always played thirteen to his eleven and usually won
in spite of the handicap—and an inclination for Bach’s Passacaglia
upon the pianola in the study. Peter expressed himself ready for
whatever she chose; he would play D.P. or read Moll Flanders—he
had just discovered the delight of that greatest of all eighteenth
century novels. He was sitting on the couch in the library and Joan
was standing upon the hearthrug, regarding him thoughtfully, when
Oswald came in. He stopped to hear what Peter was saying, with his
one eye intent on Joan’s pretty gravity.
“No,” he interrupted. “This is my evening.
“You see,” he said, coming up to the fire; “I want to talk to you
young people. I want to know some things—— I want to know what
you make of life.... I want ... an exchange of views.”
He stood with his back to the fire and smiled at Joan’s grave face
close to his own. “I’ve got to talk to you,” he said, “very seriously. It’s
necessary.”
Having paralysed them by this preface he sat down in his deep
armchair, pulled it an inch or so towards the fire, and leaning
forward, with his eye on the spitting coals, began.
“I wish I could talk better, Joan and Peter.... I know I’ve never
been a good talker—it’s been rather a loss between us all. And now
particularly.... I want to talk.... You must let me get it out in my own
way....
“You see,” he went on after a moment or so to rally his forces, “I’ve
been your guardian, I’ve had your education and your affairs in my
hands, for fifteen years. So far as the affairs go, Sycamore, you know
—— We won’t go into that. That’s all plain sailing. But it’s the
education I want to talk about—and your future. You are now both of
age. Well past. You’re on the verge of twenty-five, Peter—in a month
or so. You’re both off now—housekeeping. You’re dropping the pilot.
It’s high time, I suppose....”
Joan glanced at Peter, and then sank noiselessly into a crouching
attitude close to Oswald’s knee. He paused to stroke her hair.
“I’ve been trying to get you all that I could get you.... Education....
I’ve had to blunder and experiment. I ought to tell you what I’ve
aimed at and what I’ve done, take stock with you of the world I’ve
educated you for and the part you’re going to play in it. Take stock....
It’s been a badly planned undertaking, I know. But then it’s such a
surprising and unexpected world. All the time I’ve been learning, and
most things I’ve learnt more or less too late to use the knowledge
properly....”
He paused.
Peter looked at his guardian and said nothing. Oswald patted the
head at his knee in return for a caress. It was an evasive, even
apologetic pat, for he did not want to be distracted by affection just
then.
“This war has altered the whole world,” he went on. “Life has
become stark and intense, and when I took this on—when I took up
the task of educating you—our world here seemed the most wrapped
up and comfortable and secure world you can possibly imagine.
Comfortable to the pitch of stuffiness. Most English people didn’t
trouble a bit about the shape of human life; they thought it was—
well, rather like a heap of down cushions. For them it was. For most
of Europe and America.... They thought it was all right and perfectly
safe—if only you didn’t bother. And education had lost its way. Yes.
That puts the case. Education had lost its way.”
Oswald paused again. He fixed his one eye firmly on a glowing
cavity in the fire, as though that contained the very gist of his
thoughts.
“What is education up to?” he asked. “What is education?”...
Thereupon of course he ought to have gone on to the passage
beginning, “Consider this beast we are, this thing man!” as he had
already rehearsed it overnight. But Peter had not learnt his part
properly.
“I suppose it’s fitting the square natural man into the round hole of
civilized life,” Peter threw out.
This reply greatly disconcerted Oswald. “Exactly,” he said, and was
for some moments at a loss.
“Yes,” he said, rallying. “But what is civilized life?”
“Oh!... Creative activities in an atmosphere of helpful goodwill,”
Peter tried in the brief pause that followed.
Oswald had a disagreeable feeling that he was getting to the end of
his discourse before he delivered its beginning. “Yes,” he said again.
“Yes. But for that you must have a political form.”
“The World State,” said Peter.
“The League of Free Nations,” said Oswald, “to enforce Peace
throughout the earth.”
The next remark that came from Peter was still more unexpected
and embarrassing.
“Peace is nothing,” said Peter.
Oswald turned his red eye upon his ward, in profound amazement.
Did they differ fundamentally in their idea of the human future?
“Peace, my dear Peter, is everything,” he protested.
“But, sir, it’s nothing more than the absence of war. It’s a negative.
In itself it’s—vacuum. You can’t live in a vacuum.”
“But I mean an active peace.”
“That would be something more than peace. War is an activity.
Peace is not. If you take war out of the world, you must have some
other activity.”
“But doesn’t the organization of the World Peace in itself
constitute an activity?”
“That would be a diminishing activity, sir. Like a man getting
himself morphia and taking it and going to sleep. A World Peace
would release energy, and as the energy was released, if the end were
merely peace, there would be less need for it. Until things exploded.”
Great portions of Oswald’s Valediction broke away and vanished
for ever into the limbo of unspoken discourses.
“But would you have war go on, Peter?”
“Not in its present form. But struggle and unification, which is the
end sought in all struggles, must go on in some form, sir,” said Peter,
“while life goes on. We have to get the World State and put an end to
war. I agree. But the real question is what are you going to do with
our Peace? What struggle is to take the place of war? What is
mankind going to do? Most wars have come about hitherto because
somebody was bored. Do you remember how bored we all were in
1914? And the rotten way we were all going on then? A World State
or a League of Nations with nothing to do but to keep the peace will
bore men intolerably.... That’s what I like about the Germans.”
“What you like about the Germans!” Oswald cried in horror.
“They did get a move on, sir,” said Peter.
“We don’t want a preventive League of Nations,” Peter expanded.
“It’s got to be creative or nothing. Or else we shall be in a sort of
perpetual Coronation year—with nothing doing on account of the
processions. Horrible!”
For a little while Oswald made no reply. He could not recall a
single sentence of the lost Valediction that was at all appropriate
here, and he was put out and distressed beyond measure that Peter
could find anything to “like” about the Germans.
“A World Peace for its own sake is impossible,” Peter went on.
“The Old Experimenter would certainly put a spoke into that wheel.”
“Who is the Old Experimenter?” asked Oswald.
“He’s a sort of God I have,” said Peter. “Something between
theology and a fairy tale. I dreamt about him. When I was delirious.
He doesn’t rule the world or anything of that sort, because he doesn’t
want to, but he keeps on dropping new things into it. To see what
happens. Like a man setting himself problems to work out in his
head. He lives in a little out-of-the-way office. That’s the idea.”
“You haven’t told me about him,” said Joan.
“I shall some day,” said Peter. “When I feel so disposed....”
“This is very disconcerting,” said Oswald, much perplexed. He
scowled at the fire before him. “But you do realize the need there is
for some form of world state and some ending of war? Unless
mankind is to destroy itself altogether.”
“Certainly, sir,” said Peter. “But we aren’t going to do that on a
peace proposition simply. It’s got to be a positive proposal. You
know, sir——”
“I wish you’d call me Nobby,” said Oswald.
“It’s a vice contracted in the army, this Sir-ing,” said Peter. “It’s
Nobby in my mind, anyhow. But you see, I’ve got a kind of habit, at
night and odd times, of thinking over my little misadventure with
that balloon and my scrap with von Papen. They are my stock
dreams, with extra details worked in, nasty details some of them ...
and then I wake up and think about them. I think over the parachute
affair more than the fight, because it lasted longer and I wasn’t so
active. I felt it more. Especially being shot in the legs.... That sort of
dream when you float helpless.... But the thing that impresses me
most in reflecting on those little experiences is the limitless amount
of intelligence that expended itself on such jobs as breaking my wrist,
splintering my shoulder-blade and smashing up my leg. The amount
of ingenuity and good workmanship in my instruments and the
fittings of my basket, for example, was extraordinary, having regard
to the fact that it was just one small item in an artillery system for
blowing Germans to red rags. And the stuff and intelligence they
were putting up against me, that too was wonderful; the way the
whole problem had been thought out, the special clock fuse and so
on. Well, my point is that the chap who made that equipment wasn’t
particularly interested in killing me, and that the chaps who made
my outfit weren’t particularly keen on the slaughter of Germans. But
they had nothing else to do. They were brought up in a pointless
world. They were caught by a vulgar quarrel. What did they care for
the Kaiser? Old ass! What they were interested in was making the
things....”
Peter became very earnest in his manner. “No peace, as we have
known peace hitherto, offers such opportunities for good inventive
work as war does. That’s my point, Nobby. There’s no comparison
between the excitement and the endless problems of making a real,
live, efficient submarine, for example, that has to meet and escape
the intensest risks, and the occupation of designing a great, big, safe,
upholstered liner in which fat swindlers can cross the Atlantic
without being seasick. War tempts imaginative, restless people, and a
stagnant peace bores them. And you’ve got to reckon with
intelligence and imagination in this world, Nobby, more than
anything. They aren’t strong enough to control perhaps, but they will
certainly upset. Inventive, restless men are the particular
instruments of my Old Experimenter. He prefers them now to
plague, pestilence, famine, flood and earthquake. They are more
delicate instruments. And more efficient. And they won’t stand a
passive peace. Under no circumstances can you hope to induce the
chap who contrived the clock fuse and the chap who worked out my
gas bag or the chap with a new aeroplane gadget, and me—me, too—
to stop cerebrating and making our damndest just in order to sit
about safely in meadows joining up daisy chains—like a beastly lot of
figures by Walter Crane. The Old Experimenter finds some mischief
still for idle brains to do. He insists on it. That’s fundamental to the
scheme of things.”
“But that’s no reason,” interrupted Oswald, “why you and the
inventors who were behind you, and the Germans who made and
loaded and fired that shell, shouldn’t all get together to do something
that will grow and endure. Instead of killing one another.”
“Ah, that’s it!” said Peter. “But the word for that isn’t Peace.”
“Then what is the word for it?”
“I don’t know,” said Peter. “The Great Game, perhaps.”
“And where does it take you?”
Peter threw out his hands. “It’s an exploration,” he said. “It will
take man to the centre of the earth; it will take him to the ends of
space, between the atoms and among the stars. How can we tell
beforehand? You must have faith. But of one thing I am sure, that
man cannot stagnate. It is forbidden. It is the uttermost sin. Why, the
Old Man will come out of his office himself to prevent it! This war
and all the blood and loss of it is because the new things are
entangled among old and dead things, worn-out and silly things, and
we’ve not had the vigour to get them free. Old idiot nationality,
national conceit—expanding to imperialism, nationality in a state of
megalomania, has been allowed to get hold of the knife that was
meant for a sane generation to carve out a new world with. Heaven
send he cuts his own throat this time! Or else there may be a next
time.... I’m all for the one world state, and the end of flags and kings
and custom houses. But I have my doubts of all this talk of making
the world safe—safe for democracy. I want the world made one for
the adventure of mankind, which is quite another story. I have been
in the world now, Nobby, for five-and-twenty years, and I am only
beginning to suspect the wonder and beauty of the things we men
might know and do. If only we could get our eyes and hands free of
the old inheritance. What has mankind done yet to boast about? I
despise human history—because I believe in God. Not the God you
don’t approve of, Nobby, but in my Old Experimenter, whom I
confess I don’t begin to understand, and in the far-off, eternal
scheme he hides from us and which he means us to develop age by
age. Oh! I don’t understand him, I don’t begin to explain him; he’s
just a figure for what I feel is the reality. But he is right, he is
wonderful. And instead of just muddling about over the surface of his
universe, we have to get into the understanding of it to the very
limits of our ability, to live our utmost and do the intensest best we
can.”
“Yes,” said Oswald; “yes.” This was after his own heart, and yet it
did not run along the lines of the Valedictory that had flowered with
such Corinthian richness overnight. He had been thinking then of
world peace; what Peter was driving at now was a world purpose; but
weren’t the two after all the same thing? He sat with his one eye
reflecting the red light of the fire, and the phrases that had come in
such generous abundance overnight now refused to come at all.
Peter, on the couch, continued to think aloud.
“Making the world safe for democracy,” said Peter. “That isn’t
quite it. If democracy means that any man may help who can, that
school and university will give every man and woman the fairest
chance, the most generous inducement to help, to do the thing he
can best do under the best conditions, then, Yes; but if democracy
means getting up a riot and boycott among the stupid and lazy and
illiterate whenever anything is doing, then I say No! Every human
being has got to work, has got to take part. If our laws and
organization don’t insist upon that, the Old Experimenter will. So
long as the world is ruled by stale ideas and lazy ideas, he is
determined that it shall flounder from war to war. Now what does
this democracy mean? Does it mean a crowd of primitive brutes
howling down progress and organization? because if it does, I want
to be in the machine-gun section. When you talk of education,
Nobby, you think of highly educated people, of a nation instructed
through and through. But what of democracy in Russia, where you
have a naturally clever people in a state of peasant ignorance—who
can’t even read? Until the schoolmaster has talked to every one for
ten or twelve years, can you have what President Wilson thinks of as
democracy at all?”
“Now there you meet me,” said Oswald. “That is the idea I have
been trying to get at with you.” And for some minutes the palatial
dimensions of the lost Valedictory loomed out. Where he had said
“peace” overnight, however, he now said progress.
But the young man on the couch was much too keenly interested to
make a good audience. When presently Oswald propounded his
theory that all the great world religions were on the side of this
World Republic that he and Peter desired, Peter demurred.
“But is that true of Catholicism for instance?” said Peter.
Oswald quoted, “I am the Vine and ye are the Branches.”
“Yes,” said Peter. “But look at the Church itself. Don’t look at the
formula but at the practice and the daily teaching. Is it truly a
growing Vine?” The reality of Catholicism, Peter argued, was a
traditional, sacramental religion, a narrow fetish religion with a
specialized priest, it was concerned primarily with another world, it
set its face against any conception of a scheme of progress in this
world apart from its legend of the sacrifice of the Mass.
“All good Catholics sneer at progress,” said Peter. “Take Belloc and
Chesterton, for example; they hate the idea of men working steadily
for any great scheme of effort here. They hold by stagnant standards,
planted deep in the rich mud of life. What’s the Catholic conception
of human life?—guzzle, booze, call the passion of the sexes unclean
and behave accordingly, confess, get absolution, and at it again. Is
there any recognition in Catholicism of the duty of keeping your body
fit or your brain active? They’re worse than the man who buried his
talent in a clean napkin; they bury it in wheezy fat. It’s a sloven’s life.
What have we in common with that? Always they are harking back to
the thirteenth century, to the peasant life amidst dung and chickens.
It’s a different species of mind from ours, with the head and feet
turned backward. What is the good of expecting the Pope, for
instance, and his Church to help us in creating a League of Nations?
His aim would be a world agreement to stop progress, and we want
to release it. He wants peace in order to achieve nothing, and we
want peace in order to do everything. What is the good of pretending
that it is the same peace? A Catholic League of Nations would be a
conspiracy of stagnation, another Holy Alliance. What real world
unity can come through them? Every step on the way to the world
state and the real unification of men will be fought by the stagnant
men and the priests. Why blind ourselves to that? Progress is a
religion in itself. Work and learning are our creed. We cannot make
terms with any other creed. The priest has got his God and we seek
our God for ever. The priest is finished and completed and self-
satisfied, and we—we are beginning....”
§9
There were two days yet before Peter went back to his work in
London. Saturday dawned blue and fine, and Joan and he
determined to spend it in a long tramp over the Hertfordshire hills
and fields. He meant to stand no nonsense from his foot. “If I can’t
walk four miles an hour then I must do two,” he said. “And if the
pace is too slow for you, Joan, you must run round and round me
and bark.” They took a long route by field and lane through Albury
and Furneaux Pelham to the little inn at Stocking Pelham, where
they got some hard biscuits and cheese and shandygaff, and came
home by way of Patmore Heath, and the golden oaks and the rivulet.
And as they went Peter talked of Oswald.
“Naturally he wants to know what we are going to do,” said Peter,
and then, rather inconsequently, “He’s ill.
“This war is like a wasting fever in the blood and in the mind,” said
Peter. “All Europe is ill. But with him it mixes with the old fever. That
splinter at Fricourt was no joke for him. He oughtn’t to have gone
out. He’s getting horribly lean, and his eye is like a garnet.”
“I love him,” said Joan.
But she did not want to discuss Oswald just then.
“About this new theology of yours, Peter,” she said....
“Well?” said Peter.
“What do you mean by this Old Experimenter of yours? Is he—
God?”
“I don’t know. I thought he was. He’s—— He’s a Symbol. He’s just
a Caricature I make to express how all this”—Peter swept his arm
across the sunlit world—“seems to stand to me. If one can’t draw the
thing any better, one has to make a caricature.”
Joan considered that gravely.
“I thought of him first in my dream as the God of the Universe,”
Peter explained.
“You couldn’t love a God like that,” Joan remarked.
“Heavens, no! He’s too vast, too incomprehensible. I love you—and
Oswald—and the R.F.C., Joan, and biology. But he’s above and
beyond that sort of thing.”
“Could you pray to him?” asked Joan.
“Not to him,” said Peter.
“I pray,” said Joan. “Don’t you?”
“And swear,” said Peter.
“One prays to something—it isn’t oneself.”
“The fashion nowadays is to speak of the God in the Heart and the
God in the Universe.”
“Is it the same God?”
“Leave it at that,” said Peter. “We don’t know. All the waste and
muddle in religion is due to people arguing and asserting that they
are the same, that they are different but related, or that they are
different but opposed. And so on and so on. How can we know?
What need is there to know? In view of the little jobs we are doing.
Let us leave it at that.”
Joan was silent for a while. “I suppose we must,” she said.
“And what are we going to do with ourselves,” asked Joan, “when
the war is over?”
“They can’t keep us in khaki for ever,” Peter considered. “There’s a
Ministry of Reconstruction foozling away in London, but it’s never
said a word to me of the some-day that is coming. I suppose it hasn’t
learnt to talk yet.”
“What do you think of doing?” asked Joan.
“Well, first—a good medical degree. Then I can doctor if I have to.
But, if I’m good enough, I shall do research. I’ve a sort of feeling that
along the border line of biology and chemistry I might do something
useful. I’ve some ideas.... I suppose I shall go back to Cambridge for a
bit. We neither of us need earn money at once. It will be queer—after
being a grown-up married man—to go back to proctors and bulldogs.
What are you going to do, Joan, when you get out of uniform?”
“Look after you first, Petah. Oh! it’s worth doing. And it won’t take
me all my time. And then I’ve got my own ideas....”
“Out with ’em, Joan.”
“Well——”
“Well?”
“Petah, I shall learn plumbing.”
“Jobbing?”
“No. And bricklaying and carpentry. All I can. And then I am going
to start building houses.”
“Architect?”
“As little as possible,” said Joan. “No. No beastly Architecture for
Art’s sake for me! Do you remember how people used to knock their
heads about at The Ingle-Nook? I’ve got some money. Why shouldn’t
I be able to build houses as well as the fat builder-men with big, flat
thumbs who used to build houses before the war?”
“Jerry-building?”
“High-class jerry-building, if you like. Cottages with sensible
insides, real insides, and not so much waste space and scamping to
make up for it. They’re half a million houses short in this country
already. There’s something in building appeals to my sort of
imagination. And I’m going to make money, Petah.”
“I love the way you carry your tail,” said Peter. “Always.”
“Well, doing running repairs hardens a woman’s soul.”
“You’ll make more money than I shall, perhaps. But now I begin to
understand all these extraordinary books you’ve been studying.... I
might have guessed.... Why not?”
He limped along, considering it. “Why shouldn’t you?” he said. “A
service flat will leave your hands free.... I’ve always wondered
secretly why women didn’t plunge into that sort of business more.”
“It’s been just diffidence,” said Joan.
“Click!” said Peter. “That’s gone, anyhow. If a lot of women do as
you do and become productive for good, this old muddle of a country
will sit up in no time. It doubles the output.... I wonder if the men
will like working under you?”
“There’ll be a boss in the background,” said Joan. “Mr. John
Debenham. Who’ll never turn up. Being, in fact, no more than
camouflage for Joan of that ilk. I shall be just my own messenger and
agent.
“One thing I know,” said Joan, “and that is, that I will make a
cottage or a flat that won’t turn a young woman into an old one in ten
years’ time. Living in that Jepson flat without a servant has
brightened me up in a lot of ways.... And a child will grow up in my
cottages without being crippled in its mind by awkwardness and
ugliness.... This sort of thing always has been woman’s work really.
Only we’ve been so busy chittering and powdering our silly noses—
and laying snares for our Peters. Who didn’t know what was good for
them.”
Peter laughed and was amused. He felt a pleasant assurance that
Joan really was going to build houses.
“Joan,” he said, “it’s a bleak world before us—and I hate to think of
Nobby. He’s so ill. But the work—the good hard work—there’s times
when I rather like to think of that.... They were beastly years just
before the war.”
“I hated them,” said Joan.
“But what a lot of stuff there was about!” said Peter. “The petrol!
Given away, practically, along the roadside everywhere. And the
joints of meat. Do you remember the big hams we used to have on
the sideboard? For breakfast. A lot of sausages going sizzle! Eggs
galore! Bacon! Haddock. Perhaps cutlets. And the way one could run
off abroad!”
“To Italy,” said Joan dangerously.
“God knows when those times will come back again! Not for years.
Not for our lifetimes.”
“If they came back all at once we’d have indigestion,” said Joan.
“Orgy,” said Peter. “But they won’t.”...
Presently their note became graver.
“We’ve got to live like fanatics. If a lot of us don’t live like fanatics,
this staggering old world of ours won’t recover. It will stagger and
then go flop. And a race of Bolshevik peasants will breed pigs among
the ruins. We owe it to ourselves, we owe it to the world to prevent
that.”
“And we owe it to the ones who have died,” said Joan.
She hesitated, and then she began to tell him something of the part
Wilmington had played in their lives.
They went through field after field, through gates and over stiles
and by a coppice spangled with primroses, while she told him of the
part that Wilmington had played in bringing them together;
Wilmington who was now no more than grey soil where the battle
still raged in France. Many were the young people who talked so of
dead friends in those days. Their voices became grave and faintly
deferential, as though they had invoked a third presence to mingle
with their duologue. They were very careful to say nothing and to
think as little as possible that might hurt Wilmington’s self-love.
Presently they found themselves speculating again about the kind
of world that lay ahead of them—whether it would be a wholly poor
world or a poverty-struck world infested and devastated by a few
hundred millionaires and their followings. Poor we were certain to
be. We should either be sternly poor or meanly poor. But Peter was
disposed to doubt whether the war millionaires would “get away with
the swag.”
“There’s too much thinking and reading nowadays for that,” said
Peter. “They won’t get away with it. This is a new age, Joan. If they
try that game they won’t have five years’ run.”
No, it would be a world generally poor, a tired but chastened world
getting itself into order again.... Would there be much music in the
years ahead? Much writing or art? Would there be a new theatre and
the excitement of first nights again? Should we presently travel by
aeroplane, and find all the world within a few days’ journey? They
were both prepared to resign themselves to ten years’ of work and
scarcity, but they both clung to the hope of returning prosperity and
freedom after that.
“Well, well, Joan,” said Peter, “these times teach us to love. I’m
crippled. We’ve got to work hard. But I’m not unhappy. I’m happier
than I was when I had no idea of what I wanted in life, when I lusted
for everything and was content with nothing, in the days before the
war. I’m a wise old man now with my stiff wrist and my game leg.
You change everything, Joan. You make everything worth while.”
“I’d like to think it was me,” said Joan idiomatically.
“It’s you....
“After all there must be some snatches of holiday. I shall walk with
you through beautiful days—as we are doing today—days that would
only be like empty silk purses if it wasn’t that they held you in them.
Scenery and flowers and sunshine mean nothing to me—until you
come in. I’m blind until you give me eyes. Joan, do you know how
beautiful you are? When you smile? When you stop to think?
Frowning a little. When you look—yes, just like that.”
“No!” said Joan, but very cheerfully.
“But you are—you are endlessly beautiful. Endlessly. Making love
to Joan—it’s the intensest of joys. Every time—— As if one had just
discovered her.”
“There’s a certain wild charm about Petah,” Joan admitted, “for a
coarse taste.”
“After all, whether it’s set in poverty or plenty,” said Peter;
“whether it’s rational or irrational, making love is still at the heart of
us humans.”...
For a time they exulted shamelessly in themselves. They talked of
the good times they had had together in the past. They revived
memories of Bungo Peter and the Sagas that had slumbered in
silence since the first dawn of adolescence. She recalled a score of
wonderful stories and adventures that he had altogether forgotten.
She had a far clearer and better memory for such things than he.
“D’you remember lightning slick, Petah? And how the days went
faster? D’you remember how he put lightning slick on his bicycle?”...
But Peter had forgotten that.
“And when we fought for that picshua you made of Adela,” Joan
said. “When I bit you.... It was my first taste of you, Petah. You tasted
dusty....”
“I suppose we’ve always had a blind love for each other,” said
Peter, “always.”
“I hated you to care for any one but myself,” said Joan, “since ever
I can remember. I hated even Billy.”
“It’s well we found out in time,” said Peter.
“I found out,” said Joan.
“Ever since we stopped being boy and girl together,” said Peter,
“I’ve never been at peace in my nerves and temper till now.... Now I
feel as though I swung free in life, safe, sure, content.”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like