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

Instant ebooks textbook Introducing Delphi ORM: Object Relational Mapping Using TMS Aurelius John Kouraklis download all chapters

TMS

Uploaded by

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

Instant ebooks textbook Introducing Delphi ORM: Object Relational Mapping Using TMS Aurelius John Kouraklis download all chapters

TMS

Uploaded by

drnekmbiabo
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/ 55

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

Introducing Delphi ORM: Object Relational Mapping


Using TMS Aurelius John Kouraklis

https://textbookfull.com/product/introducing-delphi-orm-
object-relational-mapping-using-tms-aurelius-john-kouraklis/

OR CLICK BUTTON

DOWNLOAD NOW

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


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

Introducing Delphi ORM Object Relational Mapping Using TMS


Aurelius 1st Edition John Kouraklis

https://textbookfull.com/product/introducing-delphi-orm-object-
relational-mapping-using-tms-aurelius-1st-edition-john-kouraklis/

textboxfull.com

Object Oriented Data Structures Using Java 4th Edition


Dale

https://textbookfull.com/product/object-oriented-data-structures-
using-java-4th-edition-dale/

textboxfull.com

Tracking and Mapping of Spatiotemporal Quantities Using


Unicellular Swarm Intelligence: Visualisation of Invisible
Hazardous Substances Using Unicellular Swarm Intelligence
1st Edition John Oluwagbemiga Oyekan (Auth.)
https://textbookfull.com/product/tracking-and-mapping-of-
spatiotemporal-quantities-using-unicellular-swarm-intelligence-
visualisation-of-invisible-hazardous-substances-using-unicellular-
swarm-intelligence-1st-edition-john-oluwagbemi/
textboxfull.com

Delphi Cookbook Teti

https://textbookfull.com/product/delphi-cookbook-teti/

textboxfull.com
Object Orientation Abstraction and Data Structures Using
Scala Second Edition Lacher

https://textbookfull.com/product/object-orientation-abstraction-and-
data-structures-using-scala-second-edition-lacher/

textboxfull.com

Introducing Cognitive Analytic Therapy Principles and


Practice of a Relational Approach to Mental Health 2nd
Edition Anthony Ryle
https://textbookfull.com/product/introducing-cognitive-analytic-
therapy-principles-and-practice-of-a-relational-approach-to-mental-
health-2nd-edition-anthony-ryle/
textboxfull.com

Practical object-oriented design: an agile primer using


Ruby Second Edition Metz

https://textbookfull.com/product/practical-object-oriented-design-an-
agile-primer-using-ruby-second-edition-metz/

textboxfull.com

Introducing cognitive analytic therapy principles and


practice of a relational approach to mental health Second
Edition. Edition Anthony Ryle
https://textbookfull.com/product/introducing-cognitive-analytic-
therapy-principles-and-practice-of-a-relational-approach-to-mental-
health-second-edition-edition-anthony-ryle/
textboxfull.com

A Beginner’s Guide to Scala, Object Orientation and


Functional Programming John Hunt

https://textbookfull.com/product/a-beginners-guide-to-scala-object-
orientation-and-functional-programming-john-hunt/

textboxfull.com
Introducing
Delphi ORM
Object Relational Mapping Using
TMS Aurelius

John Kouraklis
Introducing Delphi
ORM
Object Relational Mapping
Using TMS Aurelius

John Kouraklis
Introducing Delphi ORM: Object Relational Mapping Using TMS Aurelius
John Kouraklis
London, UK

ISBN-13 (pbk): 978-1-4842-5012-9 ISBN-13 (electronic): 978-1-4842-5013-6


https://doi.org/10.1007/978-1-4842-5013-6

Copyright © 2019 by John Kouraklis


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Steve Anglin
Development Editor: Matthew Moodie
Coordinating Editor: Mark Powers
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505,
e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for reprint, paperback, or
audio rights, please email [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available
to readers on GitHub via the book’s product page, located at www.apress.com/9781484250129.
For more detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
To my dream Anna
Table of Contents
About the Author���������������������������������������������������������������������������������xi

About the Technical Reviewers���������������������������������������������������������xiii

Introduction����������������������������������������������������������������������������������������xv

Chapter 1: In the Land of ORM��������������������������������������������������������������1


Communication Between Incompatible Systems��������������������������������������������������2
ORM Frameworks�������������������������������������������������������������������������������������������������6
ORM Terminology��������������������������������������������������������������������������������������������������8
Entity���������������������������������������������������������������������������������������������������������������9
Properties��������������������������������������������������������������������������������������������������������9
Associations��������������������������������������������������������������������������������������������������10
Criteria�����������������������������������������������������������������������������������������������������������10
Projections�����������������������������������������������������������������������������������������������������11
Container�������������������������������������������������������������������������������������������������������11
Putting It All Together������������������������������������������������������������������������������������12
Workflows�����������������������������������������������������������������������������������������������������������14
Code-First Workflow��������������������������������������������������������������������������������������14
Model-First Workflow������������������������������������������������������������������������������������15
Database-First Workflow�������������������������������������������������������������������������������16
Choosing Workflows��������������������������������������������������������������������������������������������16
Summary������������������������������������������������������������������������������������������������������������17
References����������������������������������������������������������������������������������������������������������17

v
Table of Contents

Chapter 2: TMS Aurelius���������������������������������������������������������������������19


Installation����������������������������������������������������������������������������������������������������������19
Trial Version���������������������������������������������������������������������������������������������������20
Licensed Version�������������������������������������������������������������������������������������������23
Database Connectivity����������������������������������������������������������������������������������������30
IDBConnection�����������������������������������������������������������������������������������������������31
ORM Paradigm in Aurelius����������������������������������������������������������������������������������42
Entity�������������������������������������������������������������������������������������������������������������42
Properties������������������������������������������������������������������������������������������������������44
Associations��������������������������������������������������������������������������������������������������49
Object Manager (Container)���������������������������������������������������������������������������57
Criteria�����������������������������������������������������������������������������������������������������������58
Projections�����������������������������������������������������������������������������������������������������62
Automapping�������������������������������������������������������������������������������������������������67
Summary������������������������������������������������������������������������������������������������������������68
References����������������������������������������������������������������������������������������������������������68

Chapter 3: Call Center Application������������������������������������������������������69


The Application���������������������������������������������������������������������������������������������������69
Dashboard�����������������������������������������������������������������������������������������������������71
Departments��������������������������������������������������������������������������������������������������72
Agents�����������������������������������������������������������������������������������������������������������73
The Interface�������������������������������������������������������������������������������������������������������74
Entities����������������������������������������������������������������������������������������������������������������75
Database Connection������������������������������������������������������������������������������������������85

vi
Table of Contents

IDatabaseSession������������������������������������������������������������������������������������������������87
Summary������������������������������������������������������������������������������������������������������������92
Reference������������������������������������������������������������������������������������������������������������92

Chapter 4: Basic Operations���������������������������������������������������������������93


Adding Entities����������������������������������������������������������������������������������������������������93
Listing Entities����������������������������������������������������������������������������������������������������96
Editing (Updating) Entities���������������������������������������������������������������������������������102
Managing Blobs������������������������������������������������������������������������������������������������108
Deleting Entities������������������������������������������������������������������������������������������������116
Importing Entities����������������������������������������������������������������������������������������������118
Summary����������������������������������������������������������������������������������������������������������123

Chapter 5: Querying the Database����������������������������������������������������125


Listings�������������������������������������������������������������������������������������������������������������125
Departments������������������������������������������������������������������������������������������������125
Agents���������������������������������������������������������������������������������������������������������130
Queries (Dashboard)�����������������������������������������������������������������������������������������134
Average Satisfaction Score (%)�������������������������������������������������������������������136
Weeks����������������������������������������������������������������������������������������������������������137
Total Calls����������������������������������������������������������������������������������������������������142
Answer Speed���������������������������������������������������������������������������������������������143
Abandon Rate����������������������������������������������������������������������������������������������144
Calls/Minute������������������������������������������������������������������������������������������������145
Calls Answered in Less Than 180 Seconds�������������������������������������������������146

vii
Table of Contents

Calls with Satisfactory Score Less Than 3��������������������������������������������������147


Agent Statistics List�������������������������������������������������������������������������������������148
Views����������������������������������������������������������������������������������������������������������������150
Summary����������������������������������������������������������������������������������������������������������165

Chapter 6: Enhancements�����������������������������������������������������������������167
Inheritance��������������������������������������������������������������������������������������������������������167
Events���������������������������������������������������������������������������������������������������������������177
OnInserting and OnUpdating Events������������������������������������������������������������178
OnInserted and OnUpdated Events��������������������������������������������������������������186
TAureliusDataSet�����������������������������������������������������������������������������������������������189
Criteria-Based Data Set�������������������������������������������������������������������������������191
View-Based Data Set�����������������������������������������������������������������������������������193
Summary����������������������������������������������������������������������������������������������������������195

Chapter 7: Aurelius on the Move������������������������������������������������������197


Data Accessibility����������������������������������������������������������������������������������������������197
Local Database�������������������������������������������������������������������������������������������������199
Remote Server–Based Database����������������������������������������������������������������������201
Client Side���������������������������������������������������������������������������������������������������203
Server Side��������������������������������������������������������������������������������������������������214
XData����������������������������������������������������������������������������������������������������������������214
Summary����������������������������������������������������������������������������������������������������������223
References��������������������������������������������������������������������������������������������������������223

viii
Table of Contents

Chapter 8: TMS Data Modeler�����������������������������������������������������������225


The Application�������������������������������������������������������������������������������������������������225
Model-First��������������������������������������������������������������������������������������������������������227
Database-First��������������������������������������������������������������������������������������������������233
Export to Aurelius����������������������������������������������������������������������������������������������236
Entities���������������������������������������������������������������������������������������������������������237
Dictionary����������������������������������������������������������������������������������������������������241
Events����������������������������������������������������������������������������������������������������������244
Summary����������������������������������������������������������������������������������������������������������248

Index�������������������������������������������������������������������������������������������������249

ix
About the Author
John Kouraklis started exploring computers when he was 16 and since
then has followed all the way from Turbo Pascal to the latest Delphi
versions as a hobby initially and as a profession for most of his adult life.
He has developed a wide range of applications, from financial software
to reverse engineering tools, including an application for professional
gamblers. He is also the author of MVVM in Delphi (Apress, 2016).

xi
About the Technical Reviewers
Wagner Landgraf holds a Bachelor of Science
in Electronic Engineering and a Master of
Science in Industrial Computing.
He has 24 years of experience with Delphi
development and is the Manager of TMS
Business product line at TMS Software, where
he serves as Architect and core developer
of products such as TMS Aurelius and TMS
XData.

Nick Hodges is a Software Development


Manager at Gateway Ticketing Systems, a firm
that provides ticketing and access control
systems to the largest amusement parks,
zoos, and museums around the world. Nick
is a software developer at heart. He’s been a
Pascal/Delphi developer for over 20 years and
still thinks that Delphi is the best development
tool out there. He loves to read programming books, attend conferences,
and watch cool videos about new programming techniques. He generally
tries to be an industry thought leader.

xiii
Introduction
Modern software development techniques rely almost exclusively on object-
oriented programming (OOP). This approach promotes a specific paradigm
that sees fundamental design units (objects) as containers that encapsulate
both data and logic (code) and, in many instances, indicates how specific
data that stem from business logic should be mapped. This convoluted view
contradicts with the other important pillar of information age: the databases.
Storing data and managing databases take developers to a world
with different design principles and concepts. Table design, SQL query
optimization, and joined table operations are only a few notions that
indicate the existence and requirement of different skill sets. On top of this,
if one considers the abundance of database engines available in the market
and the technical specificity of each one of them, it is not hard to realize
the challenges software developers may face given the fact that modern
applications rely on the ability to store data in a persistent medium.
Object relational mapping (ORM) frameworks attempt to bring the
two worlds of OOP and databases together and provide a toolbox which
abstracts the specific requirements of each database. As a result, developers
are free to focus on ways to raise business value of their software solutions
rather than consuming resources in understanding how to make databases
work. ORM promotes reusable coding, automation and standardization of
data-related processes, separation of concerns as data access and layers are
isolated, and abstraction of database engines; this means that coders who
employ ORM libraries are free to switch between databases or even employ
different databases without changing a single line of code.
TMS Aurelius is an ORM library developed by TMS Software and
targets the Delphi development environment. It is a modern, robust, and
efficient approach to the use of databases in an OOP fashion.

xv
Introduction

This book is dedicated to Aurelius and the Delphi developers who want
to make the most out of the framework. It offers a guide in how to embed
Aurelius in Delphi projects and how to implement basic and advanced
queries, and it moves forward by showing how Aurelius can be used in mobile
platforms and in cooperation with third-party providers of JSON-based data.

Who This Book Is For


This book is the perfect companion to both newcomers to Aurelius and
to more experienced developers with the framework. It assumes some
knowledge of Delphi as it requires familiarity with the IDE and the features
of the language. Nevertheless, Aurelius is also available for Lazarus
and, therefore, this book appeals to Pascal developers who favor that
environment as well.
After reading this book, you will be able to

• Appreciate the different workflows related to the use of


databases as seen from the coder’s side

• Assess the different uses and features of TMS Aurelius

• Design applications which use TMS Aurelius

The Development Environment


The code presented in this book is developed using the following
environment:

• Embarcadero Delphi 10 Rio Professional

• Microsoft Windows 10 Professional

• FireMonkey framework

• TMS Aurelius 4.4

xvi
Introduction

• Android Nougat

• Steema TeeChart v2018 Standard Evaluation Version

I use the Professional version of Delphi, but I do not use any features
exclusive to this version. You can use whichever edition you have access
to. I also prefer to develop multi-device applications but this is not a
requirement; you can very easily use Aurelius in VCL applications as well.
The only exception to this is the projects that show how Aurelius can be
used in mobile platforms; these projects require FireMonkey.
Lastly, in Chapter 7, where Aurelius consumes data from remote
servers, I use TMS XData 4.5 Trial version and in Chapter 8 TMS Data
Modeler 3.3 is required.

The Book’s Structure


This book has eight chapters. It starts with basic theoretical concepts, then
proceeds to the introduction of TMS Aurelius, and as chapters develop it
gradually explores different features of the framework.

C
 hapter 1: In the Land of ORM
This chapter visits fundamental concepts of ORM frameworks and
explores different workflows related to them. It also provides a short
discussion of ORM terminology.

C
 hapter 2: TMS Aurelius
This chapter introduces TMS Aurelius. It starts by discussing different
versions and installation options of the product and shows how
the fundamental ideas in ORM that are presented in Chapter 1 are
implemented by the framework. This is the first exposure of the reader to
code related to Aurelius.

xvii
Introduction

C
 hapter 3: Call Center Application
This chapter introduces the CallCentre application. This is an application
that presents data from a call center and organizes it in different ways (by
department, by agent, etc.). The data set provides some great opportunities
to show how Aurelius features work.

C
 hapter 4: Basic Operations
In this chapter, we start with basic operations such as how to add, update,
and remove entries from the database. We, also, deal with managing
nullable and blob fields, and we see how Aurelius can execute large
number of SQL statements.

C
 hapter 5: Querying the Database
The topic of this chapter is how to build and expand on more sophisticated
queries that allow manipulation of data at database level. OOP would
indicate that calculations and grouping of data occur in code, whereas
database programming relies on the underlying database engine. In this
chapter, we see how Aurelius can bring the two together.

C
 hapter 6: Enhancements
This chapter looks at more advanced concepts in Aurelius (events,
inheritance) and visits the TAureliusDataSet.

C
 hapter 7: Aurelius on the Move
As mobile platforms and the Internet become essential part of application
development, this chapter takes the task to move Aurelius to mobile
platforms. The chapter shows what changes are required for this task and
explores different options in this direction.

xviii
Introduction

C
 hapter 8: TMS Data Modeler
TMS Data Modeler is a stand-alone application by TMS Software that
assists Aurelius users in many ways. This chapter explores the different
features of the application and shows how it can contribute to productivity
and efficiency.

C
 ode Files
This book comes with Delphi code files. You can access the code by
clicking the Download Source Code button located at www.apress.
com/9781484250129. Table 1 provides a summary of the project names
used in the book along with some notes.

Table 1. Project Names Per Chapter


Chapter Folder\Project Name Notes

Misc This folder contains


miscellaneous files that are
used in different chapters
(image files, data sets, SQL
scripts, etc.)
2 Chapter 2\BasicFeatures Demonstrates very basic
features in a console application
3 Chapter 3\CallCentre Provides a project that shows
(Skeleton) the GUI of the example
application. All the subsequent
projects are based on this one
(continued)

xix
Introduction

Table 1. (continued)
Chapter Folder\Project Name Notes

Chapter 3\CallCentre (Without Demonstrates the use of


Database Session) entities, connections, and
database manager
Chapter 3\CallCentre (With Replaces TDatabaseManager
Database Session) with IDatabase Session
4 Chapter 4\CallCentre (Without Adds the ability to provide basic
Utilities) operations to entities
Chapter 4\CallCentre (With Adds basic utilities to handle
Utilities) blobs and exceptions
Chapter 4\CallCentre (Import) Demonstrates how to set the
object manager in transactional
state
5 Chapter 5\CallCentre (Listings) Shows the call lists for agents
and departments
Chapter 5\CallCentre (Queries) Adds key calculations based on
queries
Chapter 5\CallCentre (Views) Demonstrates the use of views
6 Chapter 6\CallCentre Demonstrates different
(Inheritance) inheritance strategies in
Aurelius
Chapter 6\CallCentre (Events) Demonstrates the use of events
Chapter 6\CallCentre Demonstrates different ways to
(TAureliusDataSet) populate TAureliusDataSet
(continued)

xx
Introduction

Table 1. (continued)
Chapter Folder\Project Name Notes

7 Chapter 7\CallCentre (Local) Adapted project to run on


Android
Chapter 7\User A simple project to fetch
JSON content from third-party
providers
Chapter 7\Client Shows how to use Aurelius to
consume data based on REST
API from third-parties
Chapter 7\XData Demonstrates the use of
Aurelius and XData server
8 Chapter 8\CallCentre.dgp Data Modeler project

xxi
CHAPTER 1

In the Land of ORM


Object relational mapping (ORM) represents a set of techniques in
computer programming, which attempt to make incompatible systems
cooperate, communicate, and exchange information. At the same time,
they attempt to make the life of developers easier.
The systems in discussion are database systems and systems that
evolve from the dominant paradigm of object-oriented programming
(OOP). Databases are designed to store and provide access to various
data types in a persistent way. Data is stored in databases and outlives the
execution of the applications that use it. On the other hand, developers
that follow OOP principles think in a very different way when it comes to
the representation of data in their applications.
The design of database systems has advanced considerably over the
decades, and today databases represent both reliable and stable systems
which are found in almost every type of applications. The widespread use
of Internet, the domination of social media, and the ability to generate high
volume of data in real time and in high velocity (big data) have led to a
wide range of database systems with various degrees of sophistication and
implementation complexity. As a result, database administrators enjoy
a wealth of options – databases that follow the traditional relationship-­
based design (RDBMS/SQL) to systems without inherent structure like the
NoSQL database.
The design of relational database systems has served the information
world extremely well since their invention. Looking at the heart of
relational database management systems (RDBMS), one can observe

© John Kouraklis 2019 1


J. Kouraklis, Introducing Delphi ORM, https://doi.org/10.1007/978-1-4842-5013-6_1
Chapter 1 In the Land of ORM

though that the fundamental elements have not changed drastically in


terms of the way data is stored and considered. One of the most persistent
designs of databases is the type of data those systems are capable of
storing. Put simply, the vast majority of databases can manage data of
simple types (scalar). Data types like integers, chars, strings, bytes, and
dates are in their natural environment with databases.
On the other hand, developers in OOP see the world with the eyes
of nonscalar concepts as they are represented by objects. Objects have
attributes and properties (object-based design) but also provide mechanisms
to manipulate the behavior of objects via the concepts of polymorphism and
inheritance (object-oriented design). Polymorphism allows developers to
change the behavior of an object or a function depending on the associated
elements, and inheritance creates a form of hierarchy between objects
allowing common attributes and behavior. Objects, although a common
feature in modern programming languages, are quite complex in terms of
implementation and are not compatible with the way databases manage
data. Additionally, more complex structures like lists, maps, and dictionaries
found in programming languages and used every day by developers cannot
be mapped easily to the storage mechanism of databases (Mueller, 2013).

 ommunication Between Incompatible


C
Systems
Consider the example of a blog site. Users register and create posts. Posts
can have a number of tags or categories. From the database designer’s
point of view, users can be represented by the table Users, posts by the
table Posts, and tags and categories by the tables Tags and Categories,
respectively. Concepts like “a user owns several posts” and “posts have
many categories” are implemented by different types of relationships
(one-to-one, one-to-many, many-to-many). Figure 1-1 shows a simplified
database model for the blog site.

2
Chapter 1 In the Land of ORM

Figure 1-1. Simplified database model for a blog site

This representation is only a conceptual model. At database level,


database designers and administrators see the preceding model in terms
of records (rows in a table) and columns (fields of a table). A more accurate
representation would be Figure 1-2 where real content is being stored in
a database and presented in the form of records (rows). The relationships
that Figure 1-1 indicates are not visible at this level as they are forced by
the database engine. Moreover, one can observe the simple data types
the records hold. Although this is a simplified example, the values and,
therefore, their data types are representative of more complex situations.

3
Chapter 1 In the Land of ORM

Figure 1-2. Simplified database design and content for a blog site

This situation looks very different for a code developer who follows
OOP principles. The problem of keeping track of the users and their posts
becomes a problem of defining objects and the tags and categories of
the posts becomes a problem of choosing the right data structure of the
programming language that can hold this information and link it back to
the posts. In Delphi, and in most of the developed languages, Users and
Posts would be pure objects (TUser and TPost, respectively), whereas
Tags and Categories can be a list of strings represented by properties in
the TPost object. The following code demonstrates this approach:

type
  TUser = class
  private
    fName: string;
  public
    property Name: string read fName write fName;
  end;

4
Chapter 1 In the Land of ORM

  TPost = class
  private
    FCategories: TList<string>;
    FContent: string;
    FTags: TList<string>;
    FUser: TUser;
  public
    property Categories: TList<string> read fCategories write
fCategories;
    property Content: string read fContent write fContent;
    property Tags: TList<string> read fTags write fTags;
    property User: TUser read fUser write fUser;
  end;

This snippet suggests that if a developer wants to store data in a


database and, consequently, retrieve it, they must figure out how a
TList<string> or a TUser data type in TPost translates efficiently and
reliably to database tables. Moreover, the situation can increase in
complexity if one considers that the tags and categories can be objects
themselves (TTag and TCategory), which makes the TList<string> a
TObjectList<TTag> and TObjectList<TCategory>, respectively.
The preceding challenge of making two incompatible systems to
seamlessly communicate is amplified when one realizes the wide range
of database solutions that exist in the market both in the proprietary and
open source domains. The vast majority of RDBMS databases today use
SQL as the standard language to manipulate data. A closer look indicates
that although SQL is a standardized language, different database vendors
introduce their own SQL variations, constraints, and extensions apart
from the basic set of commands. This, in turn, means that the developer
who wants to manage TPost(s) in a database needs to be aware of the
underlying database engine and perhaps make adjustments when the
database is replaced by a different one.

5
Chapter 1 In the Land of ORM

Manipulating objects at database level introduces two more problems


that need to be resolved if OOP and databases are expected to work
reliably and correctly. One of the fundamental features of databases is their
ability to facilitate the access of data by multiple users and at the same
time (concurrency). For the OOP developer, the access of data by multiple
users poses the need of synchronizing the changes being made at database
level with any instances of the objects at programming level and vice versa.
In the preceding example, an instance of TPost will have a set of tags in the
Tags property. If a user adds a new tag and assigns it to the specific TPost
instance, the communication between the OOP version of the model and
the database should update the instance of TPost and perhaps the Tags
property. Similarly, if the code that uses the TPost instance allows the
user to add a new tag and assign it to the property Tags of this particular
instance, the database tables should be updated accordingly.
Concurrency, on the other hand, opens the possibility of corrupted
or partially saved data to the database. What may happen, especially in
environments where multiple people access the same database assets at
the same time, is that the users may edit the same piece of information for
the same record at the same time. This situation, in conjunction with the
previous one, can lead to challenges for the OOP developer.

ORM Frameworks
The previous discussion makes clear the fact that working out the
mentioned issues requires a substantial effort at the coding side. People very
often take the task of writing their own libraries to manage this situation
but soon realize that the task is not a trivial one as the details can be quite
complex and time-consuming. The solution to this problem is to use
dedicated libraries known as object relational mapping (ORM) frameworks.
ORM frameworks provide a middle layer between object-oriented code
and database operations (Hibernate, n.d.). They take the task of adapting

6
Chapter 1 In the Land of ORM

typical objects to forms that can be understood by database engines,


and they perform operations at both sides of the equation. These tools
create a set of virtual object database that map classic database structures,
can be understood by developers, and behave as expected in an OOP
environment. They also expose a form of API that allows typical operations
in a database to be performed at coding level and, in terms of database
connectivity, they do a great job to abstract the underlying database engine.
In a typical three-tier application where there is a separation between
the presentation, the business, and the data layers, ORM frameworks
lie inside the data layer (Figure 1-3) and, contrary to the common
presentation in books and articles, ORM frameworks can handle multiple
database sources.

Figure 1-3. The role of ORM frameworks in three-tier applications

7
Chapter 1 In the Land of ORM

The obvious advantage of ORM frameworks is to make the life of the


developers easier as they now can focus on implementing the business
logic their applications dictate rather than spending time on the technical
side of the storage mechanism.
ORM approaches are not without criticism. Although they are valuable
solutions, they have attracted negative comments by developers on the
basis of the complexity ORM introduces in its own right and the fact that
once an ORM framework is used, the code is tightly coupled with it and
carries all the trade-offs a specific ORM solution brings. I encourage you
to do your own investigation as there are many good posts on the merits
and drawbacks of ORM (Atwood, 2006; Fowler, 2012). The more you know
about the tools you use, the better you position yourself to take advantage
of those tools; and this is a general advice that goes beyond the scope of
ORM libraries.
The reality of the matter is that if your focus as developer is to produce
applications that implement some form of business logic which provides
value to your business and customers, you do not want to waste time,
effort, and, from company’s perspective, human resources to develop your
own solution that deals with the technicalities of databases. On the other
hand, if you are an ORM framework developer, the perspective is totally
different. ORM provides solutions to nearly 80% of the tasks you need to
accomplish at database level. If the remaining 20% of the tasks make a
significant difference to your business, then most likely you are part of a
team that develops frameworks.

ORM Terminology
In the field of ORM, there are a number of terms that we come across
repeatedly. Many terms originate from the ORM designers, and others are
borrowed from the world of databases. This section provides a summary of
the most commonly used terms in ORM solutions.

8
Chapter 1 In the Land of ORM

Entity
An entity is the complete set of data held by an application object
as defined by the developer in order to serve the needs of a specific
application. This data set replicates the data found in the underlying
database. A customer, an employee, or the blog posts from the previous
example are typical representatives of an entity. In the code, the objects
may hold more data and exhibit additional functionality than what is
required at database level, but the idea is that when you look at an entity
in the code, you have at the very minimum access to all the data in the
database that this entity is associated to. For the database administrator,
entities usually match to tables in the database, and an instance of the
object (entity) in the code corresponds to a row (record) in that table.
Additionally, entities in code are used for other purposes than just
to simply represent records in a table in the database. In databases, very
often designers encapsulate a logical perspective of data that requires the
combination of data found within different tables using keys and other
database elements. Quite often, this logic also dictates the need for a range
of calculations. In databases, this representation is implemented by views,
and at code level entities are used for this purpose as well.

Properties
Entity’s data is stored in properties in the same way that classic objects
use properties to hold data. As mentioned earlier, entities match database
tables and table records; therefore, those instances should be uniquely
identifiable by the ORM framework at the entity level. This is resolved by
assigning a property to act as unique identifier. This concept is basically
the same as the idea of primary keys in databases. One difference between
properties in entities and the underlying data in databases is that the first
ones can hold simple or complex data types.

9
Chapter 1 In the Land of ORM

Associations
Entities, like tables in databases, are generated in order to support a
model that derives from a business problem. Entities make sense in a
model when they form relationships that represent logical and conceptual
notions. These relationships are called associations in ORM frameworks,
and they are formed between one or more properties.
These properties in the ORM space are known as association
endpoints, and depending on the data types they can define the different
types of associations (cardinality) as represented by the common one-to-­
one, one-to-many, and many-to-many relationships. Although one-to-one
and many-to-many relationships can be described in theoretical terms
and implemented at database level, they hardly make business sense.
Therefore, in most of the entity frameworks, all associations represent
one-to-many (and vice versa) relationships, and if other relationship
cardinalities (one-to-one) are required, it is left to the developer to enforce
and filter them out.
Associations are always bidirectional so entities have full access to
each other. In many ways, at database level, endpoint properties work in
the same way as foreign keys do, and they behave in a way similar to joined
table operations.

Criteria
When developers want to fetch data from databases, they create query
statements using the relevant (SQL) language. The statements may or may
not filter the results of the query. At ORM level, queries are built based
on conditions that are passed to the underlying database engine. These
conditions, which can be generic or specific, are formed by attaching
criteria together. Most ORM frameworks provide a fluent interface
(Ramsay, 2008) to manage criteria (meaning that the building of the
query statement appears as a natural language to the user), and you can

10
Chapter 1 In the Land of ORM

typically expect to have criteria for all the useful relational comparisons
(e.g., greater than, equal, logical and, logical or, etc.) and sorting functions
for properties.

Projections
Although you can retrieve all the properties (columns) of a table data from
a database using ORM criteria, common programming practice indicates
that you should only fetch the properties that are required in each
situation. This type of queries is managed differently by ORM packages
than the typical criteria-based queries, and they are called projections.
Projections also allow programmers to drill down complicated data
structures and even perform some (basic) mathematical calculations (e.g.,
average, summation, etc.).

Container
ORM frameworks create a buffer between the code and the database.
When the user passes an operation to the ORM, the framework needs to
have access to the status of all of the data in the database. The framework
loads the relevant data in the memory in the form of entities or other
relevant data structures, performs the instructed operations, and then,
many times, pushes back the changes to the database. This snapshot of the
data is managed by an entity container. Before the developer can interact
with an entity, ORM libraries load any required data into a container. The
containers are usually short-lived as their purpose is to serve a specific set
of operations and lightweight as they need to be created and destroyed
several times in the life of an application. In many aspects, a container is
somewhat analogous to a database transaction.

11
Discovering Diverse Content Through
Random Scribd Documents
glowingly promised everything short of immediate evacuation and
complete independence.
The Commissioners wrote a polite little note to Señor Paterno and
said they were very sorry to find that it was not possible, under the
circumstances, for them to be present that evening.
Mr. Taft and General Wright were living together in the house that
my husband had secured for us, and they went home and had a
comfortable dinner in their everyday white linens and were enjoying
post-prandial talk on the cool verandah when Pedro Paterno came
rushing in and, figuratively, threw himself on his knees before them.
He begged them to come with him to the banquete; the crowd had
assembled; it was past nine o’clock; and he would be placed in a
terrible situation if the gentlemen of the Commission did not
reconsider their cruel decision. The gentlemen of the Commission
asked how about the carefully censored speeches. Paterno vowed
that no speeches at all should be delivered, that no word of any kind
should be said, but that they must show themselves to the people, if
only for a little while. All right. They quickly got into their hot
evening clothes and went down to the banquet hall. They sat through
a couple of silent, weary hours, took a few sips of wine, smiled a few
smiles, shook a few hands, and then went home. That was all there
was to it. But Pedro was discredited in both camps. His purpose had
been to have the speeches made before the Commissioners, claim all
the credit with his own people for getting the Commissioners there
and then to deny to the Commissioners all responsibility for the
occasion.
The forms of military government were being strictly observed;
there was a nine o’clock curfew and nobody was allowed on the street
after that hour without a pass. Mr. Taft wrote of several trying
experiences when he went out in the evening and forgot his pass and,
starting home about half past ten, was held up by one sentry after
another who demanded an explanation at the point of a gun.
Mr. Bryan was running for President at this time and he was
making a good deal of political capital out of the Philippine situation.
He had promised to call a special session of Congress, if he were
elected, to consider means for settling the Filipinos in immediate
self-government, and he had a large following of mistakenly altruistic
anti-imperialists supporting him. Mr. Taft was inclined to think that
the whole anti-American demonstration, which was to culminate in
the Amnesty Fiesta banquet, was planned by a Mr. Pratt, an
American politician then visiting Manila, who wanted the “grandly
patriotic” speeches to publish in American newspapers. They
probably would have been perfect material for the anti-imperialists
to grow sentimental over.
In the meantime Mr. Bryan’s promises and the possibility of his
being placed in a position to redeem them, were retarding
pacification. All that was needed to discourage the last of the
insurrectos was Mr. McKinley’s election, and the Presidential
campaign of 1900 was probably not watched anywhere with more
breathless interest than it was in the Philippine Islands.
Such were the lessons in letters that I got from my husband, and
my imagination was fired. He had great projects in hand. The
Commission proposed to establish municipal governments wherever
conditions made it possible and among the first things they
undertook was the framing of a municipal code upon which to base
such governments. They sent this to General MacArthur for his
comments, but his comments consisted in a rather pointed
intimation that military rule was still in force and that he thought
they were several years ahead of possibilities, but that they might go
on and amuse themselves since their municipal code would not deter
him in any action he found it necessary to take at any point where it
was in operation. All this was couched in most excellent diplomatic
language, of course, but it amounted to just that. An equally
diplomatic reply seems to have brought the General to a realisation
that the powers of the Commission were well defined, that their
object was peaceful pacification wherever it was possible and that
they would probably be supported by Washington in any reasonable
measures they might take to that end.
They had many plans already; a big general school system for the
organisation of which they had engaged a superintendent from
Massachusetts; good roads to open up the country for commerce;
harbour improvements; health measures; a reliable judiciary; a
mountain resort where American soldiers and civilians might
recuperate from tropic disease, thereby saving many lives to say
nothing of millions of dollars to the government in troop
transportation charges; and they were already attacking the vexed
friar question that had caused all the trouble in the first place.
The letters made me anxious to finish my visit in Japan and get
down to Manila where so much of vital and engrossing interest was
going on. My husband wrote rather discouragingly about the house
he had taken, but he was having some improvements made and,
though I did not expect to find comfort, I was sure I should manage
to get along. I had purchased in Japan a number of bright and
artistic objects in the way of house decorations and I thought that,
with these, I should be able to make almost any place look inviting.
The Boxer rebellion was troubling us more than anything else at
the moment. We wanted very much to go to Shanghai, but were told
that it would be absolutely unsafe for us to go anywhere in China
except to Hongkong. I didn’t know much about the East at that time
and was ready to believe anything that was told me. However, I
remembered that there were thousands of foreign residents in
Shanghai who were going on about their daily affairs much as if there
were no such thing as a Boxer. So we, too, decided to go on our usual
tranquil way and we set sail for Manila, via Shanghai and Hongkong,
on the Japanese steamer, Kasuga Maru, on the tenth day of August.
MRS. TAFT IN FORMAL FILIPINA
COSTUME
CHAPTER V
FIRST IMPRESSIONS OF MANILA

The China Sea has an evil reputation. On its shores one hears
much about the typhoon season and the changing monsoons, and
bad sailors would, no doubt, like to have their sailing dates
determined by the Weather Bureau; but this is not always possible.
The Kasuga Maru, on which we made the voyage from Yokohama
to Manila, lay in Hongkong Harbour while one of the great mid-
August storms tore up from the south and set skippers and seamen
agog with fears of dreadful conditions we would have to meet on the
trip across to Manila. In the China Sea there are cross-currents
which make for bad going at the best of times, and when they are
piled up by a typhoon into great, warring waves the result is likely to
be extraordinary.
My husband cabled me to take a larger vessel, a United States
army transport which left Hongkong about the same time we did, but
I was comfortably located with my family on the little Kasuga Maru;
the transfer of baggage was a troublesome task; and I figured that as
long as the Kasuga Maru had been afloat in south seas for a good
many years, she might be trusted to keep afloat for a few days longer.
We caught the calm between two storms. The sea had been beaten
down by torrential rains; and while great, smooth waves rose under
us and sent us rolling in a sickening zigzag all the way across, there
was in them no threat of destruction, and I really began to feel that
the China Sea had been maligned.
A feeling of intense curiosity got me out of my stateroom bright
and early on the morning of our arrival in Manila.
To the northward lay a stretch of unbroken, mountainous
shoreline; while we were headed for a narrow channel guarded by
rock islands against which the surf broke in clouds of spray.
“Corregidor,” said the skipper, pointing to a high, green hill behind
the rocks. Corregidor,—it was the first time I had ever heard the
name which since has become synonymous, in so many minds, with
Gibraltar. On the other side of the entrance to Manila Bay stood
Meriveles, a beautiful mountain, sloping gently back from the sea
and up into soft, white clouds. But Manila,—where was Manila?
Cavite,—where was Cavite? And where did the Spanish ships lie,
when Dewey sailed in past Corregidor not knowing what he would
find? Questions, these, which everybody asked in those days. Manila
was twenty miles ahead at the far end of the Bay, while Cavite, across
on the south shore, in the nearer distance, lay flat and almost
invisible under low-spreading trees.
Flat; that is the word which occurs to everybody who sails for the
first time into Manila Bay. The city is built on the lowlands; low, as I
afterward learned, to the point of being below sea-level in certain
places, and subject to sudden floods in the big typhoons. But far
behind the flats are towering ranges of blue and purple hills, with
here and there a softly rounded mountain standing, seemingly,
alone.
The hot sun beat down on the glassy surface of the Bay and sent
back a blinding glare which brought an ache into eyes and nerves,
but we were all too interested to seek shelter in the darkened cabin.
While our ship was still miles from shore we could see long lines of
low, red roofs and the white gleam of many domes and spires; and
off to the right we had pointed out to us the eloquent wrecks of some
of the Spanish fleet whose masts and battered hulks rose high out of
the shallow water in which they were sunk.
But for ourselves, for me, for Mrs. Wright, for Maria and the
children, the most important thing in sight was a little fleet of
harbour launches which came hurrying down the Bay to meet us. I
saw my husband and General Wright standing in the bow of one of
these long before they could pick us out in the crowd of passengers
lining the rails of the Kasuga Maru.
Then came the happy welcomings which make absences worth
while; excited children; everybody talking at once; explanations
begun and never finished; interruptions by customs officials—
American soldiers in those days; comments on the heat and the
bright white light, and laughing assurances that it wasn’t hot at all
and that the climate was perfect; transferring baggage to the launch;
glimpsing, occasionally, strange scenes and strange peoples; asking
and answering a thousand questions; busy, bustling, delightfully
confusing hours of landing in the farthest orient.
Our husbands turned themselves into willing “Baedekers” and
instructed us on the way. We steamed up in our little launch to the
mouth of the Pásig River, wide and deep and swift, and covered with
what looked to me like millions of small, green cabbages.
“Carabao lettuce; the river’s full of it,” explained Mr. Taft, but I
was much too occupied just then to stop and ask what “carabao
lettuce” might be.
We came up past a bristling fort at the corner of a great, grey,
many-bastioned and mediæval wall which stretched as far as I could
see down the bay shore on one side and up the river on the other.
“The Old Walled City,” said General Wright, and I knew at once
that I should love the old Walled City.
“The oldest parts of the walls were built in the seventeenth
century,” continued our animated guide-book, “and the fort on the
corner is Santiago. The big dome is the Cathedral and all the red tile
roofs are convents and monasteries. The twentieth century hasn’t
reached here yet. To all intents and purposes the Walled City is still
in the Middle Ages.” The truth is that only part of the walls are really
very old—some parts have been built within seventy years.
The river was full of strange craft; long, high prowed, cumbersome
looking boats, with rounded deck-houses roofed with straw matting
and painted in every conceivable colour and pattern, which, we were
told, were cascoes—cargo boats which ply the length of the Pásig and
bring down the cocoanuts and sugar-cane and other products from
the middle provinces. The only visible propelling power on these
cascoes—and the only power they have—are natives, naked to the
waist, armed with long bamboo poles upon which, having fixed them
firmly in the mud at the bottom of the river, they push steadily as
they walk the length of the narrow running board along the outer
edge of the deck. I should say they might make a mile in about two
hours.
Then there were the curious little bancas; narrow canoes, hewn
out of single logs and kept on an even keel, usually, by graceful
outriggers of bamboo.
Across the river from the Walled City is the Custom House, and
there, in a few moments, we drew up at a slippery, low, stone landing
and climbed ashore. My feet, at last, were on Philippine soil.
If I had, for the time being, forgotten that a war was going on I was
immediately reminded of it. The Custom House was in the hands of
the Military Government and it was surrounded by khaki-clad guards
who all stood stiffly at attention as my husband and General Wright
passed. All our necessary luggage had been released and put into the
hands of orderlies to be delivered, so we were free to start at once for
home.
My husband had written me that the Philippine horses and the
Philippine cockroaches were just about the same size, but I was
hardly prepared for the diminutive turn-out to which he proudly
escorted me. Two little brown ponies, no higher than my shoulder,
and with very shaggy manes and foretops, were hitched to a Victoria
which had been built to fit them. When I stepped in and sat down,
with Charlie on my lap, I felt twice my natural size and it seemed
impossible to me that there was still ample room for Mr. Taft.
On the box were two stolid little men, dignified by the titles of
coachman and footman. They each wore white linen trousers and
thin shirts which hung outside, making them look as if they had
forgotten a most important act in the process of dressing. Their bare
feet were thrust into heelless red carpet-slippers, while on their
heads were wide, flopping, shapeless straw hats which they did not
trouble to take off at our approach.
The streets were full of such conveyances as ours, and others of
varieties even more astonishing. Maria, with Robert and Helen,
followed in a quilez—a miniature, one-horse omnibus affair into
which the passengers climbed from the rear. Then there were
calesas, caromatas, carretelas and carabao carts.
The carabao carts interested me particularly, and there seemed to
be more of them than of anything else. The cart itself was nothing,—
just a few planks nailed together and balanced upon a pair of heavy,
broad, wooden wheels,—but the beast attached to it was really
extraordinary. The first carabao I saw had horns at least six feet
across. Indeed, they all have very long horns, and how they keep
from obstructing traffic in the narrow streets I never did understand.
They do obstruct traffic, as matter of fact, but not with their horns;
only with their slow motions. Nobody can possibly know just what
the word slow signifies until he has seen a carabao move. Great, grey,
thick-skinned, hairless beast; his hide is always caked with mud, and
he chews and walks at exactly the same pace while the half-naked,
sleepy driver on the cart behind him gives an occasional jerk on the
thin rope attached to the ring in his nose.
It was sometime before I came to know calesas, caromatas and
carretelas apart, though their only likeness lies in the fact that each
has two wheels and to each is attached one busy little bit of a horse.
The calesa and caromata are the better class vehicles, while the
carretela is a plebeian public carryall in which there always seems to
be “room for one more.” I saw dozens of these packed with Filipinos;
the driver—always and inevitably smoking—sitting close up behind
his horse and lashing it continually while it struggled sturdily along
and looked every minute as if it would be lifted off its feet by the
overbalancing weight behind it. It was something of a shock to see
many women, in carretelas and on the street, smoking huge black
cigars; while I noticed, immediately, that the men, as a rule, smoke
only cigarettes.
I didn’t look for speed from our little brown creatures, but I was
yet to become acquainted with the Philippine pony. We started off
over the rough cobblestones at a pace that was truly terrifying, and
everybody else seemed to be going at about the same rate. I expected
a collision every moment. Wheels passed wheels without an inch to
spare, and without an instant’s slackening of speed. My heart was in
my mouth until we got through the maze of narrow streets in the
wholesale district near the Custom House and came out into a wide
plaza which my husband informed me was the end of the Escolta, the
principal business street of the city. I was very glad we didn’t have to
drive through that; it was just about wide enough for two carriages to
pass, but it had a street-car track right down the middle, and it was
thronged. On the track was a jingling little horse-car which seemed
to get very much tangled up with the rest of the traffic.
I got an impression of a great variety of colour in which red and
yellow seemed to predominate. The soldiers were in khaki, the
officers and civilians were in immaculate white linen, while the
Filipino men and women of the ordinary class looked as if they had
made a heavy draft on the world’s supply of red and yellow muslin, to
say nothing of many calicoes of extravagant hues and patterns.
We hurried on around the corner and came again to the banks of
the river and the Bridge of Spain. Mr. Taft wanted me to know all
about everything right away, so he kept on busily explaining things to
me, but using so many unfamiliar words that I got only a hazy
impression after all.
But here was the Bridge of Spain, originally built in sixteen
hundred and something, the oldest monument to Spanish enterprise
in the Islands. And across on the other side we came abreast of the
inner wall of the city and whirled along awhile beside a wide,
stagnant moat. From the inner side I got a better idea of what the
Walled City was like, and I promised myself an early inspection of its
mysteries. I wanted to walk across the old drawbridges and through
the beautiful gateways which looked so ancient and were so
suggestive of piratical and warlike history.
“Those are the Botanical Gardens,” said Mr. Taft—“the man from
Cook’s”—making a general sort of gesture toward the other side of
the street. What I saw was a small gravelled park with some avenues
of fine palms, some other kinds of trees, and a few clumps of
shrubbery. We were driving under the low-hanging branches of some
magnificent old acacias, but everything looked neglected and run
down, and there didn’t seem to be a bit of grass anywhere; just
scorching sand and clay. It was really a relief to rest one’s eyes on the
awful green scum on the surface of the moat. Manila in those days
was not the beautiful, park-like, well-kept city that it has since
become. There were soldiers everywhere, and it seemed to me we
were being constantly saluted.
“And now we come to the far-famed Luneta,” said Mr. Taft, quite
proudly.
“Where?” I asked. I had heard much of the Luneta and expected it
to be a beautiful spot.
“Why, here. You’re on it now,” he replied.
An oval drive, with a bandstand inside at either end,—not unlike a
half-mile race track,—in an open space on the bay shore; glaringly
open. Not a tree; not a sprig of anything except a few patches of
unhappy looking grass. There were a few dusty benches around the
bandstands, nothing else;—and all burning in the white glare of the
noonday sun.
“Why far-famed?” I asked.
Then he explained in a way which made me understand that the
Luneta is not what it is, but rather what it stands for in the life of the
community. He said that in the cool of the evening there were bands
in the bandstands and that everybody in the world came and drove
around and around the oval, exchanging greetings and gossip, while
the children with their nurses played in the sand on the narrow
beach. It didn’t sound exciting to me, but I was afterward to learn
that the Luneta is a unique and very delightful institution.
We tore on at a terrific rate and came, at last, into a narrow
residence street where the rapid clatter of our ponies’ feet awoke
echoes from closely set houses which looked as if all their inhabitants
were asleep. And they were, of course, it being the siesta hour.
A CARVED NARA OR PHILIPPINE
MAHOGANY BED NOW IN MR. TAFT’S
ROOM AT NEW HAVEN

The houses were nearly all built in the Spanish style with high
stone basements—covered with mouldy whitewash—and frame
superstructures overhanging the street, and screened from the heat
and glare with finely woven, green bamboo curtains. Here and there
the “nipa shack” of the low class native had elbowed its way into this
fashionable neighbourhood, and through open spaces I caught
glimpses of wide stretches of thatch roofs in the near distance, where
hundreds of these inflammable huts were huddled together in
“native quarters.”
When the end of the street came in sight I began to wonder. It
seemed to me we had driven many miles.
“Well, where do we live?” I asked. “Have you taken a house in the
country?”
“Not quite,” said Mr. Taft, “but nearly.”
It was the last house in the street, surrounded by a very formidable
looking, high stone wall. The first thing I knew we had whirled
through a gateway and were driving past a row of soldiers who stood
at attention, with their guns held stiffly in front of them. I knew our
house had to be guarded, but it was something of a shock for a
moment, just the same, to see the guardhouse and the trim soldiers
with their business-like equipment.
If I had expected anything very fine or beautiful in the way of a
tropical garden, I was disappointed. I don’t know whether I did or
not. The wonder to me now is how Americans ever did succeed in
getting parks and gardens made. It only means that the Filipino has
learned, or is learning how to work. He always was willing to work, a
certain amount, but he didn’t know how. My husband’s description
of how he got a bit of grading done is typical. The first conclusion he
reached in Manila was that the people knew nothing about the value
of time, and it must have been a strain on his temperate-zone
nervous system to watch a squad of men at work in his garden.
They deposited the material—as usual—as far as they could from
the spot where it was to be used; then, one after another, barelegged,
bare bodied, incessantly smoking, they would take up small shovels
full of earth, carry them all the way across the garden, resting once or
twice on the way, dump the material somewhere in the vicinity of the
place where it belonged, then drag slowly back and repeat the
operation. This was the sort of thing which made Americans, in the
early days, dance with impatience; the sort of thing which made Mr.
Bryan’s campaign talk about “cheap” Filipino labour invading the
United States seem to us so utterly ridiculous. We knew that Filipino
labour was the most expensive labour in the world; since it took ten
men to do one American’s work.
My husband had written me about the difficulty he had had in
securing a suitable house, and had also explained that he was having
a number of repairs and changes made which, he hoped, would put
the place in good order by the time I arrived. The garden was large,
but it boasted neither lawns nor flowers of any kind. A few patches of
grass struggling with the hard white gravel and clay, and looking
pretty hopeless, nothing else. Around a curving drive we swung up
under a porte-cochère, over which hung a magnificent rubber tree,
and, stepping from the undersized Victoria onto the finest of white
marble steps, I found myself at home.
Our house was really the best that my husband could secure. When
he first looked at it he was certain it wouldn’t do at all. It belonged to
Chief Justice Arellano, and the army officer who went with him to
look for quarters assured him that it was the only thing in town that
he could possibly live in; but he didn’t believe it. It had been
occupied by army officers and had been greatly abused. Its furniture
was broken and piled in heaps; its walls were ragged; and its floors
were scarred and dirty.
“I’ll just have a look at some others,” said Mr. Taft.
And he did. He went all over town, and he says that every house he
looked at added some new, desirable aspect to the Arellano house,
until, finally, it became in his eyes a sort of palace which needed only
a touch here and there to make it quite perfect.
It backed directly on the Bay, and among the first things he did
was to have a sea-wall built which he thought added safety to the
top-heavy structure, but which, during the typhoon season, really
cost him more than it was worth. Every time a big wind came and
roughed up the Bay a little, a part of his wall went out. His first
complaint to me was that he had been “holding that wall down” all
summer, and that part of it was always sure to try to get away every
time he found himself particularly occupied with harassing
governmental difficulties.
He had had sod laid down between the house and the sea-wall, and
had watched it for awhile with a faith which should have been
rewarded, but the salt spray came dashing over it and he had to have
it carefully taken up and moved around to the sheltered side of the
house. Good sod was scarce in Manila in those days.
My husband was certainly glad to see me, and I don’t doubt that
General Wright was just as glad to see his wife. The two of them had
been “keeping house” together for three months under conditions
wholly new to them, and I gathered that they found a bachelor
existence rather complicated and, in certain details, annoying. In
some ways, after the manner of men, they had permitted the house
to run itself and I did not find it easy to break up the system which
had been inaugurated.
The house was not perfect, by any means, but it was big and roomy
and had what a woman knows as “great possibilities”; possibilities
which I found had to be slowly developed with the assistance of a
somewhat taciturn and not altogether willing ménage.
Coming in from the grand marble steps one passed up a short, but
spacious hardwood stairway into a wide central hall which opened
out on a tile floored verandah, overlooking the Bay and running the
entire width of the house. This verandah was enclosed by sliding
windows divided into panes about six inches square, not any two of
which were the same colour. All the other windows in the house were
made of beautiful, translucent pearl-shell in four inch sections—
more like screens than windows—which let in the light and kept out
the glare, but on the verandah the architect had tried to surpass
himself, with the result that royal purple, orange, pink, bright blue
and green glass disclosed to one a multicoloured and distracting
stretch of otherwise beautiful bay. The hard white light was a
thousand times more bearable than such a kaleidoscope, and after I
got home those windows were seldom closed.
On either side of the broad central hall were two large rooms; one
the dining-room, the others commodious bedrooms; while over the
porte-cochère was a small drawing room. Downstairs were the baths
and three large rooms and a duplicate of the upstairs verandah. This
part of the house, which was dry and well built, I forthwith turned
over to the children.
Some of the furniture was very fine; big hardwood tables and old
Spanish pieces made from the beautiful woods of the Islands, but
everything was greatly in need of the polisher’s brush and chamois.
The floors, alternating, broad, hand hewn planks of nara and ipil,
were as fine as any I ever saw, though they, too, needed long and
painstaking attention. In the bedrooms were high canopied and
mosquito-netted beds with cane bottoms, exactly like cane-bottomed
chairs, and without mattresses. Everything else was wicker.
The thing which caught my attention first, however, were the fans.
My husband had written me, with great pride and satisfaction, that
he had put in electric fans, and that they had “saved his life.” I had
some sentimental attachment for them on this account—until I saw
them. But when I saw them I felt at once that everything else, to be in
keeping, ought surely to be swathed in fly-specked pink gauze. The
electric fans were of the variety associated in one’s mind with ice-
cream “parlours”; two broad blades attached to the ceiling in the
middle of the room. They had been installed in both the dining-room
and sala—or sitting-room—and it was not possible in either room to
see anything else. These fans were the subject of endless contention
between Mr. Taft and me, but I gave in and left them to continue
their mission of saving his life. He says yet that I often acknowledged
on hot nights that he was right about them, but I never did.
My husband had secured his house staff in Hongkong, through the
kind offices of Admiral Dewey’s servant, Ah Man, as I have already
written, but being new to the ways of the Oriental, he was destined
very quickly to gather some unique experience. There were four of
them: the cook, the number one boy, the number two boy and the
laundryman. The laundryman was Mr. Taft’s own inspiration. The
Filipino laundryman, he had heard, takes the linen of his master’s
household down to some stream, preferably the shallows of the
Pásig, and hammers it into ribbons on smooth rocks which he uses
for washboard purposes. Then he spreads the articles on the grass to
dry, and the consequences were found, not infrequently, to be a bad
outbreak on the master’s skin of what is known as “adobe itch,” a
troublesome disease. So Mr. Taft had engaged a Chinese laundryman
and had sent back to San Francisco for tubs and washboards and
wringers and all the necessary paraphernalia, and had installed an
up-to-date laundry in his own house, where the orders were to boil
the clothes and hang them on a line. It worked perfectly, though it
did take the Chinaman from the wilds of Shanghai some time to
learn the uses of the various modern implements.
In Manila the marketing is usually done by the cook, but in our
household this duty was delegated to the number one boy. One day
the cook and the number two boy came to Mr. Taft with the
announcement that they could not remain in the house with number
one boy; that number one boy was a thief; that he smoked opium all
the time he was supposed to be marketing; and that he was a bad
Chinaman generally. Mr. Taft had always given number one boy the
money with which to pay the other boys’ salaries and the cash market
charges, so he said to the cook:
“Has number one always paid your wages?”
“Yes,” said the cook, with an eloquent shrug of his shoulders, “just
my wages and nothing more.”
This meant, of course, that number one boy was committing the
unforgivable sin of not dividing the “squeeze.”
There is no use going into what “squeeze” means in the Orient. It
may come partly out of the master’s pocket and partly out of the
pockets of the tradesmen; nobody knows. But the housekeeper soon
learns that she gains nothing by trying to circumvent the system in
doing the marketing herself. The “squeeze” works, no matter who
does the buying, and it soon comes to be recognised as a legitimate
part of household expenses. The only thing that one can do is to
make a complaint when it becomes too heavy.
It seems to have been very heavy in my husband’s establishment,
and investigation proved to him that it was necessary to let number
one go, so when I arrived there were just the two upstairs servants,
the cook and number two, who had been promoted to the proud
position of number one.
A TYPICAL PHILIPPINE RIVER SCENE
AND SOME FILIPINO LAUNDRY
WORK

I went immediately to work to order my household as I always had


been used to doing, and there’s where I began to get my experience
of the Oriental character. My cook was a wrinkled old Chinaman who
looked as if he had concealed behind his beady little eyes a full
knowledge of all the mysteries of the East, to say nothing of its vague
philosophies and opium visions. He called me “Missy” and was most
polite, but in all the essentials he was a graven image. He was an
unusually good cook, though he did exactly as he pleased, and
seemed to look upon my feeble efforts at the direction of affairs with
a tolerant sort of indifference. He would listen to my instructions
most respectfully, carefully repeat after me the nice menus I devised,
say, “yes, Missy,” then return to his kitchen and cook whatever suited
his fancy.
It took me sometime to get used to this, but I came to value him
highly, especially when I learned that he had, finely developed, one
glorious characteristic of his kind. He could make something out of
nothing. If Mr. Taft sent word at six o’clock, or even as late as seven,
that he had invited four or five of his associates to dinner to continue
a discussion begun earlier in the day, or for some other reason, I had
only to tell Ah Sing that there would be seven or eight instead of
three at dinner, and a perfect dinner would be served. Where he got
his supplies with which to meet these sudden demands I never knew.
I learned to accept the gifts of the gods without comment, which is
the only thing to do in the East.
Ah Sing was particularly proud of his sweets. He loved to make
puddings and pies with lavish decorations upon them, though none
of the family cared much for such delicacies. One evening, shortly
after my arrival, I was giving quite a formal dinner party; I had, as
usual, given the cook a menu well thought out and, I believed, wholly
appropriate to the occasion and the climate. For a sweet I had
ordered an ice with some small cakes, and I was pleasantly surprised
to see them duly served. But just as the party was about to rise from
the table and go out on the verandah for coffee, in came Mr. Number
One Boy with a ponderous, steaming bread-pudding, all covered with
coloured ornaments, which he smilingly displayed for the benefit of
the astonished party. It had to be served, of course, and I felt that my
explanations regarding Ah Sing’s eccentricities didn’t make much of
an impression.
Over none of the servants did I exercise the control I thought to be
necessary, but this was due to the fact that for three months they had
been obeying the master; the master had paid them their wages, and
to the master they looked for all orders. It took me sometime to
discover this, but when I did I began to handle household accounts
without assistance.
It was about the end of the typhoon season and the predictions
were that there would be no more heavy storms. But it began to rain
and blow one day with rather more force than I had ever seen before,
and I was told that we were in the midst of a typhoon. “Oh, well,” I
thought, “if this is all I don’t see why there is so much talk about it.”
It was just a very hard and very persistent storm. When I began to
think it was about time for it to have blown itself out I was awakened
one night by what seemed to me to be the bombardment of heavy
artillery. My bed was shaking under me, the house was swaying, and
the noise was terrifying. I jumped up with an instant idea of
insurrectos, and a feeling that I must meet the situation on my feet;
then I realised, at once, that it was the typhoon. It was as if all the
winds that had blown for two days had gathered themselves together
and were hurling themselves in one blast upon us. I reached for the
electric switch, but there were no lights; I turned the button time and
again; nothing happened. I fumbled for matches all over my room
and could find none. My nerves were just at the crying out point
when my door was thrown open and in rushed Maria, holding aloft a
glimmering candle.
She was shaking with fright.
“Nellie,” she exclaimed, “I just can’t stand it any longer! Do let’s
find everything there is to light and call Will and sit out in the sala.
Heaven only knows what’s going to happen!”
We searched around and found some more candles; then I went to
call my husband. He was sleeping as soundly as if nothing at all were
happening. I shook him and called him and shook him again. I
thought he never would wake up, but finally he did, and just then I
heard the crash of a tree blowing down in the garden, while the floor
seemed to heave under my feet.
“What’s the matter?” asked my sleepy husband.
“Will, there’s an awful storm. Please come out in the sala and sit
with Maria and me.”
“All right,” he said, and slowly got himself into an all-enveloping
dressing gown.
We huddled ourselves in chairs in the big hallway and sat
listening. Rain always comes with the wind in typhoons and the dash
of water against the windows and the sides of the house was
deafening. But the noise was suddenly punctuated by a gentle snore.
Mr. Taft had settled himself back in his chair and gone quietly to
sleep. Maria’s nerves were on edge; without a word she jumped up
and shook her tired-out brother-in-law most vigorously, crying above
the roar of the storm:
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like