100% found this document useful (6 votes)
36 views

Full Download C network programming Vol 2 Systematic reuse with ACE and frameworks 6. print Edition Schmidt PDF DOCX

Schmidt

Uploaded by

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

Full Download C network programming Vol 2 Systematic reuse with ACE and frameworks 6. print Edition Schmidt PDF DOCX

Schmidt

Uploaded by

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

Download the full version of the ebook at

https://ebookultra.com

C network programming Vol 2 Systematic reuse


with ACE and frameworks 6. print Edition
Schmidt

https://ebookultra.com/download/c-network-
programming-vol-2-systematic-reuse-with-ace-and-
frameworks-6-print-edition-schmidt/

Explore and download more ebook at https://ebookultra.com


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

PHP Programming with PEAR 1st Edition Schmidt Stephan

https://ebookultra.com/download/php-programming-with-pear-1st-edition-
schmidt-stephan/

ebookultra.com

Programming the Network with Perl 1st Edition Paul Barry

https://ebookultra.com/download/programming-the-network-with-perl-1st-
edition-paul-barry/

ebookultra.com

Systematic Instruction for Students with Moderate and


Severe Disabilities Belva C. Collins

https://ebookultra.com/download/systematic-instruction-for-students-
with-moderate-and-severe-disabilities-belva-c-collins/

ebookultra.com

Programming in C 2 e Second Edition Dey

https://ebookultra.com/download/programming-in-c-2-e-second-edition-
dey/

ebookultra.com
STL Tutorial and Reference Guide C Programming With the
Standard Template Library 2 (Draft) Edition David R.
Musser
https://ebookultra.com/download/stl-tutorial-and-reference-guide-c-
programming-with-the-standard-template-library-2-draft-edition-david-
r-musser/
ebookultra.com

Programming with C Zambak 1st Edition Osman Ay

https://ebookultra.com/download/programming-with-c-zambak-1st-edition-
osman-ay/

ebookultra.com

Programming Social Applications Building Viral Experiences


with OpenSocial OAuth OpenID and Distributed Web
Frameworks 1st Edition Jonathan Leblanc
https://ebookultra.com/download/programming-social-applications-
building-viral-experiences-with-opensocial-oauth-openid-and-
distributed-web-frameworks-1st-edition-jonathan-leblanc/
ebookultra.com

Rapid French Vol 2 with Audio Second Edition Earworms

https://ebookultra.com/download/rapid-french-vol-2-with-audio-second-
edition-earworms/

ebookultra.com

Programming with Visual C Concepts and Projects 1st


Edition James Allert

https://ebookultra.com/download/programming-with-visual-c-concepts-
and-projects-1st-edition-james-allert/

ebookultra.com
C network programming Vol 2 Systematic reuse with
ACE and frameworks 6. print Edition Schmidt Digital
Instant Download
Author(s): Schmidt, Douglas C;Huston, Stephen D
ISBN(s): 9780201795257, 0201795256
Edition: 6. print
File Details: PDF, 2.08 MB
Year: 2002
Language: english
C++ Network Programming
Volume 2
The C++ In-Depth Series
Bjarne Stroustrup, Editor

“I have made this letter longer than usual, because I lack the time to make it short.”
—BLAISE PASCAL

T he advent of the ISO/ANSI C++ standard marked the beginning of a new era for C++
programmers. The standard offers many new facilities and opportunities, but how can a
real-world programmer find the time to discover the key nuggets of wisdom within this
mass of information? The C++ In-Depth Series minimizes learning time and confusion by
giving programmers concise, focused guides to specific topics.
Each book in this series presents a single topic, at a technical level appropriate to that
topic. The Series’ practical approach is designed to lift professionals to their next level
of programming skills. Written by experts in the field, these short, in-depth monographs
can be read and referenced without the distraction of unrelated material. The books are
cross-referenced within the Series, and also reference The C++ Programming Language by
Bjarne Stroustrup.
As you develop your skills in C++, it becomes increasingly important to separate essential
information from hype and glitz, and to find the in-depth content you need in order to grow.
The C++ In-Depth Series provides the tools, concepts, techniques, and new approaches to
C++ that will give you a critical edge.

Titles in the Series


Accelerated C++: Practical Programming by Example, Andrew Koenig and Barbara E. Moo
Applied C++: Practical Techniques for Building Better Software, Philip Romanik and Amy Muntz
The Boost Graph Library: User Guide and Reference Manual, Jeremy G. Siek, Lie-Quan Lee, and Andrew
Lumsdaine
C++ Coding Standards: 101 Rules, Guidelines, and Best Practices, Herb Sutter and Andrei Alexandrescu
C++ In-Depth Box Set, Bjarne Stroustrup, Andrei Alexandrescu, Andrew Koenig, Barbara E. Moo,
Stanley B. Lippman, and Herb Sutter
C++ Network Programming, Volume 1: Mastering Complexity with ACE and Patterns, Douglas C. Schmidt
and Stephen D. Huston
C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks, Douglas C. Schmidt
and Stephen D. Huston
C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond, David Abrahams
and Aleksey Gurtovoy
Essential C++, Stanley B. Lippman
Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions, Herb Sutter
Exceptional C++ Style: 40 New Engineering Puzzles, Programming Problems, and Solutions, Herb Sutter
Modern C++ Design: Generic Programming and Design Patterns Applied, Andrei Alexandrescu
More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions, Herb Sutter

For more information, check out the series web site at www.awprofessional.com/series/indepth/
C++ Network Programming
Volume 2

Systematic Reuse with ACE and Frameworks

Douglas C. Schmidt
Stephen D. Huston

Boston • San Francisco • New York • Toronto • Montreal


London • Munich • Paris • Madrid
Capetown • Sydney • Tokyo • Singapore • Mexico City
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 Addison-Wesley was aware of a trademark claim, the designations have been
printed with initial capital letters or in all capitals.

The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any
kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages
in connection with or arising out of the use of the information or programs contained herein.

The publisher offers discounts on this book when ordered in quantity for bulk purchases and special sales. For more
information, please contact:

U.S. Corporate and Government Sales


(800) 382-3419
[email protected]

For sales outside of the U.S., please contact:

International Sales
(317) 581-3793
[email protected]

Visit Addison-Wesley on the Web: www.awprofessional.com

Library of Congress Cataloging-in-Publication Data

Schmidt, Douglas C.
C++ network programming / Douglas C. Schmidt, Stephen D. Huston.
p. cm.
Includes bibliographical references and index.
Contents: Vol. 2. Systematic reuse with ACE and frameworks.
ISBN 0-201-79525-6 (v. 2 : pbk.)
1. C++ (Computer program language) 2. Object-oriented programming (Computer
science) 3. Computer networks. I. Huston, Stephen D. II. Title.

QA 76.73.C153 S368 2002


005.2’762—dc21
2001053345
Copyright 
c 2003 by Pearson Education, Inc.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form,
or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher.
Printed in the United States of America. Published simultaneously in Canada.

For information on obtaining permission for use of material from this work, please submit a written request to:

Pearson Education, Inc.


Rights and Contracts Department
75 Arlington Street, Suite 300
Boston, MA 02116
Fax: (617) 848-7047

ISBN: 0-201-79525-6
2 3 4 5 6 7 8 9 10— O P M—06050403
Second printing, February 2005
Contents

Foreword vii

About This Book xi

Chapter 1 Object-Oriented Frameworks for Network Programming 1


1.1 An Overview of Object-Oriented Frameworks 1
1.2 Comparing Software Development and Reuse Techniques 4
1.3 Applying Frameworks to Network Programming 12
1.4 A Tour through the ACE Frameworks 14
1.5 Example: A Networked Logging Service 19
1.6 Summary 21

Chapter 2 Service and Configuration Design Dimensions 23


2.1 Service and Server Design Dimensions 24
2.2 Configuration Design Dimensions 34
2.3 Summary 38

Chapter 3 The ACE Reactor Framework 39


3.1 Overview 39
3.2 The ACE Time Value Class 42
3.3 The ACE Event Handler Class 46
3.4 The ACE Timer Queue Classes 61
3.5 The ACE Reactor Class 70
3.6 Summary 86

Chapter 4 ACE Reactor Implementations 87


4.1 Overview 87
4.2 The ACE Select Reactor Class 89
4.3 The ACE TP Reactor Class 99

v
vi CONTENTS

4.4 The ACE WFMO Reactor Class 103


4.5 Summary 113

Chapter 5 The ACE Service Configurator Framework 115


5.1 Overview 115
5.2 The ACE Service Object Class 118
5.3 The ACE Service Repository Classes 126
5.4 The ACE Service Config Class 138
5.5 Summary 154

Chapter 6 The ACE Task Framework 155


6.1 Overview 155
6.2 The ACE Message Queue Class 157
6.3 The ACE Task Class 183
6.4 Summary 202

Chapter 7 The ACE Acceptor-Connector Framework 203


7.1 Overview 203
7.2 The ACE Svc Handler Class 206
7.3 The ACE Acceptor Class 216
7.4 The ACE Connector Class 229
7.5 Summary 256

Chapter 8 The ACE Proactor Framework 257


8.1 Overview 257
8.2 The Asynchronous I/O Factory Classes 261
8.3 The ACE Handler Class 270
8.4 The Proactive Acceptor-Connector Classes 278
8.5 The ACE Proactor Class 286
8.6 Summary 296

Chapter 9 The ACE Streams Framework 297


9.1 Overview 297
9.2 The ACE Module Class 299
9.3 The ACE Stream Class 314
9.4 Summary 318

Glossary 319

Bibliography 329

Index 337
Foreword

The ADAPTIVE Communication Environment (ACE) toolkit has achieved enormous suc-
cess in the area of middleware for networked computing. Due to its flexibility, perfor-
mance, platform coverage, and other key properties, ACE enjoys broad acceptance by the
networked application software community, as evidenced by its use in thousands of applica-
tions, in scores of countries, and in dozens of domains. ACE has also received considerable
attention beyond the middleware community since it’s an open-source role model for high-
quality and well-designed pattern-oriented software architectures.
But why is ACE so successful? Addressing this question properly takes some thought.
To start off, let’s reconsider the Foreword from C++ Network Programming: Mastering
Complexity with ACE and Patterns (C++NPv1) and resume the mass transit analogy pre-
sented there by my colleague Steve Vinoski. Steve’s right that a high-quality mass transit
system consists of more than just aircraft, airports, trains, train stations, and rails. It also
needs less obvious infrastructure, such as scheduling, routing, ticketing, maintenance, and
monitoring. But even a complete collection of ingredients is still not sufficient to develop
an effective mass transit system. Arranging these ingredients so they seamlessly fulfill their
primary objective—fast and reliable transportation of people—is equally important. Would
you use a mass transit system whose ticketing was located in a train maintenance location
or an airport hangar, or whose planned and actual scheduling and routing weren’t available
to the public? I doubt it!
The success of mass transit systems depends on more than the knowledge of the infra-
structure parts that are provided—it depends on how these different parts must be connected
and integrated with their environment. This knowledge enables architects of mass transit
systems to integrate individual parts into higher-level building blocks and to connect these
building blocks effectively. For example, ticketing, information points, baggage offices, and
boarding are integrated in train stations located at city centers or major suburban centers.
Likewise, airports are often located near large cities and connected by frequent express
trains.

vii
viii Foreword

Even mass transit centers themselves are arranged so that activities can be performed
effectively. For example, when you enter a train station or airport via the main entrance, you
find ticket agents, information centers, and timetables. You also find shops to satisfy your
travel needs. As you enter the main train hall or airport concourse, you find other informa-
tion centers, up-to-date scheduling information, and the platforms and gates for boarding
the trains and planes. Mass transit centers thus not only provide all necessary services
to begin and end a journey, they also organize their internal “control flows” effectively.
While the core structures and control flows in most train stations and airports are similar,
their concrete realization can differ widely. Yet we all recognize these mass transit center
patterns immediately since they follow key invariants that we’ve learned through years of
experience.
So what’s the connection between successful mass transit system design and the success
of ACE? The answer is simple: In addition to the basic network computing ingredients (the
wrapper facades that Doug and Steve introduced in C++NPv1), ACE also includes use-
ful object-oriented frameworks that build upon these wrapper facades and provide useful
higher-level communication services, such as event demultiplexing and dispatching, con-
nection management, service configuration, concurrency, and hierarchically layered stream
processing. The ACE framework services satisfy many networked software needs by or-
ganizing the structures and internal control flows of your applications effectively via key
patterns learned through years of experience.
The ACE frameworks offer you a number of important benefits:

• You needn’t develop the capabilities provided by ACE, which will save considerable
time and effort. You can therefore focus on your key responsibility: implementing
the application functionality required by your customers and end users.
• The ACE frameworks reify the extensive network programming expertise that Doug,
Steve, and their colleagues have gained over several decades. In particular, the ACE
frameworks efficiently implement the canonical classes, class relationships, and con-
trol flows common to networked applications. The ACE frameworks are tested reg-
ularly by thousands of users from around the world, which has yielded many useful
corrections and improvements. As an ACE user, you can directly leverage the cor-
rectness, effectiveness, and efficiency of the ACE frameworks in your applications.
• A framework isn’t a framework if it can’t be adapted to specific user needs. This
means you can adapt the ACE frameworks at key points of variation in networked
applications. For example, the ACE Reactor framework can be adapted to use dif-
ferent event demultiplexer functions, such as WaitForMultipleObjects() or
select(). Likewise, the ACE Acceptor-Connector framework can be configured
with different IPC mechanisms. While this adaptability is beneficial by itself, ACE
goes a step further: for many adaptations you can configure the desired strategies
from available and interchangeable implementations. In addition to the different Re-
Foreword ix

actor implementations mentioned above, for instance, ACE provides wrapper facades
for various IPC mechanisms, such as the Sockets, SSL, TLI, and shared memory, that
help to configure the ACE Acceptor-Connector framework for specific platforms and
applications.
• Last but not least, the ACE frameworks don’t exist in isolation. You can therefore
combine them in novel ways to create networked applications and entirely new types
of middleware. For example, you can integrate the Reactor framework with the
Acceptor-Connector framework to separate connection establishment from service
processing functionality in event-driven applications. You can likewise introduce
various forms of concurrency into your applications using the ACE Task framework.

As a result of advising and leading many software projects over the years, I’ve found
that ACE greatly simplifies the task of employing reusable middleware that can be cus-
tomized readily to meet the needs of networked applications. Not all networked applica-
tions need heavyweight middleware, such as application servers, web services, and complex
component models. Yet most networked applications can benefit from portable and efficient
host infrastructure middleware like ACE. This flexibility is the core of ACE’s success since
you needn’t commit to an entire middleware suite if you don’t use all of it. Instead, you
can combine just the essential ACE middleware classes you need to compose applications
that are small, but as powerful as necessary. For this reason, I predict that ACE will still be
widely used long after the influence of today’s heavyweight middleware has waned.
ACE’s tremendous flexibility also needn’t lead to a sea of incompatible middleware
implementations. For example, if you build an embedded system that speaks the CORBA
Internet inter-ORB protocol (IIOP) to the outside world, you can use The ACE ORB (TAO),
which is a CORBA-compliant, open-source, real-time object request broker (ORB) built
using the ACE wrapper facades and frameworks. If CORBA is overkill for your application
needs, however, you can build custom, yet interoperable, middleware using the appropriate
ACE classes. Both solutions can be based on the same core structures and protocols, such
as the ACE Common Data Representation (CDR) classes and its TCP/IP Socket wrapper
facades. They can therefore communicate seamlessly with one another, just as you can
take a train from Paris to Istanbul—the famous Orient Express—and travel through many
European countries without having to change trains due to incompatible railroad networks.
As Steve Vinoski and I have pointed out, there are many similarities between high-
quality mass transit systems and high-quality networking middleware. To me and thousands
of other C++ developers around the world, ACE is the toolkit for building the latter! Af-
ter saying so many good things about ACE, however, let’s return to the main intent of this
foreword: introducing the second volume (C++NPv2) of the C++ Network Programming
series. As with all software technologies and middleware, the more you understand your
tools, the better you’ll be able to apply them. It turns out that using ACE in your appli-
cations is just one aspect of improving your networked software. To benefit significantly
x Foreword

from ACE’s many advantages, you therefore also need a sound understanding of the core
concepts, patterns, and usage rules that underlie its powerful frameworks.
For years, a common way to learn ACE involved studying its code, comments, and ex-
ample applications. Clearly, this process was time consuming and error prone. Moreover,
even after managing to read the several hundred thousand lines of C++ code in ACE, it was
easy to miss the forest for the trees. As the Greek philosopher Thucydides noted two mil-
lennia ago: “A man who has the knowledge but lacks the power to clearly express himself
is no better off than if he had never any idea at all.”
We’re therefore fortunate that Doug and Steve found time in their busy schedules to
create such a high-quality book on the ACE frameworks. C++NPv2 explains the ideas
and concepts underlying the ACE frameworks in an easily accessible form using the popu-
lar concurrency and networking patterns from the POSA [POSA1, POSA2] and “Gang of
Four” [GoF] patterns books. These patterns, in turn, reify thoughtful and time-proven solu-
tions to common networking problems. For example, they tell you what the problems are,
why these problems are hard, what the solutions to these problems are, and why these solu-
tions applied to ACE are of high quality. If you want thorough coverage of the patterns and
frameworks in ACE that are shaping the next generation of networked application software
then read this book. I’ve learned much from it and I’m sure you will too.

Frank Buschmann
Senior Principal Engineer
Siemens Corporate Technology
Munich, Germany
About This Book

Software for networked applications must possess the following qualities to be successful
in today’s competitive, fast-paced computing industry:

• Affordability, to ensure that the total ownership costs of software acquisition and
evolution are not prohibitively high
• Extensibility, to support successions of quick updates and additions to address new
requirements and take advantage of emerging markets
• Flexibility, to support a growing range of multimedia data types, traffic patterns, and
end-to-end quality of service (QoS) requirements
• Portability, to reduce the effort required to support applications on heterogeneous
OS platforms and compilers
• Predictability and efficiency, to provide low latency to delay-sensitive real-time ap-
plications, high performance to bandwidth-intensive applications, and usability over
low-bandwidth networks, such as wireless links
• Reliability, to ensure that applications are robust, fault tolerant, and highly available
• Scalability, to enable applications to handle large numbers of clients simultaneously

Writing high-quality networked applications that exhibit these qualities is hard—it’s


expensive, complicated, and error prone. The patterns, C++ language features, and object-
oriented design principles presented in C++ Network Programming, Volume 1: Mastering
Complexity with ACE and Patterns (C++NPv1) help to minimize complexity and mistakes
in networked applications by refactoring common structure and functionality into reusable
wrapper facade class libraries. The key benefits of reuse will be lost, however, if large
parts of the application software that uses these class libraries—or worse, the class libraries
themselves—must be rewritten for each new project.

xi
xii About This Book

Historically, many networked application software projects began by


1. Designing and implementing demultiplexing and dispatching infrastructure mecha-
nisms that handle timed events and I/O on multiple socket handles
2. Adding service instantiation and processing mechanisms atop the demultiplexing and
dispatching layer, along with message buffering and queueing mechanisms
3. Implementing large amounts of application-specific code using this ad hoc host in-
frastructure middleware
This development process has been applied many times in many companies, by many
projects in parallel. Even worse, it’s been applied by the same teams in a series of projects.
Regrettably, this continuous rediscovery and reinvention of core concepts and code has kept
costs unnecessarily high throughout the software development life cycle. This problem is
exacerbated by the inherent diversity of today’s hardware, operating systems, compilers,
and communication platforms, which keep shifting the foundations of networked applica-
tion software development.
Object-oriented frameworks [FJS99b, FJS99a] are one of the most flexible and pow-
erful techniques that address the problems outlined above. A framework is a reusable,
“semi-complete” application that can be specialized to produce custom applications [JF88].
Frameworks help to reduce the cost and improve the quality of networked applications by
reifying proven software designs and patterns into concrete source code. By emphasiz-
ing the integration and collaboration of application-specific and application-independent
classes, frameworks enable larger scale reuse of software than can be achieved by reusing
individual classes or stand-alone functions.
In the early 1990s, Doug Schmidt started the open-source ACE project to bring the
power and efficiency of patterns and frameworks to networked application development.
As with much of Doug’s work, ACE addressed many real-world problems faced by pro-
fessional software developers. Over the following decade, his groups at the University of
California, Irvine; Washington University, St. Louis; and Vanderbilt University, along with
contributions from the ACE user community and Steve Huston at Riverace, yielded a C++
toolkit containing some of the most powerful and widely used concurrent object-oriented
network programming frameworks in the world. By applying reusable software patterns and
a lightweight OS portability layer, the frameworks in the ACE toolkit provide synchronous
and asynchronous event processing; concurrency and synchronization; connection manage-
ment; and service configuration, initialization, and hierarchical integration.
The success of ACE has fundamentally altered the way that networked applications
and middleware are designed and implemented on the many operating systems outlined in
Sidebar 2 (page 16). ACE is being used by thousands of development teams, ranging from
large Fortune 500 companies to small startups to advanced research projects at universities
and industry labs. Its open-source development model and self-supporting culture is similar
in spirit and enthusiasm to that driving Linus Torvalds’s popular Linux operating system.
About This Book xiii

This book describes how the ACE frameworks are designed and how they can help
developers navigate between the limitations of
1. Low-level native operating system APIs, which are inflexible and nonportable
2. High-level middleware, such as distribution middleware and common middleware
services, which often lacks the efficiency and flexibility to support networked appli-
cations with stringent QoS and portability requirements

The skills required to produce and use networked application frameworks have traditionally
been locked in the heads of expert developers or buried deep within the source code of
numerous projects that are spread throughout an enterprise or an industry. Neither of these
locations is ideal, of course, since it’s time consuming and error prone to reengineer this
knowledge for each new application or project. To address this problem, this book illustrates
the key patterns [POSA2, POSA1, GoF] that underlie the structure and functionality of the
ACE frameworks. Our coverage of these patterns also makes it easier to understand the
design, implementation, and effective use of the open-source ACE toolkit itself.

Intended Audience
This book is intended for “hands on” C++ developers or advanced students interested in
understanding how to design object-oriented frameworks and apply them to develop net-
worked applications. It builds upon material from C++NPv1 that shows how developers
can apply patterns to master complexities arising from using native OS APIs to program
networked applications. It’s therefore important to have a solid grasp of the following top-
ics covered in C++NPv1 before reading this book:
• Networked application design dimensions, including the alternative communica-
tion protocols and data transfer mechanisms discussed in Chapter 1 of C++NPv1
• Internet programming mechanisms, such as TCP / IP connection management and
data transfer APIs [Ste98] discussed in Chapter 2 of C++NPv1
• Concurrency design dimensions, including the use of processes and threads, iter-
ative versus concurrent versus reactive servers, and threading models [Ste99] dis-
cussed in Chapters 5 through 9 of C++NPv1
• Synchronization techniques necessary to coordinate the interactions of processes
and threads on various OS platforms [KSS96, Lew95, Ric97] discussed in Chapter
10 of C++NPv1
• Object-oriented design and programming techniques [Boo94, Mey97] that can
simplify OS APIs and avoid programming mistakes through the use of patterns, such
as Wrapper Facade [POSA2] and Proxy [POSA1, GoF] discussed in Chapter 3 and
Appendix A of C++NPv1
xiv About This Book

The ACE frameworks are highly flexible and powerful, due in large part to their use of
C++ language features [Bja00]. You should therefore be familiar with C++ class inheritance
and virtual functions (dynamic binding) as well as templates (parameterized types) and
the mechanisms your compiler(s) offer to instantiate them. ACE provides a great deal of
assistance in overcoming differences between C++ compilers. As always, however, you
need to know the capabilities of your development tools and how to use them. Knowing
your tools makes it easier to follow the source code examples in this book and to build and
run them on your systems. Finally, as you read the examples in this book, keep in mind the
points noted in Sidebar 7 (page 46) regarding UML diagrams and C++ code.

Structure and Content


Our C++NPv1 book addressed how to master certain complexities of developing networked
applications, focusing on the use of ACE’s wrapper facades to avoid problems with oper-
ating system APIs written in C. This book (which we call C++NPv2) elevates our focus
to motivate and demystify the patterns, design techniques, and C++ features associated
with developing and using the ACE frameworks. These frameworks help reduce the cost
and improve the quality of networked applications by reifying proven software designs and
patterns into frameworks that can be reused systematically across projects and enterprises.
The ACE frameworks expand reuse technology far beyond what can be achieved by reusing
individual classes or even class libraries.
This book presents numerous C++ applications to reinforce the design discussions by
showing concrete examples of how to use the ACE frameworks. These examples provide
step-by-step guidance that can help you apply key object-oriented techniques and patterns to
your own networked applications. The book also shows how to enhance your design skills,
focusing on the key concepts and principles that shape the design of successful object-
oriented frameworks for networked applications and middleware.
The chapters in the book are organized as follows:
• Chapter 1 introduces the concept of an object-oriented framework and shows how
frameworks differ from other reuse techniques, such as class libraries, components,
patterns, and model-integrated computing. We then outline the frameworks in the
ACE toolkit that are covered in subsequent chapters.
• Chapter 2 completes the domain analysis begun in C++NPv1, which covered the
communication protocols and mechanisms, and the concurrency architectures used
by networked applications. The focus in this book is on the service and configuration
design dimensions that address key networked application properties, such as dura-
tion and structure, how networked services are identified, and the time at which they
are bound together to form complete applications.
About This Book xv

• Chapter 3 describes the design and use of the ACE Reactor framework, which imple-
ments the Reactor pattern [POSA2] to allow event-driven applications to demultiplex
and dispatch service requests that are delivered to an application from one or more
clients.
• Chapter 4 then describes the design and use of the most common implementations
of the ACE_Reactor interface, which support a wide range of OS event demul-
tiplexing mechanisms, including select(), WaitForMultipleObjects(),
XtAppMainLoop(), and /dev/poll.
• Chapter 5 describes the design and use of the ACE Service Configurator framework.
This framework implements the Component Configurator pattern [POSA2] to allow
an application to link/unlink its component service implementations at run time with-
out having to modify, recompile, or relink the application statically.
• Chapter 6 describes the design and effective use of the ACE Task framework. This
framework can be used to implement key concurrency patterns, such as Active Object
and Half-Sync/Half-Async [POSA2].
• Chapter 7 describes the design and effective use of the ACE Acceptor-Connector
framework. This framework implements the Acceptor-Connector pattern [POSA2] to
decouple the connection and initialization of cooperating peer services in a networked
system from the processing they perform once connected and initialized.
• Chapter 8 describes the design and use of the ACE Proactor framework. This frame-
work implements the Proactor and Acceptor-Connector patterns [POSA2] to allow
event-driven applications to efficiently demultiplex and dispatch service requests trig-
gered by the completion of asynchronously initiated operations.
• Chapter 9 describes the design and use of the ACE Streams framework. This frame-
work implements the Pipes and Filters pattern [POSA1] to provide a structure for
systems that process streams of data.
• The book concludes with a glossary of technical terms, a list of references for further
study, and a general subject index.
The chapters are organized to build upon each other and to minimize forward references.
We therefore recommend that you read the chapters in order.
Although this book illustrates the key capabilities of ACE’s most important frameworks,
we don’t cover all uses and methods of those frameworks. For additional coverage of ACE,
we refer you to The ACE Programmer’s Guide [HJS] and the online ACE reference doc-
umentation, generated by Doxygen [Dim01]. ACE’s reference documentation is available
at http://ace.ece.uci.edu/Doxygen/ and http://www.riverace.com/
docs/.
xvi About This Book

Related Material
This book is based on ACE version 5.3, released in the fall of 2002. ACE 5.3 and all the
sample applications described in our books are open-source software. Sidebar 3 (page 19)
explains how you can obtain a copy of ACE so you can follow along, see the actual ACE
classes and frameworks in complete detail, and run the code examples interactively as you
read the book.
To learn more about ACE, or to report errors you find in the book, we recommend you
subscribe to the ACE mailing list, [email protected]. You can subscribe by
sending a request to [email protected]. Include the following
command in the body of the e-mail (the subject is ignored):
subscribe ace-users [emailaddress@domain]

You must supply emailaddress@domain only if your message’s From address is not
the address you wish to subscribe. If you use this alternate address method, the list server
will require an extra authorization step before allowing you to join the list.
Postings to the ace-users list are also forwarded to the comp.soft-sys.ace
USENET newsgroup, along with postings to several other ACE-related mailing lists. Read-
ing the messages via the newsgroup is a good way to keep up with ACE news and activity
if you don’t require immediate delivery of the 30 to 50 messages that are posted daily on
the mailing lists.
Archives of postings to the comp.soft-sys.ace newsgroup are available at http:
//groups.google.com/. Enter comp.soft-sys.ace in the search box to go to
a list of archived messages. Google has a complete, searchable archive of over 40,000
messages. You can also post a message to the newsgroup from Google’s site.

Acknowledgments
Champion reviewing honors go to Alain Decamps, Don Hinton, Alexander Maack, Chris
Uzdavinis, and Johnny Willemsen, who reviewed the book multiple times and provided ex-
tensive, detailed comments that improved its form and content substantially. Many thanks
also to the official reviewers, Timothy Culp, Dennis Mancl, Phil Mesnier, and Jason Pa-
sion, who read the entire book and gave us many helpful comments. Many other ACE
users provided feedback on this book, including Marc M. Adkins, Tomer Amiaz, Vi Thuan
Banh, Kevin Bailey, Stephane Bastien, John Dilley, Eric Eide, Andrew Finnell, Dave Find-
lay, Jody Hagins, Jon Harnish, Jim Havlicek, Martin Johnson, Christopher Kohlhoff, Alex
Libman, Harald Mitterhofer, Llori Patterson, Nick Pratt, Dieter Quehl, Tim Rozmajzl, Irma
Rastegayeva, Eamonn Saunders, Harvinder Sawhney, Christian Schuhegger, Michael Sear-
les, Kalvinder Singh, Henny Sipma, Stephen Sturtevant, Leo Stutzmann, Tommy Svensson,
Bruce Trask, Dominic Williams, and Vadim Zaliva.
About This Book xvii

We are deeply indebted to all the members, past and present, of the DOC groups at
Washington University in St. Louis and the University of California, Irvine, as well as the
team members at Riverace Corporation and Object Computing Inc., who developed, refined,
and optimized many of the ACE capabilities presented in this book. This group includes Ev-
erett Anderson, Alex Arulanthu, Shawn Atkins, John Aughey, Luther Baker, Jaiganesh Bal-
asubramanian, Darrell Brunsch, Don Busch, Chris Cleeland, Angelo Corsaro, Chad Elliot,
Sergio Flores-Gaitan, Chris Gill, Pradeep Gore, Andy Gokhale, Priyanka Gontla, Myrna
Harbibson, Tim Harrison, Shawn Hannan, John Heitmann, Joe Hoffert, James Hu, Frank
Hunleth, Prashant Jain, Vishal Kachroo, Ray Klefstad, Kitty Krishnakumar, Yamuna Krish-
namurthy, Michael Kircher, Fred Kuhns, David Levine, Chanaka Liyanaarachchi, Michael
Moran, Ebrahim Moshiri, Sumedh Mungee, Bala Natarajan, Ossama Othman, Jeff Parsons,
Kirthika Parameswaran, Krish Pathayapura, Irfan Pyarali, Sumita Rao, Carlos O’Ryan,
Rich Siebel, Malcolm Spence, Marina Spivak, Naga Surendran, Steve Totten, Bruce Trask,
Nanbor Wang, and Seth Widoff.
We also want to thank the thousands of C++ developers from over 50 countries who’ve
contributed to ACE for over a decade. ACE’s excellence and success is a testament to the
skills and generosity of many talented developers and the forward-looking companies that
had the vision to contribute their work to ACE’s open-source code base. Without their
support, constant feedback, and encouragement, we would never have written this book.
In recognition of the efforts of the ACE open-source community, we maintain a list of all
contributors at http://ace.ece.uci.edu/ACE-members.html.
We are also grateful for the support from colleagues and sponsors of our research
on patterns and development of the ACE toolkit, notably the contributions of Ron Akers
(Motorola), Steve Bachinsky (SAIC), John Bay (DARPA), Detlef Becker (Siemens), Frank
Buschmann (Siemens), Dave Busigo (DARPA), John Buttitto (Sun), Becky Callison (Boe-
ing), Wei Chiang (Nokia Inc.), Joe Cross (Lockheed Martin), Lou DiPalma (Raytheon),
Bryan Doerr (Savvis), Karlheinz Dorn (Siemens), Scott Ellard (Madison), Matt Emerson
(Escient Convergence Group, Inc.), Sylvester Fernandez (Lockheed Martin), Nikki Ford
(DARPA), Andreas Geisler (Siemens), Helen Gill (NSF), Inc.), Jody Hagins (ATD), Andy
Harvey (Cisco), Sue Kelly (Sandia National Labs), Gary Koob (DARPA), Petri Koske-
lainen (Nokia Inc.), Sean Landis (Motorola), Patrick Lardieri (Lockheed Martin), Doug Lea
(SUNY Oswego), Joe Loyall (BBN), Kent Madsen (EO Thorpe), Ed Margand (DARPA),
Mike Masters (NSWC), Major Ed Mays (U.S. Marine Corps), John Mellby (Raytheon),
Jeanette Milos (DARPA), Stan Moyer (Telcordia), Ivan Murphy (Siemens), Russ Nose-
worthy (Object Sciences), Adam Porter (U. of Maryland), Dieter Quehl (Siemens), Vi-
jay Raghavan (Vanderbilt U.), Lucie Robillard (U.S. Air Force), Craig Rodrigues (BBN),
Rick Schantz (BBN), Andreas Schulke (Siemens), Steve Shaffer (Kodak), Tom Shields
(Raytheon), Dave Sharp (Boeing), Naval Sodha (Ericsson), Paul Stephenson (Ericsson),
Tatsuya Suda (UCI), Umar Syyid (Storetrax, Inc.), Janos Sztipanovits (Vanderbilt U.), Gau-
tam Thaker (Lockheed Martin), Lothar Werzinger (Krones), and Don Winter (Boeing).
xviii About This Book

Very special thanks go to Susan Cooper, our copy editor, for enhancing our written
material. In addition, we are grateful for the encouragement and patience of our editor,
Debbie Lafferty, our production coordinator, Elizabeth Ryan, the series editor and inventor
of C++, Bjarne Stroustrup, and everyone else at Addison-Wesley who made it possible to
publish this book.
Finally, we would also like to acknowledge our gratitude and indebtedness to the late
W. Richard Stevens, the father of network programming literature. The following poem by
Samuel Butler sums up our view of Richard’s enduring influence:

Not on sad Stygian shore, nor in clear sheen


Of far Elysian plain, shall we meet those
Among the dead whose pupils we have been . . .
Yet meet we shall, and part, and meet again,
Where dead men meet, on lips of living men.

Steve’s Acknowledgments
Wow. . . C++NPv1 took almost 3 years to complete—this volume took roughly nine months.
Thank you to my wife Jane who cheerfully endured this process. Your persistent exhorta-
tion to keep life in balance and “be the tortoise” really helped me stay the course, and
without your infinite patience through many long days and nights, I would not have com-
pleted this—thank you! Thanks to Doug Schmidt for getting the bulk of this book down
and organized in world-class time amidst a full-time job and his usual, amazing amount
of work on ACE. Finally, thank you to Riverace’s customers who supported this work so
enthusiastically. It’s a privilege to serve you.

Doug’s Acknowledgments
I’d like to thank my wife Sonja and my parents for their love and support during the writing
of this book. Now that it’s done we’ll have lots more time to have fun! Thanks also to Steve
Huston, who time-shared his overloaded schedule to wrap up the book. I’d also like to thank
my friends and colleagues at the College of William and Mary; Washington University, St.
Louis; University of California, Irvine; Vanderbilt University; DARPA; and Siemens—as
well as the thousands of ACE and TAO developers and users worldwide—who have greatly
enriched my intellectual and interpersonal life over the past two decades. I look forward to
working with all of you in the future.
C HAPTER 1

Object-Oriented Frameworks for


Network Programming

C HAPTER S YNOPSIS
Object-oriented frameworks help reduce the cost and improve the quality of networked ap-
plications by reifying software designs and pattern languages that have proven effective in
particular application domains. This chapter illustrates what frameworks are and compares
them with other popular software development techniques, such as class libraries, compo-
nents, patterns, and model-integrated computing. It then illustrates the process of applying
frameworks to networked applications and outlines the ACE frameworks that are the fo-
cus of this book. These frameworks are based on a pattern language [POSA1, POSA2]
that has been applied to thousands of production networked applications and middleware
worldwide.

1.1 An Overview of Object-Oriented Frameworks


Even as computing power and network bandwidth increase dramatically, the development
of networked application software remains expensive, time consuming, and error prone.
The cost and effort stems from the growing demands placed on networked software, as
well as the continual rediscovery and reinvention of core software design and implemen-
tation artifacts throughout the software industry. Moreover, the heterogeneity of hardware
architectures, diversity of OS and network platforms, and stiff global competition makes it
increasingly hard to build high-quality networked application software from scratch.
The key to building high-quality networked software in a time-to-market-driven envi-
ronment is the ability to reuse successful software designs and implementations that have
already been developed. Reuse has been a popular topic of debate and discussion for over
30 years in the software community [McI68]. There are two general types of reuse:

1
2 CHAPTER 1 Object-Oriented Frameworks for Network Programming

• Opportunistic reuse, in which developers cut and paste code from existing programs
to create new ones. Opportunistic reuse works in a limited way for individual pro-
grammers or small groups. It doesn’t scale up across business units or enterprises,
however, and therefore doesn’t significantly reduce development cycle time and cost
or improve software quality. Worse, opportunistic reuse can actually impede devel-
opment progress since cut-and-paste code often begins to diverge as it proliferates,
forcing developers to fix the same bugs multiple times in multiple places.
• Systematic reuse, which is an intentional and concerted effort to create and apply
multiuse software architectures, patterns, frameworks, and components throughout
a product line [CN02]. In a well-honed systematic reuse process, each new project
leverages time-proven designs and implementations, only adding new code that’s spe-
cific to a particular application. This type of reuse is essential to increase software
productivity and quality by breaking the costly cycle of rediscovering, reinventing,
and revalidating common software artifacts.
Middleware [SS02] is a class of software that can increase systematic reuse levels
significantly by functionally bridging the gap between the end-to-end functional require-
ments of networked applications and the underlying operating systems and network pro-
tocol stacks. Middleware provides capabilities that are critical to networked applications
because they automate common network programming tasks. Developers who use mid-
dleware can therefore program their networked applications more like stand-alone applica-
tions, rather than wrestling with the many tedious and error-prone details associated with
low-level OS event demultiplexing, message buffering and queueing, marshaling and de-
marshaling, and connection management mechanisms. Popular examples of middleware
include Java virtual machines (JVMs), Enterprise JavaBeans (EJB), .NET, the Common
Object Request Broker Architecture (CORBA), and the ADAPTIVE Communication Envi-
ronment (ACE).
Systematically developing high-quality, reusable middleware for networked applica-
tions presents many hard technical challenges, including
• Detecting and recovering from transient and partial failures of networks and hosts in
an application-independent manner
• Minimizing the impact of latency and jitter on end-to-end application performance
• Determining how to partition a distributed application into separate component ser-
vices
• Deciding where and when to distribute and load balance services in a network
Since reusable middleware is inherently abstract, it’s hard to validate its quality and to man-
age its production. Moreover, the skills required to develop, deploy, and support reusable
networked application middleware have traditionally been a “black art,” locked in the heads
of expert developers and architects. These technical impediments to systematic reuse are of-
ten exacerbated by a myriad of nontechnical impediments [Hol97], such as organizational,
Section 1.1 An Overview of Object-Oriented Frameworks 3

economic, administrative, political, sociological, and psychological factors. It’s therefore


not surprising that significant levels of software reuse have been slow to materialize in many
projects and organizations [Sch00].
While it’s never easy to make reuse work universally, we’ve led the development of
powerful host infrastructure middleware called ACE that’s designed specifically with sys-
tematic reuse in mind. During the past decade, we’ve written hundreds of thousands of
lines of C++ code while developing and applying ACE to networked applications as part
of our work with dozens of telecommunication, aerospace, medical, and financial services
companies. As a result of our experience, we’ve documented many patterns and pattern
languages [POSA2, POS00] that have guided the design of reuseable middleware and ap-
plications. In addition, we’ve taught hundreds of tutorials and courses on reuse, middle-
ware, and patterns to thousands of developers and students. Despite the many technical
and nontechnical challenges, we’ve identified a solid body of work that combines advanced
research, time-proven design knowledge, hands-on experience, and software artifacts that
can significantly enhance the systematic reuse of networked application software.
At the heart of this body of work are object-oriented frameworks [FJS99b, FJS99a],
which are a powerful technology for achieving systematic reuse of networked application
software.1 Below, we describe the three characteristics of frameworks [JF88] that help them
to achieve the important networked application qualities listed on page xi. Figure 1.1 (page
4) illustrates how these characteristics work together.
A framework provides an integrated set of domain-specific structures and function-
ality. Systematic reuse of software depends largely on how well frameworks model the
commonalities and variabilities [CHW98] in application domains, such as business data
processing, telecom call processing, graphical user interfaces, or distributed object com-
puting middleware. Since frameworks reify the key roles and relationships of classes in
application domains, the amount of reusable code increases and the amount of code rewrit-
ten for each application decreases.
A framework exhibits “inversion of control” at run time via callbacks. A callback
is an object registered with a dispatcher that calls back to a method on the object when
a particular event occurs, such as a connection request or data arriving on a socket han-
dle. Inversion of control decouples the canonical detection, demultiplexing, and dispatch-
ing steps within a framework from the application-defined event handlers managed by the
framework. When events occur, the framework calls back to virtual hook methods in the
registered event handlers, which then perform application-defined processing in response
to the events.
Since frameworks exhibit inversion of control, they can simplify application design be-
cause the framework—rather than the application—runs the event loop to detect events, de-
multiplex events to event handlers, and dispatch hook methods on the handlers that process
1
In the remainder of this book we use the term framework to mean object-oriented framework.
4 CHAPTER 1 Object-Oriented Frameworks for Network Programming

Networking Event
loop

Callbacks GUI

Application- Domain-specific
specific Callbacks framework
functionality capabilities
Event
loop
Callbacks

Event
Database
loop

Figure 1.1: Synergy of Framework Capabilities

the events. The use of virtual hook methods in the handler classes decouples the applica-
tion’s classes from the framework, allowing each to be changed independently as long as
the interface signature and interaction protocols aren’t modified.
A framework is a “semi-complete” application that programmers can customize to form
complete applications by inheriting from and instantiating classes in the framework. Inheri-
tance enables the features of framework base classes to be shared selectively by subclasses.
If a base class provides default implementations of its methods, application developers need
only override those virtual methods whose default behavior doesn’t meet their needs.
Since a framework is a semi-complete application, it enables larger-scale reuse of soft-
ware than can be achieved by reusing individual classes or stand-alone functions. The
amount of reuse increases due to a framework’s ability to integrate application-defined and
application-independent classes. In particular, a framework abstracts the canonical control
flow of applications in a domain into families of related classes, which can collaborate to
integrate customizable application-independent code with customized application-defined
code.

1.2 Comparing Software Development and Reuse Techniques


Object-oriented frameworks don’t exist in isolation. Class libraries, components, patterns,
and model-integrated computing are other techniques that are being applied to reuse soft-
ware and increase productivity. This section compares frameworks with these techniques
to illustrate their similarities and differences, as well as to show how the techniques can be
combined to enhance systematic reuse for networked applications.
Section 1.2 Comparing Software Development and Reuse Techniques 5

Local
Application- invocations Math Event
Networking
specific classes loop
functionality
ADT Callbacks GUI
classes

Application-specific
Database
event handler Callbacks
classes
functionality
Event
GUI loop
classes Callbacks

Glue
Event Network Event
code Database
loop IPC classes loop

(1) Class library architecture (2) Framework architecture

Figure 1.2: Class Library versus Framework Architectures

1.2.1 Comparing Frameworks and Class Libraries


A class is a general-purpose, reusable building block that specifies an interface and en-
capsulates the representation of its internal data and the functionality of its instances. A
library of classes was the most common first-generation object-oriented development tech-
nique [Mey97]. Class libraries generally support reuse-in-the-small more effectively than
function libraries since classes emphasize the cohesion of data and methods that operate on
the data.
Although class libraries are often domain independent and can be applied widely, their
effective scope of reuse is limited because they don’t capture the canonical control flow,
collaboration, and variability among families of related software artifacts. The total amount
of reuse with class libraries is therefore relatively small, compared with the amount of
application-defined code that must be rewritten for each application. The need to reinvent
and reimplement the overall software architecture and much of the control logic for each
new application is a prime source of cost and delay for many software projects.
The C++ standard library [Bja00] is a good case in point. It provides classes for strings,
vectors, and other containers. Although these classes can be reused in many application
domains, they are relatively low level. Application developers are therefore responsible for
(re)writing much of the “glue code” that performs the bulk of the application control flow
and class integration logic, as shown in Figure 1.2 (1).
Frameworks are a second-generation development technique [Joh97] that extends the
benefits of class libraries in several ways. Most importantly, classes in a framework collab-
orate to provide a reusable architecture for a family of related applications. Class collab-
oration in a framework yields “semi-complete” applications that embody domain-specific
object structures and functionality. Frameworks can be classified by various means, such as
the blackbox and whitebox distinctions described in Sidebar 1 (page 6).
6 CHAPTER 1 Object-Oriented Frameworks for Network Programming

Sidebar 1: Overview of Whitebox and Blackbox Frameworks

Frameworks can be classified in terms of the techniques used to extend them, which
range along a continuum from whitebox frameworks to blackbox frameworks [HJE95],
as described below:
• Whitebox frameworks. Extensibility is achieved in a whitebox framework via
object-oriented language features, such as inheritance and dynamic binding.
Existing functionality can be reused and customized by inheriting from frame-
work base classes and overriding predefined hook methods [Pre95] using pat-
terns such as Template Method [GoF], which defines an algorithm with some
steps supplied by a derived class. To extend a whitebox framework, application
developers must have some knowledge of its internal structure.
• Blackbox frameworks. Extensibility is achieved in a blackbox framework by
defining interfaces that allow objects to be plugged into the framework via
composition and delegation. Existing functionality can be reused by defin-
ing classes that conform to a particular interface and then integrating these
classes into the framework using patterns such as Function Object [Kuh97],
Bridge/Strategy [GoF], and Pluggable Factory [Vli98b, Vli99, Cul99], which pro-
vide a blackbox abstraction for selecting one of many implementations. Black-
box frameworks can be easier to use than whitebox frameworks since appli-
cation developers need less knowledge of the framework’s internal structure.
Blackbox frameworks can also be harder to design, however, since framework
developers must define crisp interfaces that anticipate a range of use cases.

Another way that class libraries differ from frameworks is that the classes in a library
are typically passive since they perform their processing by borrowing the thread from so-
called self-directed applications that invoke their methods. As a result, developers must
continually rewrite much of the control logic needed to bind the reusable classes together to
form complete networked applications. In contrast, frameworks are active since they direct
the flow of control within an application via various callback-driven event handling patterns,
such as Reactor [POSA2] and Observer [GoF]. These patterns invert the application’s flow
of control using the Hollywood Principle: “Don’t call us, we’ll call you” [Vli98a]. Since
frameworks are active and manage the application’s control flow, they can perform a broader
range of activities on behalf of applications than is possible with passive class libraries.
Frameworks and class libraries are complementary technologies in practice. Frame-
works provide a foundational structure to applications. Since frameworks are focused on a
specific domain, however, they aren’t expected to satisfy the broadest range of application
development needs. Class libraries are therefore often used in conjunction within frame-
works and applications to implement commonly needed code artifacts, such as strings, files,
and time/date classes.
Section 1.2 Comparing Software Development and Reuse Techniques 7

Deployment and
configuration
metadata

Trading Logging
Deployment and component component
configuration
mechanism
Containers Containers

Application server

Figure 1.3: A Component Architecture

For example, the ACE frameworks use the ACE wrapper facade classes to ensure their
portability. Likewise, applications can use the ACE container classes described in [HJS]
to help implement their event handlers. Whereas the ACE container classes and wrapper
facades are passive, the ACE frameworks are active and provide inversion of control at run
time. The ACE toolkit provides both frameworks and a library of classes to help program-
mers address a range of challenges that arise when developing networked applications.

1.2.2 Comparing Frameworks and Components


A component is an encapsulated part of a software system that implements a specific ser-
vice or set of services. A component has one or more interfaces that provide access to its
services. Components serve as building blocks for the structure of an application and can
be reused based solely upon knowledge of their interface protocols.
Components are a third-generation development technique [Szy98] that are widely used
by developers of multitier enterprise applications. Common examples of components in-
clude ActiveX controls [Egr98] and COM objects [Box98], .NET web services [TL01], En-
terprise JavaBeans [MH01], and the CORBA Component Model (CCM) [Obj01a]. Com-
ponents can be plugged together or scripted to form complete applications, as shown in
Figure 1.3.
Figure 1.3 also shows how a component implements the business application logic in
the context of a container. A container allows its component to access resources and ser-
vices provided by an underlying middleware platform. In addition, this figure shows how
generic application servers can be used to instantiate and manage containers and execute
the components configured into them. Metadata associated with components provide in-
structions that application servers use to configure and connect components.
8 CHAPTER 1 Object-Oriented Frameworks for Network Programming

Many interdependent components in enterprise applications can reside in multiple—


possibly distributed—application servers. Each application server consists of some number
of components that implement certain services for clients. These components in turn may
include other collocated or remote services. In general, components help developers reduce
their initial software development effort by integrating custom application components with
reusable off-the-shelf components into generic application server frameworks. Moreover, as
the requirements of applications change, components can help make it easier to migrate and
redistribute certain services to adapt to new environments, while preserving key application
properties, such as security and availability.
Components are generally less lexically and spatially coupled than frameworks. For
example, applications can reuse components without having to subclass them from existing
base classes. In addition, by applying common patterns, such as Proxy [GoF] and Bro-
ker [POSA1], components can be distributed to servers throughout a network and accessed
by clients remotely. Modern application servers, such as JBoss and BEA Systems’s Web-
Logic Server, use these types of patterns to facilitate an application’s use of components.
The relationship between frameworks and components is highly synergistic, with nei-
ther subordinate to the other [Joh97]. For example, the ACE frameworks can be used to de-
velop higher-level application components, whose interfaces then provide a facade [GoF]
for the internal class structure of the frameworks. Likewise, components can be used as
pluggable strategies in blackbox frameworks [HJE95]. Frameworks are often used to sim-
plify the development of middleware component models [TL01, MH01, Obj01a], whereas
components are often used to simplify the development and configuration of networked
application software.

1.2.3 Comparing Frameworks and Patterns


Developers of networked applications must address design challenges related to complex
topics, such as connection management, service initialization, distribution, concurrency
control, flow control, error handling, event loop integration, and dependability. Since these
challenges are often independent of specific application requirements, developers can re-
solve them by applying the following types of patterns [POSA1]:
• Design patterns provide a scheme for refining the elements of a software system and
the relationships between them, and describe a common structure of communicating
elements that solves a general design problem within a particular context.
• Architectural patterns express the fundamental, overall structural organization of
software systems and provide a set of predefined subsystems, specify their responsi-
bilities, and include guidelines for organizing the relationships between them.
• Pattern languages define a vocabulary for talking about software development prob-
lems and provide a process for the orderly resolution of these problems.
Section 1.2 Comparing Software Development and Reuse Techniques 9

Traditionally, patterns and pattern languages have been locked in the heads of expert
developers or buried deep within the source code of software applications and systems.
Allowing this valuable information to reside only in these locations is risky and expensive.
Explicitly capturing and documenting patterns for networked applications helps to
• Preserve important design information for programmers who enhance and main-
tain existing software. This information will be lost if it isn’t documented, which can
increase software entropy and decrease software maintainability and quality.
• Guide design choices for developers who are building new applications. Since pat-
terns document the common traps and pitfalls in their domain, they help developers
to select suitable architectures, protocols, algorithms, and platform features without
wasting time and effort (re)implementing solutions that are known to be inefficient
or error prone.

Knowledge of patterns and pattern languages helps to reduce development effort and
maintenance costs. Reuse of patterns alone, however, does not create flexible and effi-
cient software. Although patterns enable reuse of abstract design and architecture knowl-
edge, software abstractions documented as patterns don’t directly yield reusable code. It’s
therefore essential to augment the study of patterns with the creation and use of frame-
works. Frameworks help developers avoid costly reinvention of standard software artifacts
by reifying common patterns and pattern languages and by refactoring common implemen-
tation roles.
ACE users can write networked applications quickly because the frameworks in ACE
implement the core patterns associated with service access, event handling, concurrency,
and synchronization [POSA2]. This knowledge transfer makes ACE more accessible and
directly applicable compared to many other common knowledge transfer activities, such as
seminars, conferences, or design and code reviews. Although these other activities are use-
ful, they are limited because participants must learn from past work of others, and then try
to apply it to their current and future projects. In comparison, ACE provides direct knowl-
edge transfer by embodying framework usage patterns in a powerful toolkit containing both
networked application domain experience and working code.
For example, JAWS [HS99] is a high-performance, open-source, adaptive Web server
built using the ACE frameworks. Figure 1.4 (page 10) illustrates how the JAWS Web server
is structured as a set of collaborating frameworks whose design is guided by the patterns
listed along the borders of the figure. These patterns help resolve common design challenges
that arise when developing concurrent servers, including encapsulating low-level operating
system APIs, decoupling event demultiplexing and connection management from protocol
processing, scaling up server performance via multithreading, minimizing server threading
overhead, using asynchronous I/O effectively, and enhancing server configurability. More
information on the patterns and design of JAWS appears in Chapter 1 of POSA2.
10 CHAPTER 1 Object-Oriented Frameworks for Network Programming

Reactor/Proactor Strategy Singleton


I/O strategy Cached virtual

State
Memento
framework filesystem

Asynchronous completion token Tilde ~


expander

Component configurator
/home/...
Protocol
Event dispatcher

Acceptor
handler

Protocol
filter

Pipes and filters


Adapter

Concurrency

State
Protocol pipeline strategy
framework framework

Component configurator Active object Strategy

Figure 1.4: Patterns Forming the Architecture of JAWS

1.2.4 Comparing Frameworks and Model-Integrated Computing


Model-integrated computing (MIC) [SK97] is an emerging development paradigm that
uses domain-specific modeling languages to systematically engineer software ranging from
small-scale real-time embedded systems to large-scale enterprise applications. MIC devel-
opment environments include domain-specific model analysis and model-based program
synthesis tools. MIC models can capture the essence of a class of applications, as well as
focus on a single, custom application. MIC also allows the modeling languages and en-
vironments themselves to be modeled by so-called meta-models [SKLN01], which help to
synthesize domain-specific modeling languages that can capture subtle insights about the
domains they are designed to model, making this knowledge available for reuse.
Popular examples of MIC being used today include the Generic Modeling Environment
(GME) [LBM+ 01] and Ptolemy [BHLM94] (which are used primarily in the real-time and
embedded domain) and UML/XML tools based on the OMG Model Driven Architecture
(MDA) [Obj01b] (which are used primarily in the business domain thus far). When imple-
mented properly, these MIC technologies help to

• Free application developers from dependencies on particular software APIs, which


ensures that the models can be reused for a long time, even as existing software APIs
are obsoleted by newer ones.
Section 1.2 Comparing Software Development and Reuse Techniques 11

Integrated
model

Model Platform-
interpreter Executable specific Application
and code specifications code code
synthesizer Integrate and Synthesize
generator
generate

System
constraints

Figure 1.5: Steps in the Model-Integrated Computing Development Process

• Provide correctness proofs for various algorithms by analyzing the models automati-
cally and offering refinements to satisfy various constraints.
• Generate code that’s highly dependable and robust since the modeling tools them-
selves can be synthesized from meta-models using provably correct technologies.
• Rapidly prototype new concepts and applications that can be modeled quickly using
this paradigm, compared to the effort required to prototype them manually.
• Reuse domain-specific modeling insights, saving significant amounts of time and
effort, while also reducing application time-to-market and improving consistency and
quality.
As shown in Figure 1.5, the MIC development process uses a set of tools to analyze
the interdependent features of the application captured in a model and determine the feasi-
bility of supporting different QoS requirements in the context of the specified constraints.
Another set of tools then translates models into executable specifications that capture the
platform behavior, constraints, and interactions with the environment. These executable
specifications in turn can be used to synthesize application software.
Earlier efforts at model-based development and code synthesis attempted by CASE
tools generally failed to deliver on their potential for the following reasons [All02]:
• They attempted to generate entire applications, including the infrastructure and the
application logic, which led to inefficient, bloated code that was hard to optimize,
validate, evolve, or integrate with existing code.
• Due to the lack of sophisticated domain-specific languages and associated modeling
tools, it was hard to achieve round-trip engineering, that is, moving back and forth
seamlessly between model representations and the synthesized code.
• Since CASE tools and early modeling languages dealt primarily with a restricted
set of platforms (such as mainframes) and legacy programming languages (such as
COBOL), they did not adapt well to the distributed computing paradigm that arose
12 CHAPTER 1 Object-Oriented Frameworks for Network Programming

from advances in PC and Internet technology and newer object-oriented program-


ming languages, such as Java, C++, and C#.

Many of the limitations with model-integrated computing outlined above can be over-
come by integrating MIC tools and processes with object-oriented frameworks [GSNW02].
This integration helps to overcome problems with earlier-generation CASE tools since it
does not require the modeling tools to generate all the code. Instead, large portions of ap-
plications can be composed from reusable, prevalidated framework classes. Likewise, inte-
grating MIC with frameworks helps address environments where application requirements
and functionality change at a rapid pace by synthesizing and assembling newer extended
framework classes and automating the configuration of many QoS-critical aspects, such as
concurrency, distribution, transactions, security, and dependability.
The combination of model-integrated computing with frameworks, components, and
patterns is an area of active research [Bay02]. In the DOC group, for example, there are
R&D efforts underway to develop a MIC tool suite called the Component Synthesis with
Model-Integrated Computing (CoSMIC) [GSNW02]. CoSMIC extends the popular GME
modeling and synthesis tools [LBM+ 01] and the ACE ORB (TAO) [SLM98] to support
the development, assembly, and deployment of QoS-enabled networked applications. To
ensure the QoS requirements can be realized in the middleware layer, CoSMIC’s model-
integrated computing tools can specify and analyze the QoS requirements of application
components in their accompanying metadata.

1.3 Applying Frameworks to Network Programming


One reason why it’s hard to write robust, extensible, and efficient networked applications is
that developers must master many complex networking programming concepts and mecha-
nisms, including
• Network addressing and service identification/discovery
• Presentation layer conversions, such as marshaling, demarshaling, and encryption, to
handle heterogeneous hosts with alternative processor byte orderings
• Local and remote interprocess communication (IPC) mechanisms
• Event demultiplexing and event handler dispatching
• Process/thread lifetime management and synchronization
Application programming interfaces (APIs) and tools have evolved over the years to sim-
plify the development of networked applications and middleware. Figure 1.6 illustrates the
IPC APIs available on OS platforms ranging from UNIX to many real-time operating sys-
tems. This figure shows how applications can access networking APIs for local and remote
IPC at several levels of abstraction. We briefly discuss each level of abstraction below,
starting from the lower-level kernel APIs to the native OS user-level networking APIs and
the host infrastructure middleware.
Section 1.3 Applying Frameworks to Network Programming 13

HI
HOST INFRASTRUCTURE MIDDLEWARE
SOCKETS & TLI
LEVEL OF USER
open()/close()/putmsg()/getmsg() SPACE
ABSTRACTION

TPI
STREAMS NPI
KERNEL
SPACE
LO FRAMEWORK DLPI
Figure 1.6: Levels of Abstraction for Network Programming

Kernel-level networking APIs. Lower-level networking APIs are available in an OS ker-


nel’s I/O subsystem. For example, the UNIX putmsg() and getmsg() system func-
tions can be used to access the Transport Provider Interface (TPI) [OSI92b] and the Data
Link Provider Interface (DLPI) [OSI92a] available in System V STREAMS [Rit84]. It’s
also possible to develop network services, such as routers [KMC+ 00], network file sys-
tems [WLS+ 85], or even Web servers [JKN+ 01], that reside entirely within an OS kernel.
Programming directly to kernel-level networking APIs is rarely portable between dif-
ferent OS platforms, however. It’s often not even portable across different versions of the
same OS! Since kernel-level programming isn’t used in most networked applications, we
don’t cover it any further in this book. See [Rag93], [SW95, MBKQ96], and [SR00] for
coverage of these topics in the context of System V UNIX, BSD UNIX, and Windows 2000,
respectively.
User-level networking APIs. Networking protocol stacks in modern commercial oper-
ating systems reside within the protected address space of the OS kernel. Applications
running in user space access protocol stacks in the OS kernel via IPC APIs, such as the
Socket or TLI APIs. These APIs collaborate with an OS kernel to provide the capabilities
shown in the following table:

Capability Description
Local endpoint Create and destroy local communication endpoints, allowing ac-
management cess to available networking facilities.
Connection establishment Enable applications to establish connections actively or passively
and connection with remote peers and to shutdown all or part of the connections
termination when transmissions are complete.
Options management Negotiate and enable/disable protocol and endpoint options.
Data transfer mechanisms Exchange data with peer applications.
Name/address translation Convert human-readable names to low-level network addresses
and vice versa.

These capabilities are covered in Chapter 2 of C++NPv1 in the context of the Socket API.
14 CHAPTER 1 Object-Oriented Frameworks for Network Programming

Many IPC APIs are modeled loosely on the UNIX file I/O API, which defines the
open(), read(), write(), close(), ioctl(), lseek(), and select() func-
tions [Rit84]. Due to syntactic and semantic differences between file I/O and network I/O,
however, networking APIs provide additional functionality that’s not supported directly by
the standard UNIX file I/O APIs. For example, the pathnames used to identify files on a
UNIX system aren’t globally unique across hosts in a heterogeneous distributed environ-
ment. Different naming schemes, such as IP host addresses and TCP / UDP port numbers,
have therefore been devised to uniquely identify communication endpoints used by net-
worked applications.
Host infrastructure middleware frameworks. Many networked applications exchange
messages using synchronous and/or asynchronous request/response protocols in conjunc-
tion with host infrastructure middleware frameworks. Host infrastructure middleware en-
capsulates OS concurrency and IPC mechanisms to automate many low-level aspects of
networked application development, including
• Connection management and event handler initialization
• Event detection, demultiplexing, and event handler dispatching
• Message framing atop bytestream protocols, such as TCP
• Presentation conversion issues involving network byte ordering and parameter mar-
shaling and demarshaling
• Concurrency models and synchronization of concurrent operations
• Networked application composition from dynamically configured services
• Hierarchical structuring of layered networked applications and services
• Management of quality of service (QoS) properties, such as scheduling access to
processors, networks, and memory
The increasing availability and popularity of high-quality and affordable host infrastructure
middleware is helping to raise the level of abstraction at which developers of networked
applications can work effectively. For example, [C++NPv1, SS02] present an overview of
higher-level distributed object computing middleware, such as CORBA [Obj02] and The
ACE ORB (TAO) [SLM98], which is an implementation of CORBA built using the frame-
works and classes in ACE. It’s still useful, however, to understand how lower level IPC
mechanisms work to fully comprehend the challenges that arise when designing, porting,
and optimizing networked applications.

1.4 A Tour through the ACE Frameworks


1.4.1 An Overview of ACE
ACE is a highly portable, widely used, open-source host infrastructure middleware toolkit.
The source code is freely available from http://ace.ece.uci.edu/ or http://
Section 1.4 A Tour through the ACE Frameworks 15

NETWORKED
JAWS ADAPTIVE
SERVICE WEB SERVER
COMPONENTS STANDARDS-BASED MIDDLEWARE
LAYER THE ACE ORB
(TAO)
TOKEN GATEWAY
SERVER SERVER

LOGGING NAME TIME


SERVER SERVER SERVER

FRAMEWORK SERVICE CORBA


LAYER HANDLER ACCEPTOR CONNECTOR
HANDLER

C++ PROCESS/
STREAMS LOG
WRAPPER THREAD
SERVICE
SHARED
MALLOC
MANAGERS MSG
FACADE REACTOR/
CONFIGU-
RATOR
LAYER SYNCH SPIPE SOCK SAP/ FIFO PROACTOR MEM FILE
WRAPPERS SAP TLI SAP SAP MAP SAP

OS ADAPTATION LAYER
C
PROCESSES/
WIN32 NAMED
SOCKETS/ UNIX SELECT/ DYNAMIC SHARED FILE SYS
APIs THREADS
PIPES & UNIX
TLI FIFOS IO COMP LINKING MEMORY APIS
STREAM PIPES

PROCESS/THREAD COMMUNICATION VIRTUAL MEMORY & FILE


SUBSYSTEM SUBSYSTEM SUBSYSTEM
GENERAL OPERATING SYSTEM SERVICES

Figure 1.7: The Layered Architecture of ACE

www.riverace.com/. The core ACE library contains roughly a quarter million lines
of C++ code that comprises approximately 500 classes. Many of these classes cooperate to
form ACE’s major frameworks. The ACE toolkit also includes higher-level components, as
well as a large set of examples and an extensive automated regression test suite.
To separate concerns, reduce complexity, and permit functional subsetting, ACE is de-
signed using a layered architecture [POSA1], shown in Figure 1.7. The capabilities pro-
vided by ACE span the session, presentation, and application layers in the OSI reference
model [Bla91]. The foundation of the ACE toolkit is its combination of an OS adaptation
layer and C++ wrapper facades, which together encapsulate core OS network programming
mechanisms to run portably on all the OS platforms shown in Sidebar 2 (page 16). The
higher layers of ACE build on this foundation to provide reusable frameworks, networked
service components, and standards-based middleware.

1.4.2 A Synopsis of the ACE Frameworks


The ACE frameworks are an integrated set of classes that can be instantiated and customized
to provide complete networked applications and service components. These frameworks
help to transfer decades of accumulated knowledge directly from the ACE developers to
16 CHAPTER 1 Object-Oriented Frameworks for Network Programming

Acceptor-
Reactor Proactor
Connector

Service
Streams Task
Configurator

Figure 1.8: The Key Frameworks in ACE

Sidebar 2: OS Platforms Supported by ACE

ACE runs on a wide range of operating systems, including:


• PCs, for example, Windows (32- and 64-bit versions), WinCE, and Macintosh
OS X
• Most versions of UNIX, for example, SunOS/Solaris, IRIX, HP-UX, Tru64
UNIX (Digital UNIX), AIX, DG/UX, Linux (Redhat, Debian, and SuSE), SCO
OpenServer, UnixWare, NetBSD, and FreeBSD
• Real-time operating systems, for example, VxWorks, ChorusOS, LynxOS, Phar-
lap TNT, QNX Neutrino and RTP, RTEMS, and pSoS
• Large enterprise systems, for example, OpenVMS, MVS OpenEdition, Tandem
NonStop-UX, and Cray UNICOS.
ACE can be used with all of the major C++ compilers on these platforms. The ACE
Web site at http://ace.ece.uci.edu contains a complete, up-to-date list of plat-
forms, along with instructions for downloading and building ACE.

ACE users in the form of expertise embodied in well-tested and reusable C++ software
artifacts. The ACE frameworks implement a pattern language for programming concurrent
object-oriented networked applications. Figure 1.8 illustrates the ACE frameworks. To
illustrate how the ACE frameworks rely on and use each other, the lines between boxes
represent a dependency in the direction of the arrow. Each framework is outlined below.
ACE Reactor and Proactor frameworks. These frameworks implement the Reactor and
Proactor patterns [POSA2], respectively. Both are architectural patterns that allow appli-
cations to be driven by events that are delivered to the application from one or more event
sources, the most important of which are I/O endpoints. The Reactor framework facilitates
a reactive I/O model, with events signaling the ability to begin a synchronous I/O opera-
tion. The Proactor framework is designed for a proactive I/O model where one or more
asynchronous I/O operations are initiated and the completion of each operation triggers an
event. Proactive I/O models can achieve the performance benefits of concurrency without
incurring many of its liabilities. The Reactor and Proactor frameworks automate the detec-
tion, demultiplexing, and dispatching of application-defined handlers in response to many
Section 1.4 A Tour through the ACE Frameworks 17

types of events. Chapters 3 and 4 describe the ACE Reactor framework and Chapter 8
describes the ACE Proactor framework.

ACE Service Configurator framework. This framework implements the Component


Configurator pattern [POSA2], which is a design pattern that allows an application to link
and unlink its component implementations without having to modify, recompile, or relink
the application statically. The ACE Service Configurator framework supports the config-
uration of applications whose services can be assembled late in the design cycle, such as
at installation time and/or run time. Applications with high availability requirements, such
as mission-critical systems that perform online transaction processing or real-time indus-
trial process automation, often require such flexible configuration capabilities. Chapter 2
describes the design dimensions associated with configuring networked services and Chap-
ter 5 describes the ACE Service Configurator framework.

ACE Task framework. This framework implements various concurrency patterns, such
as Active Object and Half-Sync/Half-Async [POSA2]. Active Object is a design pattern
that decouples the thread that executes a method from the thread that invoked it. Its purpose
is to enhance concurrency and simplify synchronized access to objects that reside in their
own threads of control. Half-Sync/Half-Async is an architectural pattern that decouples
asynchronous and synchronous processing in concurrent systems, to simplify programming
without reducing performance unduly. This pattern incorporates two intercommunicating
layers, one for asynchronous and one for synchronous service processing. A queueing
layer mediates communication between services in the asynchronous and synchronous lay-
ers. Chapter 5 of C++NPv1 describes the design dimensions associated with concurrent
networked applications and Chapter 6 of this book describes the ACE Task framework.

ACE Acceptor-Connector framework. This framework leverages the Reactor frame-


work and reifies the Acceptor-Connector pattern [POSA2]. This design pattern decou-
ples the connection and initialization of cooperating peer services in a networked system
from the processing they perform once connected and initialized. The Acceptor-Connector
framework decouples the active and passive initialization roles from application-defined
service processing performed by communicating peer services after initialization is com-
plete. Chapter 7 describes this framework.

ACE Streams framework. This framework implements the Pipes and Filters pattern,
which is an architectural pattern that provides a structure for systems that process a stream
of data [POSA1]. The ACE Streams framework simplifies the development and compo-
sition of hierarchically layered services, such as user-level protocol stacks and network
management agents [SS94]. Chapter 9 describes this framework.
When used together, the ACE frameworks outlined above enable the development of
networked applications that can be updated and extended without the need to modify, re-
18 CHAPTER 1 Object-Oriented Frameworks for Network Programming

ACE task Event


loop

ADT Callbacks ACE


classes
streams

Application-specific
Local
event handler Callbacks
invocations
functionality
Event
IPC loop
classes Callbacks

Event
ACE reactor
loop

Figure 1.9: Applying Class Libraries to Develop and Use ACE Frameworks

compile, relink, or restart running applications. ACE achieves this unprecedented flexibility
and extensibility by combining
• OS mechanisms, such as event demultiplexing, IPC, dynamic linking, multithread-
ing, multiprocessing, and synchronization [Ste99]
• C++ language features, such as templates, inheritance, and dynamic binding [Bja00]
• Patterns, such as Component Configurator [POSA2], Strategy [GoF], and Han-
dler/Callback [Ber95]

The ACE frameworks provide inversion of control via callbacks, as shown below:

ACE Framework Inversion of Control


Reactor and Calls back to application-supplied event handlers to perform process-
Proactor ing when events occur synchronously and asynchronously.
Service Configurator Calls back to application-supplied service objects to initialize, suspend,
resume, and finalize them.
Task Calls back to an application-supplied hook method to perform process-
ing in one or more threads of control.
Acceptor-Connector Calls back to service handlers to initialize them after they’re connected.
Streams Calls back to initialize and finalize tasks when they are pushed and
popped from a stream.

The callback methods in ACE’s framework classes are defined as C++ virtual methods.
This use of dynamic binding allows networked applications to freely implement and extend
interface methods without modifying or rebuilding existing framework classes. In contrast,
the ACE wrapper facades rarely use callbacks or virtual methods, so they aren’t as exten-
sible as the ACE frameworks. The ACE wrapper facades do support a broad range of use
Section 1.5 Example: A Networked Logging Service 19

cases, however, and can be integrated together via generic programming [Ale01] techniques
based on the C++ traits and traits classes idioms outlined in Sidebar 40 (page 165).
Figure 1.9 illustrates how the class libraries and frameworks in ACE are complemen-
tary technologies. The ACE toolkit simplifies the implementation of its frameworks via
its class libraries of containers, which include lists, queues, hash tables, strings, and other
reusable data structures. Likewise, application-defined code invoked by event handlers in
the ACE Reactor framework can use the ACE wrapper facades and the C++ standard library
classes [Jos99] to perform IPC, synchronization, file management, and string processing op-
erations. Sidebar 3 describes how to build the ACE library so that you can experiment with
the examples we present in this book.

Sidebar 3: Building ACE and Programs that Use ACE

ACE is open-source software that you can download from http://ace.ece.uci.


edu or http://www.riverace.com and build yourself. These sites contain a
wealth of other material on ACE, such as tutorials, technical papers, and an overview
of other ACE wrapper facades and frameworks that aren’t covered in this book. You
can also purchase a prebuilt version of ACE from Riverace at a nominal cost. See
http://www.riverace.com for a list of the prebuilt compiler and OS platforms
supported by Riverace.
If you want to build ACE yourself, you should download and unpack the ACE dis-
tribution into an empty directory. The top-level directory in the distribution is named
ACE_wrappers. We refer to this top-level directory as “ACE_ROOT.” You should cre-
ate an environment variable by that name containing the full path to the top-level ACE
directory. The ACE source and header files reside in $ACE_ROOT/ace.
The $ACE_ROOT/ACE-INSTALL.html file has complete instructions for building
ACE, including how to configure it for your OS and compiler. This book’s networked
logging service example source and header files reside in $ACE_ROOT/examples/
C++NPv2 and are ready to build on all platforms that ACE supports. To build your
own programs, the $ACE_ROOT directory must be added to your compiler’s file include
path. For command-line compilers, this can be done with the -I or /I compiler option.
Graphical IDEs provide similar options, such as MSVC++’s “Preprocessor, Additional
include directories” section of the C/C++ tab on the Project Settings dialog box.

1.5 Example: A Networked Logging Service


It’s been our experience that the principles, methods, and skills required to develop and
use reusable networked application software cannot be learned solely by generalities or
toy examples. Instead, programmers must learn concrete technical skills and gain hands-
on experience by developing and using real frameworks and applications. We therefore
20 CHAPTER 1 Object-Oriented Frameworks for Network Programming

illustrate key points and ACE capabilities throughout this book by extending and enhancing
the networked logging service example introduced in C++NPv1, which collects and records
diagnostic information sent from one or more client applications.
The logging service in C++NPv1 used many of ACE’s wrapper facades in a two-tier
client/server architecture. This book’s logging service examples use a more powerful archi-
tecture that illustrates a broader complement of capabilities and patterns, and demonstrates
how ACE’s frameworks can help achieve efficient, predictable, and scalable networked ap-
plications. This service also helps to demonstrate key design and implementation consider-
ations and solutions that will arise when you develop your own concurrent object-oriented
networked applications.
Figure 1.10 illustrates the application processes and daemons in our networked logging
service, which we outline below.
Client application processes (such as P1 , P2 , and P3 ) run on client hosts and generate log
records ranging from debugging messages to critical error messages. The logging informa-
tion sent by a client application contains the time the log record was created, the process
identifier of the application, the priority level of the log record, and a variable-sized string
containing the log record text message. Client applications send these log records to a client
logging daemon running on their local host.
Client logging daemons run on every host machine participating in the networked logging
service. Each client logging daemon receives log records from that host’s client applications
via some form of local IPC mechanism, such as shared memory, pipes, or sockets. The
client logging daemon uses a remote IPC mechanism, such as TCP / IP, to forward log records
to a server logging daemon running on a designated host.
Server logging daemons collect and output the incoming log records they receive from
client applications via client logging daemons. A server logging daemon 2 can determine
which client host sent each message by using addressing information it obtains from the
underlying Socket API. There’s generally one server logging daemon per system configu-
ration, though they could be replicated to avoid a single point of failure.
Figure 1.11 (page 22) shows the progression of networked application servers that we’ll
develop and use in this book. These client and server logging daemons will illustrate how
to use the ACE frameworks and wrapper facades with the following concurrency models.
Concurrency Model Section
Reactive 3.5, 4.2, 5.4
Thread pool 4.3, 4.4, 6.3
Thread-per-connection 7.2, 7.3
Producer/consumer 6.2, 7.4, 9.2
Proactive 8.2 – 8.5

2
We use the terms server logging daemon and logging server interchangeably throughout this book.
Section 1.6 Summary 21

Oct 31 14:48:13 [email protected]@38491@7@client::unable to fork in function spawn


Oct 31 14:50:28 [email protected]@18352@2@drwho::sending request to server tango

Console
Server logging Storage
Local IPC daemon device
Client TCP connection
P1 logging Tango Mambo
daemon

P2

TCP connection
P3
Printer
Server

Network

Client Client P1
Tango logging
daemon
P2

Local IPC P3
Client Mambo
int spawn (void){
if (ACE_OS::fork()==-1)
ACE_ERROR((LM_ERROR, if (Options::instance()->debug())
"unable to fork in function spawn")); ACE_DEBUG((LM_DEBUG,
"sending request to server%s",
server_host));

Figure 1.10: Processes and Daemons in the Networked Logging Service

1.6 Summary
Networked application software has been developed manually from scratch for decades.
The continual rediscovery and reinvention of core concepts and capabilities associated with
this process has kept the costs of engineering and evolving networked applications too high
for too long. Improving the quality and quantity of systematic software reuse is essential to
resolve this problem.
Middleware is a class of software that’s particularly effective at providing systemati-
cally reusable artifacts for networked applications. Developing and using middleware is
therefore an important way to increase reuse. There are many technical and nontechni-
cal challenges that make middleware development and reuse hard, however. This chapter
described how object-oriented frameworks can be applied to overcome many of these chal-
22 CHAPTER 1 Object-Oriented Frameworks for Network Programming

Reactive
Logging Server
(Chapters 3, 4)

Thread Pool Dynamically Half-Sync/ Thread-per-


Reactive Configured Half-Async Connection
Logging Logging Logging Logging
Server Server Server Server
(Chapter 4) (Chapter 5) (Chapter 6) (Chapter 7)

Acceptor- Producer/
Proactive
Connector Consumer
Client
Client Client
Logging
Logging Logging
Daemon
Daemon Daemon
(Chapter 8)
(Chapter 7) (Chapter 6)

Figure 1.11: Logging Server Examples

lenges. To make the most appropriate choice of software development technologies, we


also described the differences between frameworks and class libraries, components, pat-
terns, and model-integrated computing. Each technology plays a part in reducing software
development costs and life cycles and increasing software quality, functionality, and perfor-
mance.
The result of applying framework development principles and patterns to the domain
of networked applications has yielded the ACE frameworks. These frameworks handle
common network programming tasks and can be customized via C++ language features
to produce complete networked applications. When used together, the ACE frameworks
simplify the creation, composition, configuration, and porting of networked applications
without incurring significant performance overhead. The rest of this book explains how and
why the ACE frameworks were developed and shows many examples of how ACE uses
C++ features to achieve its goals.
An intangible, but valuable, benefit of ACE is its transfer of decades of accumulated
knowledge from ACE framework developers to ACE framework users in the form of ex-
pertise embodied in well-tested C++ classes that implement time-proven networked appli-
cation software development strategies. These frameworks took scores of person-years to
develop, optimize, and mature. Fortunately, you can take advantage of the expertise embod-
ied in these frameworks without having to independently rediscover or reinvent the patterns
and classes that underlie them.
C HAPTER 2

Service and Configuration Design


Dimensions

C HAPTER S YNOPSIS
A service is a set of functionality offered to a client by a server. Common services available
on the Internet today include

• Web content retrieval services, such as Apache and Google


• Software distribution services, such as Castanet, Citrix, or Softricity
• Electronic mail and network news transfer services
• File access on remote machines
• Network time synchronization
• Payment processing services
• Streaming audio/video services, such as RealPlayer and QuickTime

Networked applications can be created by configuring their constituent services together at


various points of time, such as compile time, static link time, installation time, or run time.
Chapters 1 and 5 of C++NPv1 provided a domain analysis of the communication pro-
tocols and mechanisms and the concurrency architectures used by networked applications.
This chapter expands that coverage to analyze other design dimensions that address key
networked application properties. These properties include service duration and structure,
how networked services are identified, and the time at which they are bound together to form
complete applications. These design dimensions are important in any networked applica-
tion, and of particular importance to the ACE Service Configurator framework (Chapter 5).
If you’re already familiar with these design dimensions, however, you may want to skip
ahead to Chapter 3, which begins the coverage of the ACE frameworks.

23
24 CHAPTER 2 Service and Configuration Design Dimensions

2.1 Service and Server Design Dimensions


When designing networked applications, it’s important to recognize the difference between
a service, which is a capability offered to clients, and a server, which is the mechanism by
which the service is offered. The design decisions regarding services and servers are easily
confused, but should be considered separately. This section covers the following service
and server design dimensions:
• Short- versus long-duration services
• Internal versus external services
• Stateful versus stateless services
• Layered/modular versus monolithic services
• Single- versus multiservice servers
• One-shot versus standing servers

2.1.1 Short-Duration versus Long-Duration Services


The services offered by network servers can be classified as short duration or long duration.
These time durations reflect how long a service holds system resources. The primary trade-
off in this design dimension involves holding system resources when they may be better
used elsewhere versus the overhead of restarting a service when it’s needed. In a networked
application, this dimension is closely related to protocol selection because setup require-
ments for different protocols can vary significantly.
Short-duration services execute in brief, often fixed, amounts of time and usually handle a
single request at a time. Examples of short-duration services include computing the current
time of day, resolving the Ethernet number of an IP address, and retrieving a disk block
from the cache of a network file server. To minimize the amount of time spent setting up a
connection, short-duration services are often implemented using connectionless protocols,
such as UDP / IP [Ste94].
Long-duration services run for extended, often variable, lengths of time and may han-
dle numerous requests during their lifetime. Examples of long-duration services include
transferring large software releases via FTP, downloading MP3 files from a Web server us-
ing HTTP, streaming audio and video from a server using RTSP, accessing host resources
remotely via TELNET, and performing remote file system backups over a network. Ser-
vices that run for longer durations allow more flexibility in protocol selection. For ex-
ample, to improve efficiency and reliability, these services are often implemented with
connection-oriented protocols, such as TCP / IP [Ste94], or session-oriented protocols, such
as RTSP [SRL98] or SCTP [SX01].
Section 2.1 Service and Server Design Dimensions 25

Dispatcher process Dispatcher process

select()
SVC1 SVC2 SVC3

SVC1 SVC2
select()

(1) Internal services (2) External services

Figure 2.1: Internal versus External Services

Logging service ⇒ From the standpoint of an individual log record, our server logging
daemon seems like a short-duration service. Each log record is limited to a maximum length
of 4K bytes, though in practice most are much smaller. The actual time spent handling
a log record is relatively short. Since a client may transmit many log records, however,
we optimize performance by designing client logging daemons to establish connections
with their peer server logging daemons. We then reuse these connections for subsequent
logging requests. It would be wasteful and time consuming to set up and tear down a socket
connection for each logging request, particularly when small requests are sent frequently.
We therefore model our client and server logging daemons as long-duration services.

2.1.2 Internal versus External Services


Services can be classified as internal or external. The primary tradeoffs in this dimension
are service initialization time, isolation of one service from another, and simplicity.
Internal services execute in the same address space as the server that receives the request,
as shown in Figure 2.1 (1). As described in Chapter 5 of C++NPv1, an internal service
can run iteratively, concurrently, or reactively in relation to other internal services. Internal
services usually have low initialization latency and their context switch time is generally
shorter than that of services residing in separate processes.
Internal services may also reduce application robustness, however, since separate ser-
vices within a process aren’t protected from one another. One faulty service can therefore
corrupt data shared with other internal services in the process, which may produce incor-
rect results, crash the process, or cause the process to hang indefinitely. As a result, internal
services should be reserved for code that can be trusted to operate correctly when run in the
context of other services in an application’s address space.
External services execute in different process address spaces. For instance, Figure 2.1 (2)
illustrates a master service process that monitors a set of network ports. When a connection
request arrives from a client, the master accepts the connection and then spawns a new pro-
26 CHAPTER 2 Service and Configuration Design Dimensions

cess to perform the requested service externally. External services may be more robust than
internal services since the failure of one need not cause the failure of another. To increase
robustness, therefore, mission-critical application services are often isolated in separate pro-
cesses. The price for this robustness, however, can be a reduction in performance due to
process management and IPC overhead.
Some server frameworks support both internal and external services. For example, the
INETD superserver [Ste98] is a daemon that listens for connection requests or messages on
certain ports and runs programs to perform the services associated with those ports. System
administrators can choose between internal and external services in INETD by modifying
the inetd.conf configuration file as follows:
• INETD can be configured to execute short-duration services, such as ECHO and DAY-
TIME , internally via calls to statically linked functions in the INETD program.
• INETD can also be configured to run longer-duration services, such as FTP and TEL -
NET , externally by spawning separate processes.

Sidebar 4 (page 31) describes this and other service provisioning mechanisms that use both
internal and external services.
Logging service ⇒ All logging server implementations in this book are designed as inter-
nal services. As long as only one type of service is configured into our logging server, we
needn’t isolate it from harmful side effects of other services. There are valid reasons to pro-
tect the processing of different client sessions from each other, however, particularly if ser-
vices are linked dynamically using the Component Configurator pattern [POSA2]. Chapter
8 in C++NPv1 therefore illustrates how to implement a logging server as an external service
using the ACE_Process and ACE_Process_Manager classes.

2.1.3 Stateful versus Stateless Services


Services can be classified as stateful or stateless. The amount of state, or context, that a
service maintains between requests impacts the complexity and resource consumption of
clients and servers. Stateful and stateless services trade off efficiency for reliability, with
the right choice depending on a variety of factors, such as the probability and impact of host
and network failures.
Stateful services cache certain information, such as session state, authentication keys, iden-
tification numbers, and I/O handles, in a server to reduce communication and computation
overhead. For instance, Web cookies enable a Web server to preserve state across multiple
page requests.
Stateless services retain no volatile state within a server. For example, the Network File
System (NFS) [Ste94] provides distributed data storage and retrieval services that don’t
maintain volatile state information within a server’s address space. Each request sent from
Exploring the Variety of Random
Documents with Different Content
denoting a rise in the tone, the circumflex a rise followed by a fall, i.e., a kind
of drawl. The circumflex can always be pronounced with ease; so can the
acute, when final; so can the great majority of internal accents. It is just as
easy to say ἐλΕΙποντο as ἐλειΠΟΝτο. The only cases of real difficulty are
words like φέρηται, άνθρωπος, where a long vowel follows an accented
syllable. These might be waived for beginners, but these are few compared to
the rest; and even to pronounce the accent and quantity in these is not very
difficult, especially with the reformed pronunciation. This plan has been tried,
and found to work fairly, with young boys from twelve to sixteen.
[11] The grave on finals, when written for acute, is practically the same.

There is a means by which the classical


Value of old English translations.
teacher may be greatly helped, and that is if the
general course of studies in the school be so
arranged, that good English translations of the classics form a fair proportion
of the English authors read. Many of these translations are themselves English
classics, such as Chapman’s and Pope’s Homer, North’s Plutarch, Dryden’s
Virgil and Juvenal. Others there are in plenty, no less excellent than these, if
less known—Phaer’s Virgil, Holland’s versions of Livy, Suetonius, Plutarch’s
Morals, and many other works; Hobbes’ Thucydides, Barnard’s Terence,
Echard’s Plautus—indeed there is hardly a classical author of repute who did
not find a worthy translator in the Elizabethan age. A few of these are
accessible in cheap reprints,[12] and if there were a demand for any of them a
reprint would appear at once. By reading these the children will become
familiar with the subject-matter of classical authors before they have to
translate them; and they will also have made acquaintance with some fine
works of literature, many of which (such as North) are interesting from
association with Shakspere. When Roman or Greek history comes in the
regular historical cycle, some of these books might well be read along with
them.
[12] Messrs. Dent & Co., in the Temple Classics, have brought out Chapman, and intend to
include North and others.

The last thing to be mentioned is the use of models


Models and illustrations.
and illustrations. There is almost no limit to the number
of such things that can be had; the real limit is the
depth of the teacher’s purse. But the schools ought to provide these things for
use; it is too much to expect that teachers should spend their sparings and
savings in educational plant. Any money spent in this way is amply repaid by
the interest added to the work. Classical teachers ought to have at their
disposal lantern slides illustrating classical life and history, wall pictures and
maps, photographs and models. Slides may be hired from the Hellenic Society,
or bought through the Teachers’ Guild;[13] for wall pictures there are two
excellent series, those of Cybulski and Launitz. Of photographs there are
thousands. The wise teacher will travel and collect them; but for those who
will not, one or two addresses of photographers are given below,[14] with the
names of some useful works. The pictures can be kept in the school library,
and hung up for the term when they will be useful. For the photographs,
frames with movable backs are most to be recommended, as the pictures can
then be changed at will. The teacher should talk about them, and question his
class, and (as already suggested) they may form a topic of Latin or Greek
conversation. It is astonishing how much children will learn from these things.
In addition, it is highly desirable that each pupil should have his pictorial
atlases as he has an atlas of geography.
[13] There is a large collection in the Guild Museum, Gower Street, London. Here also
models may be seen.
[14] See p. 93.

The writer has now pointed out what, in his opinion, is the
Recapitulation.
place which Latin and Greek should take in a girl’s education,
and the methods best calculated to teach them. If in these
there is not much that is new, they are at all events such as experience has
proved to be sound. One or two points may be indicated which are apt to be
weak in girl students, and must therefore be specially guarded against. They
are apt to be shaky in grammar, and they seem
Weak points to be strengthened.
to have less mental self-reliance than boys. As
regards those who learn late, they must go over
the same ground; for no teacher and no book, no not if angels wrote it, can
point out a royal road to learning. These late-learners bring to the task a mind
already more or less trained, and so they will get on faster; but let them
beware of trying to get on too fast. They must make up their minds that
grammar has to be learnt, and work at it with a will. If they have already done
half of the drudgery by learning Latin, as here recommended, their task will be
not easy indeed, but not beyond their powers; and even if both Latin and
Greek are begun late, they need not even then despair. I have known several,
both men and women, who have begun late and ended with success, even
with distinction; although it must be admitted that these were persons of
exceptional powers. But it is of the utmost importance that the most capable
teachers should have charge of the late-learners. The greater the difficulty, the
greater need for a teacher who has his subjects at the ends of his fingers, who
can see a short-cut, and is able to judge how much of the preliminary work
can safely be shortened, or even omitted for the time. When skill in the
teacher meets with will in the taught, between them they may remove
mountains.

SUGGESTED SCHEME OF WORK IN SIX PARTS.

LATIN.
Grammar. Composition.
1. Parts of speech and elements: regular 1. Simplest sentences: statement,
nouns and adjectives: est, sunt, and how to question and answer.
form 3rd sing. and pl. pres. indic. first
conjugation, given the infinitive present.
2. Commonest pronouns: present indic. 2. Cases of agent and instrument, time
of sum, and how to form 3rd sing. and pl. and place: quam with nom. and acc., abl. of
of all four conjugations, given the infinitive comparison: a few common prolate verbs:
present. simplest relative sentences and cum
temporal.
3. Pronouns and cardinal numerals: 3. Ablative absolute, and a few more
active of the four conjugations: sum: case usages: accusative with infinitive: use
meanings and case of a few common of se, suus, ipse: double questions:
prepositions. factitives in active, prolate verbs: relative
sentences, with a hint of finals: commands
and prohibitions: causal, concessive and
temporal sentences.
4. Ordinal numerals: passive of the four 4. Quisquam, quisque, quivis, etc.
conjugations: a few common irregular (meaning): chief case usages: factitives:
verbs. common verbs with dative: dependent
questions: accusative with infinitive, tenses
distinguished: simple finals, pos. and
negative: simple consecutives: verbs of
hindering and fearing.
5 and 6. Deponents, impersonals, 5. Utor and other verbs with various
irregular verbs: fill up gaps (add e.g., the cases: all case usages: gerund and
rest of the numerals). gerundive: some impersonal verbs: final
and consecutive sentences: conditions
begun.
6. Quisquam, etc., use and idioms:
participles: nunquam, etc., causal,
concessive, temporal and other
conjunctions: conditions: obliqua.

GREEK.
Grammar. Composition.
1. Regular nouns and adjectives: article: 1. Concords (including that of neuter
εστιν and εισιν: how to form 3rd sing. and plural): article in direct predication: simplest
pl. pres. indic. of verbs in -ω given the sentences, statement, question and
infinitive present. answer: simplest meanings of cases:
meanings of απο, εις, εν, εξ, μετα (gen.),
συν.
2. Some irregular nouns: cardinal 2. Article with demonstrative and with
numerals: comparison of adjectives: adjectives of position: αυτος: simplest
commoner pronouns: ειμι, with active of meaning of the tenses: accusative with
λυω. General rules for accent in its infinitive: some further particles of question
dependence on quantity. and emphasis.
3. Numerals: ειμι, λυω: a few irregular 3. Genitive absolute: agent and
nouns. Accent of nouns and verbs (general instrument and other case usage: infinitive
rules). with verbs of command or request:
commands, prohibitions, wishes (opt.): ἱνα
and its sequence: double questions and
further formulæ.
4. Contracted verbs: parts of a few 4. ὁπως with fut. indic. ὡστε: all final
irregular verbs: accent of nouns and verbs constructions: verbs of fearing: δια, νατα,
(special rules) and contracted syllables. μετα, παρα, προς, ὑπο.
5. Verbs in -μι: οιδα φημι: parts of 5. Accusative and nominative with
commoner irregular verbs. infinitives: use of participles with certain
verbs: consecutive and temporal
constructions: simple indirect statement
and question: the conditions begun.
6. Irregular nouns and verbs: fill gaps. 6. The cases, tenses, participles and
Revise with Goodwin’s Grammar. prepositions: idioms, such as καιπερ ἁτε
ὡς: conditions: all rules of obliqua.

BOOKS.[15]
[15] V is added to those which have vocabularies; K means key.

The writer wishes it to be understood that this is not an exhaustive list.


These books he has either tested by use, or has good grounds in the
experience of others for the judgment given of them; but there are many
others of the same kind, and there is often little to choose between them. The
publishers whose books are given below are: Camb. Univ. Press, Clarendon
Press, Blackie, Dent, Grevel, Isbister, Longmans, Macmillan, Murray,
Rivingtons, Seeley, Trübner.
LATIN: GRAMMAR AND COMPOSITION.
Public School Lat. Primer (or Postgate’s New Lat. Primer, in some respects a more useful book)
should be kept at hand, if only for reference and revision. Abbott, Via Latina (v), 3/6;
excellent. Morris, Elementa Latina, with Tripertita as an exercise book, followed by
Mansfield’s Lat. Exercise Book; a good series for very beginners, but the exercises need
supplementing. Allen, Rudimenta Latina (v) 2/6; belongs to a complete series, the other
books being an Elementary Latin Grammar, 2/6, a First (v), 2/6, and a Second Latin
Exercise Book (v), 3/6. The last named is an excellent book for teachers, who may learn
much from it, but I have found it dull and difficult for the learner. Ritchie, First Steps in
Lat. (v), 1/6; also one of a series, with Ex. in Lat. Prose Comp. (v), 2/6, and Easy
Continuous Lat. Prose, 2/6,[16] Latin Clause Construction, 1/6, a First Lat. Verse Book (v),
2/-, and a Reader Fabulæ Faciles (v), 2/6, with Imitative Lat. Ex. (v), 1/6, based upon it.
These are good books, and I prefer them to Allen’s after using both series: the
explanations are clearer, and there are more sentences. Macmillan’s Latin Course (v), two
parts, 3/6 and 4/6; good. It has an advantage in the large number of exercises. England,
Exx. in Latin, Syntax and Idiom (v k), 2/6; a companion to Roby’s School Latin Grammar.
Rooper and Herring, Primary Lat. Exx. (v), 3/6; specially adapted to the Revised Lat.
Primer. North and Hillard, Lat. Prose Comp. (v), for the middle forms, 3/6; carefully
arranged and progressive from phrases and sentences to continuous prose. Champneys
and Randall, Easy English Pieces for Translation into Latin Prose, 1st and 2nd series, each
1/6; excellent, and can be used with a sentence book as soon as the elements are
mastered. More advanced Grammars: W. M. Lindsay, Short Historical Lat. Gr., 4/6;
excellent. This is mainly philological. H. J. Roby, School Lat. Gr., 5/-; good. Not
philological.
[16] See below, Champneys.

For Idiom and Construction in the higher stages:—


Bradley, Arnold’s Lat. Prose Comp. (v), 5/-, and Aids to Writing Latin Prose, 5/-, with full
explanations; the former has sentences, the latter continuous prose. Abbott, Lat. Prose
through Eng. Idiom, 2/6; is a most useful little book for committing to memory. This
should be used with one or two forms or sets in addition to the stock books. Jerram,
Latine Reddenda, 1/6; useful collection of miscellaneous sentences. Books of chosen
English: Holden, Foliorum Centuriæ, 8/-, for Gr. and Lat. prose; the standard collection.
Wilkins’ Manual of Lat. Prose Comp., 4/6. Sargent and Dallin, Materials and Models for
Lat. Pr. Comp. (k), 6/6; with references for each piece to portions of Latin authors on
similar subjects; a useful book. Potts, Passages for Transl. into Lat. Prose (k), 2/6.
Nettleship, Passages for Transl. into Lat. Prose, with a valuable introduction. Postgate: see
below.
Most useful for teachers, advanced students, or private students:—
J. Y. Sargent, Lat. Prose Primer (v), 2/6; most of the pieces are carefully analysed, and the
steps by which the sense is mastered and then translated are shown in detail. It is a
companion to Sargent’s Easy Passages for Transl. into Lat. (k), 2/6. Potts, Hints towards
Lat. Pr., 3/-; perhaps the most useful of all manuals on Latin prose style. Postgate, Sermo
Latinus (k), 2/6; interesting and instructive. Ramsay, Lat. Pr. Versions, with the English,
5/-; excellent models. Meissner’s Lat. Phrase Book, 3/6; phrases and quotations classified
and indexed; a most useful book. Roby’s Lat. Gr., two vols., 9/- and 10/6; indispensable.
W. M. Lindsay, Lat. Language, 21/-; indispensable to those who study Latin from the
comparative standpoint. His Short Historical Lat. Gr. will, however, be sufficient for less
advanced students.

VERSE.
Manuals by Penrose (elegiacs); Morice (same, more advanced), and Lupton (lyrics): Holden,
Foliorum Silvula (the best anthology).

READERS.
There are numbers of elementary readers, and there is really little to choose between them.
The most useful set seems to the writer to be Rivington’s Single Term Latin Readers, 8d.
to 1/4 each. With notes, exercises and vocabularies. These are sets of three books for
each of six terms, each book containing enough for a term’s work, and each set having
the same standard. Others in common use are: Morice, Loculi, 2/-; Abbott, Dux Latinus,
2/-, adapted to Via Latina; Ritchie, Fabulæ Faciles; Bennett’s Easy Lat. Stories, Hardy’s
Lat. Reader, etc. Teachers and private students may learn much from Abbott’s Latin Gate.

GREEK: GRAMMAR AND COMPOSITION.


Abbott and Mansfield, Primer of Gr. Gr., 2/6, or with Syntax, 3/6; is perhaps the most
convenient as a collection of facts. A Primer of Gr. Ex., 3/6, has been compiled to go with
it. Ritchie’s elementary exercise books can be recommended. Ritchie and Moore, Practical
Gr. Method for Beginners (v k), 3/6. Ritchie, First Steps in Gr. (v), 2/-; exercises need to
be supplemented. Jackson, First Steps to Greek Prose Comp. (v k), and Second Steps (v
k), 1/6 and 3/6; are useful exercise books. Macmillan’s Greek course: Easy Ex. in Gr.
Accidence (v), 2/-; Easy Ex. in Gr. Syntax (v), 2/6; Second Gr. Exercise Book (v), 2/6;
companions to Rutherford’s Greek Grammar. They are almost exclusively exercises, and
very full. Jerram, Graece Reddenda (v), 2/6; a collection of miscellaneous sentences.
Sidgwick’s First Gr. Writer (v k), 3/6; easy continuous prose, may be used along with any
book of sentences. Following this comes his excellent Gr. Prose Comp. (v k), 5/-, and then
the pupil will be able to dispense with crutches. Both have clear and useful introductions.
Arnold’s Gr. Pr. Comp. (v k), 3/6, ed. by Abbott, has useful exercises in idiom.
More advanced, and to be used as soon as the accidence is mastered, is Goodwin’s Gr. Gr., 6/-,
new ed., excellent; or his School Gr. Gr., 3/6. To the advanced student Goodwin’s Gr.
Moods and Tenses, second ed., 14/-, is indispensable. Much may be learnt from the Gr.
Gram. of Goodwin, 6/-; Rutherford, 3/6; and Sonnenschein. Collections of chosen English:
Holden, Foliorum Centuriæ; Wilkins, Manual of Gr. Prose Comp., 5/-; Sargent and Dallin,
Materials and Models for Gr. Prose Comp. How to tackle a piece of English, see Sidgwick’s
Lectures on Gr. Prose Comp., and Lectures on the Teaching of Composition, 4/6. Sargent’s
Gr. Prose Primer (v k), 3/6, is stimulating.

VERSE.
Damon: A Manual of Gr. Iambic Verse (v k), by Williams and Rouse, 2/6. Holden’s Foliorum
Silvula (the best anthology). Help may be obtained from the Greek verse books of
Sidgwick and Morice (v k), (v), Sargent (v), and Kynaston (v), 4/6.

READERS.
Rivington’s Single Term Readers (v), like his Latin readers, 9d. each; recommended. Heatley,
Græcula (v k), 1/6, for beginners. Sidgwick, First Gr. Reading Book (v), 2/6: 100 easy
stories, with some grammar. Rushbrooke, First Gr. Reader (v), 2/6; Bell’s Second Gr.
Reader, 3/-; Murray’s Fourth (specimens of dialects), 4/6, and Abbott’s Fifth (Homer and
the dramatists), 4/6. Macmillan’s Gr. Reader, stories and legends, 3/-. Mayor, First Gr.
Reader, 4/6. The student had better pass on as soon as possible to some such book as
the following: Xenophon, Easy Selections, Philpotts and Jerram. Herodotus, Battle of
Marathon in Attic Prose. Herodotus, Tales from, Atticised, Farnell, 1/6. Arrian: Selections,
Walpole, 1/6. Lucian: Extracts, Bond and Walpole, 1/6. The next step will be to selections
from the Attic Orators: Rivington’s Middle Form Greek Readers, 1/6 each; Plato’s Crito or
Apology; Sidgwick’s Scenes from Greek Plays.

GREEK AND LATIN: UNSEEN TRANSLATION.


Jerram, Anglice Reddenda, three series, 2/6, 3/-, 3/-. Reid, Transl. at Sight, 2/6 each part.
Spratt and Pretor, Transl. at Sight (k); an extremely good selection of difficult passages.
Models: Jebb, Jackson and Currie’s Translations, and Fox and Bromley, Models and Exx. in
Unseen Translation.

ANTIQUITIES.
Gow, Companion to School Classics; indispensable. Schreiber, Atlas of Class. Antiq., 21/-.
Anderson, Atlas to Homer, 21/-. Rouse, Atlas of Gr. and Rom. Portraits, 1/6 each part.
Macmillan’s Manuals of Antiq., 5/- each. Murray, Handb. of Gr. Archæology, 18/-. J.
Harrison, Mythol. and Monuments of Early Athens. Middleton, Remains of Ancient Rome.
Lanciani, Ruins of Ancient Rome and other works. Schneider, Das Alte Rom. (Pictorial atlas
with maps; excellent.)

COMPARATIVE PHILOLOGY AND TEXTUAL CRITICISM.


P. Giles, Manual of Phil.; the best handy manual. Henry, Comp. Gram. of Gr. and Lat. King and
Cookson, Introd. to the Comp. Gram. of Gr. and Lat., 5/6. Lindsay, Short Hist. Lat. Gram.,
5/6. More advanced: Brugmann, Compar. Gram. of the Indo-Germ. Languages
(translated). The standard work. King and Cookson, Principles of Sound and Inflexion,
18/-. Lindsay, Lat. Language, 21/-. Prellwitz, Etymolog. Wörterb. der griech. Sprache;
good. Wharton, Etyma Græca and Etyma Latina. Thompson, Gr. and Lat. Palæography,
3/6.

ILLUSTRATIVE PICTURES AND MODELS.


Cybulski, Tabulæ quibus antiquitates Græcæ et Latinæ illustrantur (Köhler, Leipzig). Wall
pictures, coloured, 4/- or 5/- each. An excellent series. Launitz, Wandtafeln zur
Veranschaulichung antiker Lebens und antiker Kunst. Through Deighton Bell, Cambridge.
Casts: Brucciani, Covent Garden (catalogue).
Models: Inquire at Museum of Teachers’ Guild, Gower St., London.
Slides: the same. Field, Cat. of Lantern Slides for Fyffe’s History of Greece, 6d. Roman
catalogue preparing. Catalogue of the slides in the Loan Collection of the Hellenic Society.
Photographs, etc.: Catalogue of English Photographic Company, S. C. Atchley, Place de la
Constitution, Athens. A very full and cheap collection. Mr. Atchley is well known to the
writer, and strangers need have no hesitation in writing and sending money direct.
Photographs are sold by German School at Athens.
The following Greek photographers have good collections: Rhomaïdes Frères, Rue de Niké, 24;
Constantin Athanasiou, Rue d’Hermès, 6. Catalogues. The Levant: Bonfils & Co., Beyrout,
Syria; and local photographers at Constantinople, Smyrna, Jerusalem and Cairo.
Purchases should be made through some one on the spot. Italy: Sommer e Figlio, Largo
Vittoria, Napoli: photographs and models. Collezione Brogi, and the Stabilimento
Fotografico Moscioni have large choice. Museums. London: Stereoscopic Company, Clarke
& Sons, Mansell & Co. Berlin: the Museum publishes a few (catalogue). Paris: Girardon,
15 Rue Bonaparte. Munich: Bruckmann, Verlagsanstalt für Kunst (see below).
Publications. Denkmäler der Griech. und Röm. Skulptur: Brunn & Bruckmann, Munich.
Magnificent plates. Griechische und Römische Porträts: Arndt & Bruckmann, Munich.
Einzelverkauf: photographs of sculpture (Bruckmann), separately about 6d. each. Classical
Sculpture Gallery: Grevel & Co. 12/- a year. Cheap reproductions of all the chief works of
sculpture, ancient and modern. Bilder zur Mythologie und Geschichte der Griechen und
Römern. Hoppe-Graeser, Vienna.

MODERN LANGUAGES.
By Dorothea Beale.

First a few words on the order in which languages should be taught. I do


not think that we should make a change for the better as regards girls’
education, were we to substitute Latin for French, placing that subject first in
order of time. It seems to me best to begin with French, a language
etymologically related to our own, and having a simple grammatical structure.
Secondly I prefer to take German, the grammar of
Order of language teaching.
which approaches more nearly to the classical
models, whilst the inflections are easier to learn
than the French; its etymology too not only throws much light on our own, but
is more transparent, which makes it a medium, perhaps as valuable as Greek,
far more valuable than Latin, for showing the refinements of language, the
poetry and philosophy fossilised in speech. Thus those only take up the
classical languages who have some linguistic power. Girls who are unable to
master the difficulties of the grammar will never encounter them, and as the
languages gradually increase in difficulty, we can better fit the means of
education to the power of the pupil. The classics form, it is true, a key to
modern tongues, but on the other hand modern tongues lead up to Latin and
Greek, and I believe this order is equally logical and answers better with girls;
it is something to open to them the literature of France and Germany,
something to teach them languages, so that they shall find the study (as they
generally do) one of interest. At any rate there are four stages at which we
can leave behind those unable to continue their march, and who, if we tried to
bring them further, would form only a crowd of stragglers. Those who have a
good knowledge of one or two modern languages will have no great difficulty
in taking up Latin or Greek say at fourteen or fifteen. They will have a large
etymological store, which will make it easy to acquire the vocabulary, and they
will have to study only the differentia of the grammars of the different
languages—may we not rather say dialects?—of the Indo-European stock.
Nearly all syntax rules will be already known, and a Latin Grammar in which
the principles are brought out, may take the place of one written for young
boys in whom the grammatical faculty is rudimentary—in which dogmatic rules
only abound; dogma should as far as possible yield to principles, which are
intelligible and interesting to elder girls, and this will help them over the
necessarily considerable labour of learning the inflections. Perhaps few will
attain the minute exhaustive scholarship of which some minds are capable, but
many will read with keen enjoyment; some girls who have begun late have
taken high places in university examinations.
Much has been recently written on the subject of modern languages; in the
books edited by Mr. Barnett and Dr. Spenser, just published, to which I have
frequently referred, are excellent papers. I shall therefore make my remarks
on the subject very brief. In the first is an excellent paper by Mr. Storr, and Dr.
Spenser has written a paper of about fifty pages, giving a full account of the
modern system of teaching.
It is time that some reform took place. The Oxford Local Examiners of 1896
reported the French as phenomenally bad. In 1897 nearly half the seniors
failed. I have tabulated the answers to the few questions set by me to pupils
entering over twelve, and I find, taking some two hundred, that not one in ten
knows the regular verbs, and scarcely any write very simple sentences without
egregious faults.
The first teaching in modern languages should
Only oral teaching at first.
certainly be oral. In the kindergarten, French and
German songs and simple sentences may be taught in
the lowest forms. Supposing that children begin about seven or eight, it seems
better they should not see written French at first. If they have learned the
alphabet, as I have suggested in a former paper, they will take some interest
in the new sounds of French and might read from a phonetic transcription.
There are good papers in the (August and September,
Phonetic alphabet.
1897) Journal of Education on this subject by Mr. Ware, Mr.
Kirkman and Mons. Passy, which I commend to my readers.
I give a few extracts. Mr. Ware writes: “In Germany, every teacher has to
render himself capable of teaching pronunciation, and results prove that he
succeeds. In various German training colleges, there are courses of lectures on
phonetics applied to the study of foreign languages. It was owing to the
success attending the introduction of phonetics in the French teaching in
certain German schools that I was finally induced to try them in the earliest
stages of French teaching at Bradford. The results have exceeded my
expectations.”
This is confirmed by Mr. Bearder of Nottingham. He writes: “Though I have
not used the method in such a thorough and systematic manner as he has
done at Bradford, still the results are such as to convince me that I am entitled
to support Mr. Ware in his refutation of one argument, letting alone others,
which the opponents of phonetic teaching continually bring forward, that time
is wasted in learning the two modes of spelling”.
If it is not possible to get the reading taught phonetically, using the
international alphabet, the use of the tables of Larousse will be a great help.
In any case pieces which are learned by heart, dialogues, etc., should be
repeated in the class after the French teacher, before the children see the
book. Few English people have ever learned to distinguish the
Common errors.
sounds of the final syllable in the imperfect and passé défini
or the future and the conditional or the gradual opening of the
sounds as we pass through e, é, è, ê. Very few pronounce u properly when it
precedes another vowel—lui is pronounced looee. Very few observe that a
labial nasal before another labial is changed into a dental nasal, thus not
impossible but inpossible, and nearly all say leer for lee + r. Children are
taught to read so unsystematically, that if they are told these things they
forget them, and waste time in repeating easy sounds, instead of working at
the hard ones. Children should not be set to learn verbs, etc., without having
first repeated them and practised the sounds with their teachers. When they
do begin to read, the sound-table should be hanging up, and should be
referred to, that they may correct their errors themselves. These pronouncing
lessons should go on in a room alone, so that children may speak together in
imitating the teacher; then she should single out individuals for different
sounds; but the whole class should never sit round, as is the custom in some
schools, and hear each of their companions read in succession a piece of
French with true British accent. If they listen, their time is worse than wasted;
if they do not, they get habits of inattention. The attention must not be
wearied, and if two or three sounds are acquired each week, the whole will
very soon be mastered, and time saved for the repetition of poetry, for viva
voce composition, etc.
When children begin to read, we should spare them as much
Translation.
stupefying dictionary work as possible, but it is not well to let
them learn the vocabularies of the book without comment, and
they should be led from their past knowledge to discover the meaning, and as
far as may be, get at the root meaning of unknown words, and see the
underlying figure. Thorough work is much quicker in the end. Pascal’s father
left his son with a Latin book, and no dictionary, to find out the translation.
This may be a counsel of perfection suited only to a Pascal, but there are not
many words of which children could not discover the meaning. Much more
translation from French into English should be got through than is usual;
children ought soon to be able to read at sight. Time need not be wasted by
hearing all that has been prepared, but each could be called on to translate
one sentence, and then translation go on at sight.
The pupil should have a small note-book in which each new
Vocabulary.
word is entered. This book should be divided into three columns:
the first will contain the word in its general form; the second the
root of the word with its etymological meaning, if known, or any cognate by
which it may be remembered; the third column, the primary and principal
secondary meanings. Every noun should have the article before it; these
should be learned and repeated before the next translation lesson. The
teacher may also give groups of words, derivatives of the root, and by this
means a copious vocabulary will be in a short time acquired—the words once
grasped will not be forgotten. The enthusiastic teacher will probably have to
put a check on his zeal, for if he is led off too far into etymologies, he will get
through no translation. After a little the pupil should begin to prepare alone,
and to make his own word-book; every translation should begin with the
inspection of this book by the teacher and by the hearing of the words.
Since the acquisition of correct habits is the main thing in
Exercises.
learning languages, we should before all things prevent the
acquisition of wrong ones, by letting pupils speak, and write
exercises before their ear and eye have been trained. They should not be
allowed to speak a language carelessly, to “pick it up,” as the phrase is,
incorrectly. A most pernicious practice is it to set girls to speak a foreign
tongue together. The evil habits acquired cannot possibly be undone in
subsequent study. I knew a master of languages who refused to give lessons
to those obliged to speak thus. He could not, he said, in a few hours a week,
correct the bad French learned during the remainder. Learning bad French,
however, is one of the least evils connected with this practice. Anything
deserving the name of conversation is banished where it is strictly enforced,
and so the mind is dwarfed and stunted, and when girls leave school, they are
often found unable to talk except upon trivial subjects, and unable to express
themselves like rational beings in any language.
I quote from the rules of the maître phonétique:—
“Le maître fera étudier les phrases les plus uselles, des textes
Re-translation.
suivis, dialogues, descriptions et récits, aussi faciles, aussi
naturels et aussi intéressants que possible. Il enseignera
d’abord la grammaire inductivement, comme généralisation des faits observés:
une étude plus systématique sera réservée pour la fin.”
The translation book must be made the basis of teaching, and the ear
familiarised with the correct form by the learning of good French, the rules as
far as possible being found inductively. Thus the children will observe the
changes in mon frère, ma mère, mes frères et mes sœurs, and be able to
make a table. Life is too short to find out all grammar, and so we shall
eventually have recourse to collections of grammatical forms, but this need not
be done until a good deal has been discovered by means of sentences formed
for the purpose.
Easy passages should be translated into English and back into French
according to Ascham’s method. This should precede the writing of exercises,
which may, however, be read at sight in class. Children should repeat verbs
interrogatively and negatively with pronouns in their places, so that the ear
may be trained before the rule is discovered. Fassnacht’s books are good. Mrs.
Bell’s books too are useful for children to learn instead of ordinary dialogues. It
is impossible for them to speak in a natural way, when they are merely giving
abstract sentences, but they can hold short conversations with one another in
an animated way, and these can be taught viva voce in daily lessons.
Monotony should be avoided, and occasionally instead of
Composition.
setting an exercise, it is well for the teacher to relate a short
story, and let the children repeat what they can, or write what
they can remember; but in all these things we must avoid as much as possible
wasting their time by making them listen to one another’s mistakes.
Exercises may be written and a grammar used later, but if the teacher
economises time, there will remain enough in each lesson to prepare pupils for
the writing of the next exercise and to warn them of mistakes they would
otherwise be likely to make. I need not repeat here what I have said under the
head of corrections and time saving (see p. 28, introduction).
Finally as regards grammatical rules. There are doubtless many
Philology.
forms which must be learned, and rules which we must treat as
arbitrary, because we can see no reason for them, but the more
reasons we can show, the more interesting will language become, and the
easier to learn. Thus children are glad to discover that the terminations are not
mysterious letters for which there is no reason, but the remnants of pronouns
put on at the end—that in the French future we get the same as the English,
“I have to write,” only “have” comes after, and in the conditional, “I had”. They
need not then learn these tenses, only notice the abbreviations. The survival
of the t in a-t-il and many other things will enliven the grammar lesson. Peile’s
delightful Manual of Philology and D’Arcy Thomson’s Day-dreams of a
Schoolmaster are suggestive, but of course the more a teacher knows of
philology, the more interesting she can make her lessons, and one versed in
the subject should be found in every school.
The never-ending rules for the past participle may be at once disposed of by
just showing children that the participle being an adjective must agree with
the word it belongs to. If I say, “I have written a letter,” of
Rationale of rules.
course “written” belongs to letter and therefore it must
agree. We need not make them think about whether it is
subject or complement. The only curious thing they have to notice, is that it
does not agree when the word it belongs to comes after “have”. Is it because
the thought of the act of writing is more present to the mind when we say, “I
have written a letter,” and we do not think of the letter as written, whereas
when the letter is objectified to our gaze, being represented by a pronoun, we
think of it rather as a letter written?
The learning of a third language will present less difficulties. If the language
is German we can, by a few simple etymological laws, get command of a
copious vocabulary in a short time. The declensions offer some difficulty at the
outset, chiefly on account of the adjectives. But the phonetic change is made
in order to avoid the repetition of the harsh sound s, m, r, and therefore when
this occurs in a preceding pronominal adjective, it is dropped or softened in
the second adjective; thus the ear guides, and we have not to think about the
forms; one has only to notice that in the oblique cases it is weakened to n,
and in the plural it is always n.
The order of words offers difficulties too, and we have a complicated
construction. We have to fix our attention on the functions of words, as we did
not in a simpler language, for a whole row of words goes to make up an
adjective, and dependent sentences are constantly taking the place of simple
words. Insight there must be to see what are dependent sentences, and then
the whole paraphernalia of rules about certain conjunctions which require the
verb to be sent to the end vanish too and we move freely.
Another difficulty is the different uses of prepositions. In English we go
“through” the street, in German “on”. We go “through” a town, the Germans
“over”. Let the difference of the conception be realised, and the prepositions
will come right.
It is a great pleasure to those approaching maturity to study a
Literature.
language made for metaphysics. We cannot read German without
finding everywhere fossil poetry and philosophy, and the rolling
periods and the grand verse stir our soul like a trumpet, and we know that we
hear the voice of an heroic people, who speak a language and think thoughts
akin to our own.
Latin does not attract perhaps in the same way; the military precision of the
Latin classics has its charm. I feel strongly that Latin should, however, properly
come after German, specially for girls. There is a pestilential atmosphere in the
Campania, and one needs to have one’s moral fibre braced by the poetry of
the Hebrews and of England and Germany, if one would remain unaffected by
writings saturated with heathen thought.
Those who are able to spare time and strength for Greek, and love poetry in
all its forms, will delight indeed in the “Wine of Hellas,” and with the
enthusiasm which they will bring to a new study they will surmount in a short
time obstacles which would have delayed them for months, when they had
less knowledge of co-ordinate forms, less taste, less insight, less joy in
wrestling with problems and searching into mysteries. If there is not time nor
talent nor inclination for all, then I would say prefer Greek to Latin.
The chief thing for the teacher to do is so to teach that the pupil shall enjoy
the work. I do not mean that the pupil should be spared hard work and
drudgery, or be always expecting to find honey on Hymettus; but do we not all
know that the labour of making our way over rotten glaciers and up stony
moraines is forgotten when we stand on the crest, and that all the way we go,
we think of the joy set before us, when we shall attain to some lofty peak,
whence we can see the outstretched heavens and the sunlit earth? For this we
must throw ourselves in each language upon literature—the forms of grammar
will be the ladder whereby we mount.
And then we shall return to our own native poets and thinkers, with minds
enriched by foreign travel, and Milton will be the interpreter of the poetry of
the world—of ancient and modern times, Spenser of the mediæval romances,
Chaucer of the world of nature, Wordsworth and Coleridge of spiritual
philosophy, and we shall feel that we must be worthy of so great an
inheritance, and not trample under our feet the pearls, the precious jewels of
speech.
Do I seem unpractical? It is just these ideas that are practical, which we
must get our children to see and to feel, and then the burden of earnest,
thoughtful labour will seem light, and our English tongue will not be degraded
by slovenly pronunciation or the use of vulgar and inappropriate words.

SPELLING REFORM.
By Dorothea Beale.

Let me earnestly beg of teachers not to put aside the question of spelling
reform as of little moment, but to do their utmost to bring it about.
Can it be to educators of little moment that learning to read, instead of
introducing children to an orderly system, reveals chaos, and interferes with
the tendency upon which all science is founded to expect law and order. As
Professor Max Müller writes «Every thing that children have to learn in reading
and spelling is irrational; one rule contradicts the other, and each statement
has to be accepted simply on authority, and with a complete disregard of those
rational instincts, which lie dormant in the child, and ought to be awakened by
every kind of healthy exercise».
I find it difficult to express my strong sense of the immense importance of
this reform on grounds educational, economic, patriotic. Not only does our
cacography oppose an enormous obstacle to intellectual progress during the
most important years of mental development, and thus squander brain power
on useless work, it is also a waste of money which is expended by the upper
classes in forcing on the children of the poorer a waste of time and—a sort of
useless prison-labour.
Dr Gladstone calculates that the average board-school child spends more
than 2000 hours in acquiring the arts of reading and spelling, and that the
waste of money is over £ 1000000. This was 20 years ago; with increased
grants, the loss of money must be far more now. He also calculates the waste
of capital in printing unnecessary letters at nearly 20 per cent. This is only one
of the many arguments for reform, which he puts most clearly and forcibly.
Most of the richer children have an indefinite amount of leisure in childhood,
and they forget how long it took to learn to read, but children in elementary
schools groan under a pedantic tyranny, which imposes wearisome and useless
labours upon those who might otherwise in their short school time gain such
facility in reading, that it would be a pleasure ever after, and the time which is
now wasted on spelling, would be available for much beside: Germans have
time to acquire foreign tongues, but Englishmen and Frenchmen have not time
to acquire them in addition to their own spelling; either language from its
simple structure might become a world-wide tongue, and there would be no
need of Volapuk.
I quote from Professor Max Müller’s article.
«According to a Liverpool Schoolmaster of great experience it takes from 6
to 7 years to learn the arts of reading and spelling with a fair amount of
intelligence. I. e. about 2.000 hours. A Glasgow schoolmaster writes, «I have
taught poor children to read the Sermon on the Mount after a course of
exercises extending over no more than 6 hours», and a father writes, «My boy
who is a few months more than 4 will read any phonetic book ... and how long
do you think it took me to impart to him this power? Why something less than
8 hours, and that was in snatches of five minutes at a time; his next brother a
boy of 6 has had a phonetic education, what is the consequence? Reading in
the first stage was so delightful that he taught himself to read. My eldest boy
11 years old, at a first-rate school has carried off the prize for orthography».
Mr. Ellis, who did so much for education writes, «With the phonetic system the
Primer is mastered within 3 months at most; careful experiments have
established 1) that pupils may be taught to read books in phonetic print in
from 10 to 40 hours, and that when they have attained fluency in reading
ordinary print, the pronunciation is much improved, the interest in study kept
alive, and a logical training of enduring value given ... and they acquire the art
of ordinary spelling more readily than those instructed on the old method.»»
Let those who think I exaggerate, look into Miss Soames’s introduction to
Phonetics, and they will marvel how a foreigner can ever learn to read and
write English—she gives the 34 ways in which we write the indefinite ‘a’ sound
in aloud—the 26 for representing ‘or’; the 18 for giving ‘sh’ the 20 representing
‘n’, 18 for ‘k’, and so on—Pagliardini enumerates the 44 ways in which ‘oo’ is
written and 36 for the sound ‘ee’; those who have tried to teach foreigners
know how hopeless it all seems.
Pagliardini tells of a work published 1861 on French spelling, which gives
163 ingenious rules and occupies 285 pages. It is asserted that 2 lessons a
week for 3 years will suffice. How much better writes Pagliardini would these
precious hours be spent in studying noble thoughts in books, the history of
nations, the mathematical sciences, or the laws by which God governs the
universe, or if confined to words, then how much more interesting and
intellectual would be their decomposition into their elements, showing their
affinity with words in other languages. What a fund of poetry might be found
in the metaphors of which words are the abbreviated forms. All this, now
unopened to his view for lack of time, would be revealed.
This may be paralleled by the spelling book of the Meiklejohn series.
‘Spelling with sidelights from history.’ It contains 150 pages, gives many rules,
and concludes with one thousand of the most difficult words selected from
examination papers.
M. Pitman has done good service in printing and circulating for a very small
sum various tracts, and I hope my readers will get some, specially the paper
by Prof. Max Müller. Alas, reforms are slow when the opinion of many
unthinking persons has to be formed, before they can be carried. It needed a
pope to reform the calendar.
The Westminster Review for Sept. 1897 has an article on spelling reform,
urging its great importance, if English is to be a world-wide language. The
impossibility of getting a new alphabet adopted at least for a long time is
urged as a reason for pressing minor reforms, the chief being the omission of
all useless letters. Thus we should leve out awl thos perplexing vowels in lev
recev decev belev; and thes changes mit posibly be carid with sum slit efort at
wuns, if sum popular orthor wood requir his book too be printed foneticaly.
Some defend our spelling for philological reasons, but it is unanimously
condemned by philologists; I name those best known in England—Professor
Max Müller pronounces it a national misfortune, and has written an article
against it—Professor Sayce and Skeat, Ellis and Sweet, Dr Murray, editor of the
Etymological Dictionary, condemn it, and amongst linguists, Pagliardini, and
scientists, Dr Gladstone.
But the chief reason, that we should press forward this movement is, that
only thus does it seem possible to avert the catastrophe foreshadowed in an
article on the Queen’s English in the Review of Reviews for June 1897.
Dialectic varieties are arising in the English-speaking Colonies, which, if
unchecked by phonetic symbols corresponding with speech, will develop into
different languages. The longer we delay, the greater will be the difficulty of
agreeing on a common notation—at present the differences of opinion
between us and our colonies, and even between us and our American cousins
are slight, but those who have heard the English of the States spoken by the
children of German immigrants, will recognise the danger.
Miss Soames before her death published reading books in phonetic type,
and spent much time and money in promoting the teaching of English reading
on this system, and in introducing to the notice of English people the alphabet
of the Association Phonétique Internationale, 11, Rue de Fontenay, Bourg la
Reine (Seine).
Such an alphabet would be better than one suitable for English only, but if
Pitman’s is the only one generally available, it is better to use that for
elementary schools, and remember the maxim ‘le mieux est l’ennemi du
bien’—For teaching the right pronunciation of foreign languages, le Maître
Phonétique is very valuable.
Melville Bell’s Visible Speech is a physiological alphabet of marvellous
ingenuity—but perhaps too elaborate for general use, and the conclusions at
which he arrives are not always endorsed by the chief authorities. All students
of phonetics will learn much from reading it.—English visible speech, in 12
lessons 50 cents, Volta bureau Washington, gives the essentials of the system
—the large work costs 4 dollars.
Great efforts are being made in France to introduce an international
phonetic alphabet.
If all could agree on one alphabet, it would be possible for a foreigner to
read at sight any foreign language. It is true there would be certain niceties of
pronunciation to be taught Viva Voce, but the pronunciation would be very
nearly correct at once.
I subjoin a few specimens of writing and the alphabet from ‘lə mɛːtr fɔnetik’
(Le Maître Phonétique).
The French alphabet is very simple. The consonants are as in English except
- ɲ for the palatal n as in signe.
ʃ for ch as in champ—Ex. shut.
ʒ for ʒʰ as in je—Ex. pleasure.

The vowels are

ɑ pâte ɛ tête i ni o côte u tout


- - - - -
a patte e dé j yeux ɔ tort y tu

œ seul w oui nasalises


- ø peu - ɥ huile - ː lengthens
ə de

The complete international alphabet which is subjoined requires more signs


but this suffices in French.
French.— kɑ̃t yn fwa ɔ̃ li kuramɑ̃ l ekrityːr fɔnetik i
quand une fois on lit couramment l’écriture phonétique il
syfi d kɛlkəz œːr pur aprɑ̃ːdr a liːr l ekrityːr ɔrdinɛːr.
suffit de quelques heures pour apprendre à lire l’écriture ordinaire.
In English we want θ ð for th in thick & then, ɕ for ch in hue, ŋ for the
guttural nasal, ʌ for but, a vowel not quite the same as seul, æ for at—
English.—nau ðə pɔint ai wɔnt tu get æt iz hweðəɹ ðe seːm deskripʃən kæn
bi givn.
(now the point I want to get at is whether the same description can be
given.)
German.—vɛn viːr uns in unserm lɑndə rɑif dɑfyːr hɑltn di ɑlgəmɑinə høːərə
bilduŋ ɑusʃlisːliɕ auf di mɔdɛrnə kultuːr tsu gryndn.
(Wenn wir uns in unserm Lande reif dafür halten die algemeine höhere
Bildung auschliesslich auf die moderne Cultur zu gründen.)

COMPLETE ALPHABET

Laryn- Guttu- Vé- Palatales Palatales


Linguales Labiales
gales rales laires d’arrière d’avant

C- Plosives ʔ qG kg cɟ td pb
O
Nasales ŋ̊ ŋ̌ ɲ̊ ɲ̌ n̥ n̬ m̥ m̬
N
S
Latérales ɫ̥ ɫ̬ ʎ̥ ʎ̬ ɭ̥ ɭ̬
O
N Roulées Q̥ Q̬ R̥ R̬ r r̬
N
E fv Fʋ
Fricatives h H h̬ ʁ̥ ᴚ̬ (ʍ w) x g (ɥ̊ ɥ̌ ) ɕ j ɹ̥ ɹ̬ , θ ð, ʃ ʒ, s z
ʍw ɥ̊ ɥ
S

V Fermées u ɯ ü ï y i (u ü y)
O
Y Mi-
o v ö ë ø e (o ö ø)
fermées
E
-
L Mi-
ɔ ʌ ɔ̈ ä œ ɛ (ɔ ɔ̈ œ)
L ouvertes
E
S Ouvertes ɑ a

Phonetic alphabet as illustration

HISTORY AS AN EDUCATIONAL SUBJECT.


By Dorothea Beale.

The second subdivision of Part I. is of great educational value.


Definition.
“History,” writes Dr. Harris, “reveals the higher self of man as
organised in institutions. For the first time man comes to know his
substantial self, when he comes to study history. His little self beholds his
colossal self.” The Man “writ large” of Plato.
“History,” writes Dr. Martineau, “enlarges the
Enlarges sympathies.
sympathies, opening fresh continents of character to
mental survey, throwing human tones upon the ear in
language unheard before; it acts upon the judgments of conscience like
foreign travel upon those of perception; it imparts a breadth of view
unattainable within a narrow circle. The smaller the scale of the personal lot,
the more precious and needful are the friendships of history.
“The ground plot of a man’s own destiny may be closely shut in, but if he
can find his way through vanished cities, hear the pleading of justice, visit the
battlefields where the infant life of nations has been baptised in blood; if he
can steal into the prisons, where lonely martyrs have waited their deaths; if he
can walk in the garden or the porch, where the lovers of wisdom discourse; if
the experiences of his own country consecrate the very soil—he consciously
belongs to a grander life. Hence the advantage which human studies possess
over every form of science, the sympathy with man over the knowledge of
nature. They are an enlargement of moral experience, and call into continual
exercise the sense of right and wrong.
“In watching the drama of history, the soul may be purified by ‘pity and
fear’. ‘Here we find examples for judgment, examples of patient suffering, that
touch the springs of pity; of selfishness and cruelty that gnaw the heart with
honest indignation, of heroic faithfulness that flings across the soul a breeze of
resolution, of saintly love that diffuses the very atmosphere of heaven.’”[17]
[17] Hours of Thought. Martineau.

In history as in science we learn facts that we


Supplements the teachings of science.
may trace laws, and history corrects by a larger
outlook the erroneous judgments deduced from a
limited experience. History too seems specially useful as a complement to the teaching
of science. In physics we find inexorable law. Admiration and fear may be excited, but
we look on the inevitable; we pass no moral judgment. History and biography show us
the Divine government adapting itself, so to speak, to the necessities of man, an
education of men and of man, we study a mystery which attracts and baffles us; we
are able to predict our world’s path in space and time, unable in reference to those
larger regions beyond our “little systems”—regions, however, in which we must believe
the same laws, physical and moral, to be working.
History corrects the judgment of the world; in its pages
Gives an outlook beyond time.
we look only at dead men, and we call him happy, not
who has been successful, but him who has left the world
better because he has lived, and so history reverses the pernicious teaching which
puts before the young success as the main object of life, and shows us the difference
between noble and pitiful ambitions. The heroes of history are those who endured
hardness and lived and died for others, a Heracles, a Theseus, a St. Louis, a Gustavus,
a Washington. The villains are those who lived for self, in ease and splendour, and self-
indulgence. We find in these, and still more in those in whom the lights and shades are
less strongly marked, encouragements and warnings for our own life, and help in
interpreting the lives of those around us. How tawdry looks the field of the cloth of
gold in the light of a later century! How silly seem those courtiers who carried their
“manors on their backs”! “He is worth so much” has a different meaning for the dead
and for the living; the dead have not, they are. Each noble life has left the world richer
in spiritual energy, in the power of self-sacrifice, in great ideals, in true riches; there is
a treasury of saints, not of a transferable righteousness, but of a transforming, a
transfiguring. We can see that no noble life has been lived in vain. “In the sight of the
unwise they seem to perish, yet is their hope full of immortality;” the corn which falls
into the ground and dies bears much fruit.
Lastly if we include in this study not only the history
Reveals progress through the ages.
of men and of societies, but of the intellectual and
moral life of man as a whole, not his descent but his
ascent, history forms a subject of surpassing interest and energising hope. We find
there enacted upon the largest theatre the daily recurring drama of the contest of light
with darkness. We learn how man’s eyes have been gradually opened to the wonders
of the visible universe, and his soul lifted into the regions of the invisible, his
intellectual conceptions enlarged, his higher being developed, and his desires purified;
history which discourages, as we look at a narrow tract, strengthens our faith in a
Divine order of progress, as we take in the larger regions of time; the waves seem
often to recede, while the tide advances, the stars seem to retrograde, but it is
because our little world oscillates in space; and so our faith is strengthened, and our
hope increased, and we learn not patriotism merely, but we catch something of that
enthusiasm of humanity, which shone with unclouded brightness in the Son of Man.
Another use of history, rightly taught, is to train in habits of
Cultivates the judgment.
justice and truthfulness, though it is too often written to serve
party ends. It is not easy to be just. The hearts of the young
are naturally drawn out to those who suffer. If the Eikon Basilike was not true, we are
inclined to say it must have been true, as we look upon Vandyke’s picture, see the
calm face of the martyr, or read the verses:—
He nothing common did nor mean
Upon that memorable scene,
But bowed his kingly head
Down as upon a bed.

We must, however, not let our sympathy with


Stirs right enthusiasm for heroic men.
suffering blind us to the fact that Charles failed in
his duty as a king—that had he been successful in
what he attempted, England must have suffered from the evils under which France
subsequently groaned. We must point out that it was his incurable deceit which
brought him at last to the scaffold. But neither, on the other hand, must we ignore the
fact that Cromwell trampled on the rights of men, that his was a lawless Government
too. We would not, however, have that sham impartiality which paints all men of one
colour and height, which is incapable of conceiving a hero, and contemplates crime
with calmness, remarking there are always two sides to a quarrel. Need I say that
throughout, the teacher must stir noble enthusiasms, a worthy emulation, admiration
for true manliness, for virtue, rouse sympathy for the oppressed, zeal for right—show
that the history of each nation is that nation’s Bible—the Book which tells of the
Heavenly Father’s care for it, as manifested in the incidents of its life? If addressing
higher classes, the teacher will point out, as opportunity offers, that each had a work
to do in the world, Hebrew, Greek, Roman, as Miss Wedgwood has shown so well in
the Moral Ideal.[18]
[18] Moral Ideal, by Julia Wedgwood. Trübner.

The young must learn, too, that the great


Shows the disintegrating power of
principle is found everywhere, that what we sow unrighteousness.
we must reap in the moral as well as the
physical world—that the selfish neglect of the poor brought about the Black Death and
gaol fevers, that the selfishness, rapacity and immoral greed fostered by England’s
unjust claims on France, brought its own punishment; this was seen when the
Hundred Years’ War ended in the internecine strife of the fifteenth century, and led to
the extermination of a selfish aristocracy. So too the degradation of the higher classes,
say in the eighteenth century in France, which led them to regard the lower classes as
scarcely human, brought about the fearful retaliation of the Revolution. Or again the
wealth of Spain, filling the nation with pride and haughtiness, was actually her ruin; by
persistently destroying or expelling, by war or persecution, all the nobler spirits, the
nation was degraded in a few centuries. Of course these latter lessons will be more
suited to a higher class, but something of it may be taught early.
Questions of right and wrong will ever be arising. What ought to have been done
under such circumstances? Is rebellion ever justifiable? and when? What forms of
government are best? is there an absolute best? We shall see how short-sighted is
crime when we come to the murder of Cæsar, of Henry III., Henry IV., William the
Silent. The teacher will not omit to look at the historical clock, when asking whether
acts were right or wrong. We must do justice to devotion, while pointing out errors
and crimes; we must be warned by seeing that wrong deeds are often done by those
who mean well; we must learn that though error and ignorance is evil, and we must
fight against both, yet that good often comes of the honest working out even of
mistaken opinions; that through illusions we gain the vision of truth.
The many experiments of the past show us too that evils
Teaches by experience.
which exist in a community cannot be cured by merely changing
a form of government, or getting rid of this man or that man by
violence; to do this is only to sow dragon’s teeth. A nation is made up of individuals,
and only by individual virtue can salvation come; so people now seek to bring about
the well-being of nations by education rather than by revolution, because freedom
without sense to use it is an evil, and a nation that is truly free will deserve and obtain
free institutions. As Mazzini says:—
“We must convince men that they are all sons of one
Teaches the solidarity of man
sole God, and bound to fulfil and execute one sole law here
on earth; that each of them is bound to live not for himself,
but for others; rights can only exist as a consequence of duties fulfilled, and we must
begin with fulfilling duties in order to achieve rights. We can obtain our rights only by
deserving them through our own spirit of love and sacrifice. If we seek our rights in
the name of duties, we shall obtain them. If we seek them in the name of egotism, or
any theory of happiness and well-being propounded by the teachers of materialism,
we shall never achieve other than a momentary triumph, to be followed by utter
confusion.”
One may point out the gradual progress which, with occasional recessions, has, we
trust, been made. One may stir in the young patriotism, and an enthusiasm of
humanity, and make them feel a desire to do what they can to amend the evils of their
own time.
Lessons of political economy seem to me more
and the duty of each to the community.
important for girls than the legislative contests of
constitutional history. They cannot enter into these
with the keen interest of boys, who may themselves one day be lawgivers. All should
be taught that a selfish, wasteful citizen is a disgrace, a sort of moral caterpillar—learn
that selfishness, sensuality, falsehood, under whatever disguises, are detestable, whilst
a self-devoted life is a heritage for ever. We should especially recognise the faults of
our own nation in past times, and in the present too; we should desire the elevation of
the degraded classes, and each should feel that his life and example has at least some
power, that each of us is responsible to men as well as to God, that it is by noble
enthusiasms, by self-devotion, by giving up one to another that human society is
possible.
History, like geography, can be approached two ways:—
1. We may take the map of the world, indicate its
Methods of approaching the subject.
leading features and its political divisions.
2. We may take a small tract, realise by description
the form and beauty, the flora and fauna, the temperature, the snowy peaks, the
rushing rivers, the silent stars, think it all out, until we feel at home in the land, work
up through details of topography to clear conceptions.
In teaching history, I think we ought to take some kind of time-map, mark out in it a
few of the most prominent recorded facts, tell something of the heroes, after whose
names tracts of time have been called, trace out a few of the leading empires, give
landmarks.
Then we may, after showing the position of a certain period in the
With juniors.
world-chart, work it up in detail. The way in which each period should be
treated will depend much on the age of the class. With young ones, the
teaching will be more narrative and biography; the memory and imagination will be
chiefly called into play. Some outline or short history should be read by the child, the
most prominent events, etc., should be entered in a special historical map. The
chronological, as well as the geographical atlas, should always be at hand. The teacher
should go quickly round the class, asking each child a few questions, just to ascertain
whether the work has been properly prepared, then she should fill up herself such
parts as will come home to the class. For young classes, though some passages from
good histories may be read, the teacher must be prepared to give a great deal viva
voce. Little children do not take in so well what is written for older people, the words
are not adapted to them, nor the mode of expression. Besides, the teacher’s eye is
occupied, she does not see whether she is holding the attention of her class. True, her
words may not be quite well chosen, but she will be able to make the narrative more
life-like to those whose minds she knows. But she must on no account try to learn it
up. If she would relate well, she must conjure up the scene before her own mind,
carefully paint in the details, and then describe her own vision, watching the children
to see if they, too, take it in.
But all must not be told; as far as may be, children should be led to anticipate. Thus
in a narrative of a campaign, generally so dry and unprofitable, the children should be
led to consider what were the aims, what would be the best way of carrying out
operations, what posts would be occupied, which leader chosen, how the money
would be raised, etc. They will take great delight in finding out these things, and not
easily forget what they have discovered; it will accustom them to read in an intelligent
way, so they will be able to predict to some extent what people are likely to do.
The elder classes should read some large history, if possible
With senior classes.
some original authority, and thus learn to read for themselves, to
examine the statements set before them, and to sift evidence. The
characters of Richard II. and Richard III., of Mary Queen of Scots and Elizabeth, of the
Stuarts and Cromwell, of Laud and Bacon, will form good exercises in the discussion of
probabilities, and teach caution and moderation in the judgments of daily life. For
elder classes, too, we may make great use, not only of Shakspere, but of the best
historical novels. For the teaching of higher classes I may point to the following papers
and add also a chapter on time-maps.

TEACHING MODERN HISTORY TO SENIOR CLASSES.


By Alice Andrews.

Girls,
Knowledge is now no more a fountain seal’d;
Drink deep, until the habits of the slave,
The sins of emptiness, gossip and spite
And slander, die.
The Princess.

In teaching history our aim should be not to miss the “spirit” of the
Introductory.
period we are taking. We have to inquire what forces are at work
moulding the character of the nation, and to estimate the results they
produce. We have to find the place our period holds in building up the national history.
Each period has a heritage from the past, each hands on its legacy for the future—of
warning from failure or from a success which is more disastrous than failure—of
encouragement from victories, not necessarily of the battlefield, and which perhaps
were won at the cost of noble lives willingly, even joyfully, offered.
There have been periods of ignoble wars, such as the Hundred Years’ War, when
Englishmen were brutalised by murder and rapine, ruining a people too deeply sunk in
misery to defend themselves. And retribution overtook the nation as it overtakes the
individual. Our own Wars of the Roses were the fruit of the unjust wars in France.
There have been periods of ignoble peace, when “peace with dishonour” might have
been England’s motto, when foreign troops were subsidised to protect the shores that
Englishmen were too craven-hearted to defend themselves, when enthusiasm was
ridiculed as “mock patriotism,” and political reformers were nicknamed “boy patriots”.
Corruption was reduced to a system, and Walpole believed that every man had his
price. The Church was paralysed by spiritual deadness.
Individual men stand out as warnings or examples. Richard II. appears first as full of
noble impulses, a born leader of men, but his crime determines his life. To rid himself
of the man who knows his crime, he banishes Norfolk for life; the other, who suspects
it, he banishes for a term of years, and this is reduced at the intercession of old Gaunt.
Either the punishment was, or was not, just. If just, it ought not to have been reduced
on petition; if unjust, it ought never to have been inflicted. Henceforward Richard
rapidly deteriorates: he seizes Gaunt’s lands in spite of his promise to the absent
Bolingbroke, in spite of the warning of his uncle York:—
Take Hereford’s rights away and take from Time
His charters and his customary rights...
You pluck a thousand dangers on your head,
You lose a thousand well-disposed hearts,
And prick my tender conscience to those thoughts
Which honour and allegiance cannot think.
Richard has himself set the example of disregard of others’ rights, and makes it
possible for Bolingbroke to return in the name of justice and raise the country against
the king.
The teacher of history in the older classes ought to be able to
Previous knowledge.
assume a correct knowledge of the most important facts and dates
at least in English history. These are very easily learnt in childhood
and most difficult to acquire by older girls. Those who have been trained on the
historical chart are acquainted with the main characteristic of each century, and the
principal events in it, and have no difficulty in grouping fresh knowledge round central
well-known facts, just as the geographical student can fill in with increasing
completeness a map from memory. Comparatively few are trained in any knowledge of
foreign history, and I have known not a few grown-up girls find the greatest difficulty
in mastering the leading names and events in French and other European history. In
this respect other nations are beyond us. Foreign girls, both French and German, are
trained to connect the history of their own country with the general course of events,
and know the facts of European history as a whole. The absence of this knowledge in
English girls makes the study of foreign policy unnecessarily difficult to them.
In outline history, paint with a thick brush. “One can’t see the
Continuity of history.
wood for the trees in it” might too often be the criticism of the
pupil on a lesson. The conscientious teacher tries to omit nothing,
the consequence in the pupil’s mind is blind confusion. The principle of selection rules
here if anywhere. We must aim at avoiding the defect which Lord Acton denounces as
“the want of an energetic understanding of the sequence and real significance of
events, which ... is ruin to a student of history. It is playing at study (he continues) to
see nothing but the unmeaning and unsuggestive surface as we generally do.” We
want instead to trace in broad outline the continuity of history—for instance, look at
the Wars of the Roses in this light. How do they stand in relation to constitutional
development? While the nobles were at war, the commons were gaining victories,
bloodless it is true, but more lasting than any gained on battlefields. It was a time of
immense constitutional development. And yet these victories were practically worthless
for the moment. What advantage was it to the victim of the “overmighty subject” that
the Statute Book provided for his rights and liberties? The “Paston Letters” give a vivid
picture of the impotence of the ordinary subject to get the law enforced. What the
country needed was strong government, not political privileges. “Constitutional
development had outrun administrative order,” had outrun, that is to say, the general
point of development reached by the nation at large, and the Tudors came in, so to
speak, on the programme of strong government. The Tudor rule represented the two
great principles of orderly administration and even-handed government. It needed a
dictatorship to accomplish the task. The task was completed at the Armada, and the
country took back the trust at the accession of the Stuarts. That the Stuarts failed to
recognise this, was the cause of the long constitutional struggle that culminated in the
Civil War. Once more constitutional development proceeds, but now the nation is
keeping pace with it.
The subject of sectional as opposed to chronological
Topical or sectional arrangement.
teaching seems to belong here, for upon it depends the
very essence of clearness in teaching. If pupils have
before them the time-map, or chronological chart, already referred to, the teacher can
with greater freedom treat the subjects sectionally, for before the eye of the pupil are
grouped all the parallel events in each square representing some definite space of
time. To teach chronologically may seem more accurate perhaps, but really too often
produces hopeless confusion in the mind of the pupil—the thread is lost in taking up
many different subjects, e.g., in Elizabeth’s reign, I would take as separate sections
her relations with Scotland, necessitating a review of Scotch affairs generally, and the
series of plots for releasing Queen Mary; Elizabeth’s policy with regard to (a) the
Anglican Church; (b) Roman Catholics; (c) Protestant Nonconformists; her Irish policy;
her foreign policy illustrated by her “courtships”; the domestic history of the reign and
so on. The different sections touch sometimes, but it only adds to the interest to
illustrate the new section from one already known. So in the Seven Years’ War, I would
not follow the course of events for each separate year on the Continent and in America
and in India, but I would take the whole course of the war in Europe, explaining why it
was not only justifiable but a stroke of genius in Pitt, to do what he had himself
denounced in the “Hanover-troop minister,” and by utilising foreign troops for
England’s war on the Continent, set her free to follow her true interests in the
colonies, and I would trace as separate sections the laying of the foundations of her
world-empire in India and in Canada.
This method of teaching presupposes that a scheme has been
Syllabus of lessons.
drawn out for the course. If possible the scheme should be given to
the class in the form of a syllabus of the lessons. If printing is too
expensive, it is worth while to cyclostyle copies oneself. The value the class attaches to
them is sufficient reward for the trouble, and they become a model to the girls on
which to arrange their own study of history in post-school days. Examples of such a
syllabus for English history and French history lessons will be found at the end of the
paper.
The historical map ought to be the inseparable
Illustrations: (a) Historical atlas.
accompaniment of the history lesson, and in this respect
there is nearly everything to be wished for. Good wall
maps with bold colouring in which the outlines of different territories can be seen from
a distance, and in which the names are clearly printed in English, have yet to be
found. To use a modern map in doing French outlines or other continental history is
most misleading, and yet too often this is all the teacher has at hand. There is Sprüner
of course, but even if the school can afford these expensive maps, they are not very
satisfactory for the ordinary class; the colouring is not distinct, and the map is so
overcrowded with names that it is difficult to find at a glance the places one wants.
They are rather for private and minute study than for class work. The publisher’s
explanation is that there is not a sufficient demand to make it worth while to bring out
historical maps, an incidental illustration of how little attention is given in English
schools to continental history, while a class map of the Roman Empire can be found
everywhere. At present the teacher is forced to make her own maps. If she is happy
enough to have old pupils with a talent for map-drawing, she can gradually make a
collection of maps enlarged from those in good histories; the maps in Kitchin’s History
of France are invaluable for this purpose, but Kitchin provides nothing for the periods
of the Italian expeditions, and these have to be adapted from Sprüner.
Gardiner’s Student’s Atlas provides what is necessary for the pupil in the English
history class; there is a small cheap German atlas for general history (Putzger, 2
marks), but it is not very satisfactory for the ordinary English schoolgirl, the difference
in the names is puzzling. What is wanted is a student’s atlas for continental, especially
French history, at a reasonable price.
But even given the atlas, it remains for the teacher to find an unfailing receipt by
which to ensure its use.
Not the least part of the value of a syllabus in the hands of a pupil, is
(b) Blackboard
the saving of time it makes in the lesson, otherwise the blackboard
must be used for unfamiliar names and words. The merest glance
through a pupil’s rough notes of French history will be a sufficient proof of this.
Besides the text-book, which every pupil
(c) First-hand acquaintance with
should possess, no teacher of older girls will be authorities.
satisfied unless they read at least passages from
the authorities on the period. The difficulty is to provide a sufficient number of copies
for a large class, or any copies at all, beyond those possessed by the teacher or the
school: this difficulty, however, may be met. There are always girls who are glad to
have good books suggested for Christmas or birthday presents, and who begin a really
nice library of their own in this way. But a class-library can be formed without much
trouble. The nucleus of a class-library being made by the necessary books for one
year’s work, the girls can be asked to leave a similar legacy for their successors. A list
of books wanted, with their prices, can be prepared, and it will be found that several
will combine to give really expensive books, and in this way the class can command
the use of sets of Stubbs, Froude, Gardiner, Ranke, Lecky, etc., besides smaller books
like the Great Statesmen Series.
Since it is impossible for girls with their limited time to read the whole of the big
histories, the teacher will find it a valuable practice to dictate the numbers of the
pages (in one or more volumes) bearing upon her lesson, which the girls should read.
They are thus trained to use authorities, and this is being recognised more and more
as of the first importance. There was a time when girls depended entirely upon their
notes, and the misspelling of names of historians showed that their knowledge of
great writers was second-hand. But when they get a first-hand acquaintance with
historians like Froude, Gardiner, Seeley, Ranke, Lecky, they are insensibly being trained
to be satisfied with nothing but the best.
The period should be studied by the teacher, and
(d) Contemporary writings: chronicles.
to a certain extent by the pupil, in contemporary
writers. Chronicles are delightful reading. Who that
has once learnt to know Saint Louis of France in the pages of his faithful seneschal,
can fail to breathe the very atmosphere of the time? De Joinville shows him what a
later preacher called him, “the most loyal spirit of his age”. Again no weighty
dissertations on the small account in which human life was held in the Middle Ages
would be so convincing as the incidental contemptuous remarks of the courtier-
chronicler Froissart. The exquisite courtesy to a De Ribeaumont was quite compatible
with the halters for the six citizens of Calais. And to take one more illustration quite
late on in the centuries—what a gulf separates ante-Reform times from our own! How
expressive of the haughty landed aristocrat are these words of the Duchess of
Buckingham after condescending to listen to the Wesleyan preaching: “I thank your
ladyship for the information concerning the Methodist preachers. Their doctrines are
most repulsive and strongly tinctured with impertinence and disrespect towards their
superiors, in perpetually endeavouring to level all ranks and to do away with all
distinctions. It is monstrous to be told that you have a heart as sinful as the common
wretches that crawl the earth. This is highly offensive, and I cannot but wonder that
your ladyship should relish any sentiments so much at variance with high birth and
good breeding.”
Full lists of contemporary writers will be found in Traill’s volumes on Social England,
which as “a record of the progress of the people in Religion, Laws, Learning, Arts,
Industry, Commerce, Science, Literature and Manners, from the earliest times to the
present day,” meets perhaps the greatest want of the ordinary teacher, to whom no
one general history of social progress was before accessible.
As illustrations there are also historical portraits, contemporary
(e) Historical pictures.
pictures of historic scenes, and pictures of costumes. Most
schools now subscribe to the “Art for Schools Association,” and
can make a very good portrait gallery of their own. The splendid collection of historical
costumes designed by Mr. Lewis Wingfield for the Healtheries can still be seen, I
believe, and a few of them have been reproduced by him in a book with descriptive
letterpress. Exhibitions, like the Tudor and Stuart, are most valuable to the realisation
of history, and visits to historical buildings are within the possibilities of most, and add
great zest to many a holiday both for teachers and girls. It is impossible to forget the
circumstances of the Dauphin’s coronation at Rheims, after staying where Joan of Arc
stayed and standing in the cathedral, where she witnessed the fulfilment of her
mission.
Passages from historical poems or from a
(f) Historical poems, Shakspere’s plays,
Shakspere play often add to the interest of a historical novels.
lesson; as the challenge-scene from Richard II.,
the trial-scene from Henry VIII., Milton’s sonnet on the massacre in Piedmont,
Spenser’s Gloriana and the false Duessa for Elizabeth and Mary Queen of Scots. And in
quite modern history Mrs. Hamilton King’s Disciples, Swinburne’s Songs before Sunrise,
Mrs. Browning’s Peace of Villafranca, all give expression to the passionate longing for
freedom of Italy.
Perhaps nothing makes history more real than a good historical novel. Bulwer-
Lytton’s Last of the Barons makes the figure of Warwick as lifelike as that of any
minister of our own day. Edward IV., Clarence, Richard III. have each their
individuality, and so has that shadowy prince who was killed at Tewkesbury, while
Isabella Neville stands out for ever distinct from her gentle, timid sister Anne.
John Inglesant gives the very spirit of the Charles I. period—cavaliers and ladies
coquetting with the classics in the learned Oxford halls, the devotion, even to the
death, of the Jesuit-trained John Inglesant, and the midnight apparition of the
murdered Strafford to the king, for whom he had laid down his life.
It is quite worth while to put up a list of historical novels bearing on their period, for
older as well as for younger classes.
How are we to test the work done by the pupils? Lord
Home-work: (a) Viva-voces.
Acton quotes from Sir W. Hamilton: “I must regard the main
duty of a professor to consist, not simply in communicating
information, but in doing this in such a manner and with such an accompaniment of
subsidiary means, that the information he conveys may be the occasion of awakening
his pupils to a vigorous and varied exertion of their faculties”.
By means of viva-voce questions and paper work, the class should be tested
between each lecture. The object of the teacher is to find out with as little expenditure
of time as possible, that the work set has been thoroughly done. I know no better
means of doing this than by what are called written viva-voces. The teacher prepares
two sets of questions called respectively A and B. The alternate girls write the answers
to the A and B questions in small exercise books which they keep for the purpose.
They rule two margins, the left-hand for the number of the question, the right-hand
margin is used by the corrector. Ten minutes can test an hour’s lesson. The books are
changed so that the Bs correct the work of the As, and have to attend to the answers
of the questions they did not do. The teacher repeats aloud the answer to each
question. Each corrector signs her name and puts the mark obtained. The teacher,
when she looks through the books afterwards, can thus bring home any careless
correction to the right person, and anything like favouritism in correcting is prevented.
This viva-voce work ensures accurate knowledge of facts, and I have known girls find
it sufficiently useful, to continue the same system among themselves after they have
gone up to the university.
The most valuable exercise for the pupil is the writing of essays.
(b) Essay-writing.
These may begin on a subject already dealt with in class (care being
taken that the essay is not a reproduction of notes of the lesson),
but the pupil will soon be trained to read and think out for herself subjects which she
has not previously heard discussed. She will learn experimentally what Lord Acton
calls, “those shining precepts which are the registered property of every school, that is
to say, learn as much by writing as by reading; be not content with the best books,
seek sidelights from the others; have no favourites; keep men and things apart; guard
against the prestige of great names; see that your judgments are your own and do not
shrink from disagreement; no trusting without testing; be more severe to ideas than to
actions; do not overlook the strength of the bad cause or the weakness of the good”.
The giving back of the essays ought to be a very valuable lesson. Happy passages
should be read aloud, weak passages criticised, each paper estimated as a whole, and
the pupil ought to leave the class, feeling that if the work were to be done again, she
at least understands the general drift of the subject and could treat it more adequately
than before.
I venture to illustrate my meaning, the subject set being a discussion of the policy of
Francis I. in his relations with Charles V. The essay should show that Francis I., like his
predecessors in the Italian expeditions, Charles VIII. and Louis XII., failed to realise in

You might also like