Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (6 votes)
351 views

Data Oriented Programming 1st Edition Yehonathan Sharvit 2024 scribd download

Oriented

Uploaded by

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

Data Oriented Programming 1st Edition Yehonathan Sharvit 2024 scribd download

Oriented

Uploaded by

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

Download the full version of the ebook at ebookname.

com

Data Oriented Programming 1st Edition Yehonathan


Sharvit

https://ebookname.com/product/data-oriented-programming-1st-
edition-yehonathan-sharvit/

OR CLICK BUTTON

DOWNLOAD EBOOK

Download more ebook instantly today at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Java Methods A Ab Object oriented Programming and Data


Structures Maria Litvin

https://ebookname.com/product/java-methods-a-ab-object-oriented-
programming-and-data-structures-maria-litvin/

ebookname.com

Web Programming for Business PHP Object Oriented


Programming with Oracle 1st Edition David Paper

https://ebookname.com/product/web-programming-for-business-php-object-
oriented-programming-with-oracle-1st-edition-david-paper/

ebookname.com

Object Oriented Data Structures Using Java Chip Weems

https://ebookname.com/product/object-oriented-data-structures-using-
java-chip-weems/

ebookname.com

Stability of Nonlinear Shells On the example of spherical


shells 1st Edition Dov Shilkrut (Eds.)

https://ebookname.com/product/stability-of-nonlinear-shells-on-the-
example-of-spherical-shells-1st-edition-dov-shilkrut-eds/

ebookname.com
Getting Started with Mortared Stonework Walls Patios
Fireplaces Columns More Macfie

https://ebookname.com/product/getting-started-with-mortared-stonework-
walls-patios-fireplaces-columns-more-macfie/

ebookname.com

Black Against Empire The History and Politics of the Black


Panther Party First Edition Joshua Bloom

https://ebookname.com/product/black-against-empire-the-history-and-
politics-of-the-black-panther-party-first-edition-joshua-bloom/

ebookname.com

The Routledge Guide to Music Technology Thom Holmes

https://ebookname.com/product/the-routledge-guide-to-music-technology-
thom-holmes/

ebookname.com

Brothers and Sisters in India A Study of Urban Adult


Siblings 1st Edition G. N. Ramu

https://ebookname.com/product/brothers-and-sisters-in-india-a-study-
of-urban-adult-siblings-1st-edition-g-n-ramu/

ebookname.com

Innovation and Growth From R D Strategies of Innovating


Firms to Economy wide Technological Change 1st Edition M.
Andersson Et Al. (Eds.)
https://ebookname.com/product/innovation-and-growth-from-r-d-
strategies-of-innovating-firms-to-economy-wide-technological-
change-1st-edition-m-andersson-et-al-eds/
ebookname.com
The Shenandoah 1st Edition Julia Davis

https://ebookname.com/product/the-shenandoah-1st-edition-julia-davis/

ebookname.com
Reduce software complexity

Yehonathan Sharvit
Forewords by Michael T. Nygard
and Ryan Singer

MANNING
Principles of data-oriented programming

Principle #2: Represent Immutable


data with generic data
structures.
Generic

Mutable
Representation
Specific Principle #3:
Data is
Data Schema
immutable.

Principle #4: Separate


Data-oriented data schema from data
representation.
programming

Code Functional
programming
Principle #1:
Separate code
from data.
Object-oriented
programming
Data-Oriented
Programming
REDUCE SOFTWARE COMPLEXITY

YEHONATHAN SHARVIT
Forewords by MICHAEL T. NYGARD and RYAN SINGER

MANNING
SHELTER ISLAND
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: orders@manning.com

©2022 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in


any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher.

Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning Publications
was aware of a trademark claim, the designations have been printed in initial caps or all caps.

Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books
are printed on paper that is at least 15 percent recycled and processed without the use of
elemental chlorine.

The author and publisher have made every effort to ensure that the information in this book
was correct at press time. The author and publisher do not assume and hereby disclaim any
liability to any party for any loss, damage, or disruption caused by errors or omissions, whether
such errors or omissions result from negligence, accident, or any other cause, or from any usage
of the information herein.

Manning Publications Co. Development editor: Elesha Hyde


20 Baldwin Road Technical development editor: Marius Butuc
PO Box 761 Review editors: Aleksandar Dragosavljević
Shelter Island, NY 11964 Production editor: Andy Marinkovich
Copy editor: Frances Buran
Proofreader: Keri Hales
Technical proofreader: Karsten Strøbaek
Typesetter: Dennis Dalinnik
Cover designer: Marija Tudor

ISBN: 9781617298578
Printed in the United States of America
To Karine, who supports my dysfunctionalities on a daily basis.
brief contents
PART 1 FLEXIBILITY ..................................................................1
1 ■ Complexity of object-oriented programming 3
2 ■ Separation between code and data 26
3 ■ Basic data manipulation 43
4 ■ State management 71
5 ■ Basic concurrency control 91
6 ■ Unit tests 110

PART 2 SCALABILITY .............................................................137


7 ■ Basic data validation 141
8 ■ Advanced concurrency control 163
9 ■ Persistent data structures 175
10 ■ Database operations 197
11 ■ Web services 220

vi
BRIEF CONTENTS vii

PART 3 MAINTAINABILITY......................................................245
12 ■ Advanced data validation 247
13 ■ Polymorphism 272
14 ■ Advanced data manipulation 295
15 ■ Debugging 311
contents
forewords xiii
preface xvii
acknowledgments xviii
about this book xx
about the author xxiv
about the cover illustration xxv
dramatis personae xxvi

PART 1 FLEXIBILITY ........................................................1

1 Complexity of object-oriented programming 3


1.1 OOP design: Classic or classical?
The design phase 4 ■
4
UML 101 6 Explaining each piece of

the class diagram 9 ■


The implementation phase 12
1.2 Sources of complexity 13
Many relations between classes 14 Unpredictable code

behavior 16 Not trivial data serialization 18


Complex class hierarchies 20

2 Separation between code and data


2.1 The two parts of a DOP system 27
26

2.2 Data entities 29

viii
CONTENTS ix

2.3 Code modules 31


2.4 DOP systems are easy to understand 36
2.5 DOP systems are flexible 38

3 Basic data manipulation


3.1 Designing a data model 44
43

3.2 Representing records as maps 48


3.3 Manipulating data with generic functions 54
3.4 Calculating search results 58
3.5 Handling records of different types 65

4 State management
4.1
71
Multiple versions of the system data 72
4.2 Structural sharing 74
4.3 Implementing structural sharing 80
4.4 Data safety 82
4.5 The commit phase of a mutation 83
4.6 Ensuring system state integrity 85
4.7 Restoring previous states 86

5 Basic concurrency control


5.1
91
Optimistic concurrency control 92
5.2 Reconciliation between concurrent mutations 94
5.3 Reducing collections 97
5.4 Structural difference 99
5.5 Implementing the reconciliation algorithm 106

6 Unit tests
6.1
110
The simplicity of data-oriented test cases 110
6.2 Unit tests for data manipulation code 112
The tree of function calls 113 Unit tests for functions down

the tree 115 Unit tests for nodes in the tree 119

6.3 Unit tests for queries 121


6.4 Unit tests for mutations 126
x CONTENTS

PART 2 SCALABILITY....................................................137

7 Basic data validation


7.1
141
Data validation in DOP 142
7.2 JSON Schema in a nutshell 143
7.3 Schema flexibility and strictness 149
7.4 Schema composition 154
7.5 Details about data validation failures 158

8 Advanced concurrency control


8.1 The complexity of locks 164
163

8.2 Thread-safe counter with atoms 165


8.3 Thread-safe cache with atoms 170
8.4 State management with atoms 172

9 Persistent data structures


9.1
175
The need for persistent data structures 175
9.2 The efficiency of persistent data structures 178
9.3 Persistent data structures libraries 184
Persistent data structures in Java 184 ■ Persistent data structures
in JavaScript 186
9.4 Persistent data structures in action 188
Writing queries with persistent data structures 188 Writing

mutations with persistent data structures 191 Serialization and


deserialization 192 Structural diff 193


10 Database operations
10.1
197
Fetching data from the database 198
10.2 Storing data in the database 204
10.3 Simple data manipulation 207
10.4 Advanced data manipulation 211

11 Web services
11.1
220
Another feature request 221
11.2 Building the insides like the outsides 222
11.3 Representing a client request as a map 225
CONTENTS xi

11.4 Representing a server response as a map 227


11.5 Passing information forward 231
11.6 Search result enrichment in action 234

PART 3 MAINTAINABILITY ............................................245

12 Advanced data validation


12.1
247
Function arguments validation 248
12.2 Return value validation 255
12.3 Advanced data validation 257
12.4 Automatic generation of data model diagrams 260
12.5 Automatic generation of schema-based unit tests 262
12.6 A new gift 269

13 Polymorphism
13.1
272
The essence of polymorphism 273
13.2 Multimethods with single dispatch 277
13.3 Multimethods with multiple dispatch 281
13.4 Multimethods with dynamic dispatch 286
13.5 Integrating multimethods in a production system 289

14 Advanced data manipulation 295


14.1 Updating a value in a map with eloquence 296
14.2 Manipulating nested data 299
14.3 Using the best tool for the job 301
14.4 Unwinding at ease 305

15 Debugging
15.1
311
Determinism in programming 312
15.2 Reproducibility with numbers and strings 314
15.3 Reproducibility with any data 318
15.4 Unit tests 321
15.5 Dealing with external data sources 329
xii CONTENTS

appendix A Principles of data-oriented programming 333


appendix B Generic data access in statically-typed languages 364
appendix C Data-oriented programming: A link in the chain of programming
paradigms 381
appendix D Lodash reference 387
index 391
forewords
Every programming principle, every design method, every architecture style, and even
most language features are about organizing complexity while allowing adaptation.
Two characteristics—immutable data and turning parts of the program into data
inside the program itself—drew me to Clojure in 2009 and more recently to Yehona-
than Sharvit’s Data-Oriented Programming.
In 2005, I worked on one of my favorite projects with some of my favorite people.
It was a Java project, but we did two things that were not common practice in the Java
world at that time. First, we made our core data values immutable. It wasn’t easy but it
worked extraordinarily well. We hand-rolled clone and deepClone methods in many
classes. The payoff was huge. Just as one example, suppose you need template docu-
ments for users to instantiate. When you can make copies of entire object trees, the
objects themselves don’t need to “know” whether they are template data or instance
data. That decision is up to whatever object holds the reference. Another big benefit
came from comparison: when values are immutable, equality of identity indicates
equality of value. This can make for very fast equality checks.
Our second technique was to take advantage of generic data—though not to the
extent Yehonathan will show you in this book. Where one layer had a hierarchy of
classes, its adjoining layer would represent those as instances of a more general class.
What would be a member variable in one layer would be described by a field in a map
in another layer. I am certain this style was influenced by the several small talkers on
our team. It also paid off immediately, as we were able to compose and recompose
objects in different configurations.

xiii
xiv FOREWORDS

Data-oriented programming, as you will see, promises to reduce accidental complex-


ity, and raise the level of abstraction you work at. You will start to see repeated behavior
in your programs as artificial, a result of carving generic functions into classes, which act
like little namespaces that operate only on a subset of your program’s values (their
instances). We can “fold together” almost all of those values into maps and lists. We can
turn member names (data available only with difficulty via reflective APIs) into map
keys. As we do that, code simply melts away. This is the first level of enlightenment.
At this point, you might object that the compiler uses those member names at
compile time for correctness checking. Indeed it does. But have faith, for Yehonathan
will guide you to the next level of enlightenment: that those compile-time checks are a
small subset of possible correctness checks on values. We can make the correctness
checks themselves into data, too! We can make schemas into values inside our programs.
What’s more, we can enforce criteria that researchers on the forefront of type systems
are still trying to figure out. This is the second level of enlightenment.
Data-oriented programming especially shines when working with web APIs. There is
no type of system on the wire, so attempting to map a request payload directly into a
domain class guarantees a brittle, complex implementation. If we let data be data, we get
simpler code and far fewer dependencies on hundred-megabyte framework libraries.
So, whatever happened to the OOP virtues of encapsulation, inheritance, and
polymorphism? It turns out we can decomplect these and get each of them à la carte.
(In my opinion, inheritance of implementations is the least important of these, even
though it is often the first one taught. I now prefer inheritance of interfaces via proto-
cols and shared function signatures.) Data-oriented programming offers polymor-
phism of the “traditional” kind: dispatch to one of many functions based on the type
of the first argument (in an OO language, this is a disguise for the method’s first
argument. It just happens it goes before the “.”). However, as with schema checking,
DOP allows more dynamism. Imagine dispatching based on the types of the first two
arguments. Or based on whether the argument has a “birthday” field with today’s date
in it! This is the third level of enlightenment.
And as for encapsulation, we must still apply it to the organizing logic of our
program. We encapsulate subsystems, not values. This encapsulation embodies the
decision-hiding of David Parnas. Inside a subsystem, we can stop walling off our data
into the disjointed namespaces that classes impose. In the words of Alan Perlis, “It is
better to have one hundred functions operate on one data structure than ten func-
tions on ten data structures.”
In our unending battle with entropy, we can use data-oriented programming to
both reduce the volume of code to keep up and raise the level of abstraction to make
our program’s logic and meaning precise and evident. Enjoy the journey and pause at
each new plateau to enjoy the view and say to yourself, “It’s just data!”

—MICHAEL T. NYGARD
author of Release It!: Design and
Deploy Production-Ready Software
FOREWORDS xv

This book hit me at just the right time. I had been building web apps for nearly 20
years in an object-oriented framework. I never considered myself an expert program-
mer, but I knew my tools well enough to look at a typical business problem, sketch out
a data model, and build an MVC-style app to get the job done.
Projects were thrilling at the start. I loved the feeling of plugging pieces together
and seeing the app come to life. But once I got it working, I ran into problems. I
couldn’t change one part without keeping all the other models in mind. I knew I
should write tests, but I had to set up so much state to test things that it didn’t feel
worth it—I didn’t want to write more code that would be hard to change. Even run-
ning bits of code in the console was tedious because I had to create database state to
call the method. I thought I was probably doing it wrong, but the solutions I knew
about, such as sophisticated testing frameworks, seemed to add to the complexity
instead of making things easier.
Then one day, I saw a talk on YouTube by Rich Hickey, the creator of Clojure. He
was explaining functional programming and contrasting it with OO, which he deri-
sively called “place-oriented programming.” I wasn’t sure if he was right, but I heard a
hidden message that intrigued me: “It’s not you, it’s your language.” I watched all the
videos I could find and started to think Clojure might be the answer.
Years went by. I kept watching Clojure videos and trying to apply functional princi-
ples when I could. But whenever it was time to start on a new project, I fell back on my
familiar framework. Changing to another language with a totally different ecosystem
of libraries was too big of a leap.
Then, just as I was about to start work on a new product, I found this book. The
words “Data-Oriented” in the title rang a bell. I heard programmers in those Clojure
videos use the words before, but I hadn’t really understood what they meant. Some-
thing about how it’s easier to build systems that manipulate data literals (like maps
and arrays) instead of custom objects. The languages I knew had good support for
data literals, so I thought I might learn something to hold me over until that magical
day when I might switch to Clojure.
My first a-ha moment came right in the introduction. In the first few pages, Yehona-
than explains that, though he’s written Clojure for 10 years, the book isn’t language-
specific, and the examples will be in JavaScript. Wait!—I thought. Could it really be
that I don’t have to change languages to deeply improve the way I write programs?
I was so excited by this prospect that I devoured the book in one sitting. My eyes
opened to something that had been right in front of me all along. Of course my code
was hard to test! Because of the ORM I used, all my functionality was written in objects
that assumed a bunch of database state! When I saw it spelled out with examples in the
book, I couldn’t unsee it. I didn’t need a new language, I just needed to approach pro-
gramming differently!
The designers I consider great all point to the same thing: good design is about
pulling things apart. It’s not just about getting the code to work, no matter how ugly.
Exploring the Variety of Random
Documents with Different Content
most valuable part of the effects, which in most families are
deposited under the imaginary security of locks, the plunder would
seldom recompense the difficulty and hazard of the enterprise; and
till some method of security be adopted by which such keys and
instruments may be rendered useless, no effectual check or
opposition can be given to the excessive and alarming practice of
house-breaking.
“Being confident that I have contrived a security which no
instrument but its proper key can reach; and which may be so
applied as not only to defy the art and ingenuity of the most skilful
workman, but to render the utmost force ineffectual, and thereby to
secure what is most valued as well from dishonest servants as from
the midnight ruffian, I think myself at liberty to declare (what
nothing but the discovery of an infallible remedy would justify my
disclosing), that all dependence on the inviolable security of locks,
even of those which are constructed on the best principle of any in
general use, is fallacious. To demonstrate this bold and alarming
proposition, I shall first state the common principles which are
applied in the art of lock-making; and by describing their operation
in instruments differently constructed, prove to my intelligent
readers that the best-constructed locks are liable to be secretly
opened with great facility; and that the locks in common use are
calculated only to induce a false confidence in their effect, and to
throw temptation to dishonesty in the way of those who are
acquainted with their imperfections, and know their inefficacy to the
purpose of security” (p. 5).
Tumblers had been so little thought of and used at the time
Bramah wrote, that his attention was almost exclusively directed to
warded locks. The mysterious clefts in a key, connected with some
kind of secret mechanism in the lock, had given the warded locks a
great hold on the public mind, as models of puzzlement and
security; and it was to shew that this confidence rested on a false
basis, that he to a great extent laboured. The following is his
exposition of the principle and the defects of the warded lock.
“Locks have been constructed, and are at present much used and
held in great esteem, from which the picklock is effectually excluded;
but the admission of false keys is an imperfection for which no
locksmith has ever found a corrective; nor can this imperfection be
remedied whilst the protection of the bolt is wholly confided to fixed
wards. For if a lock of any given size be furnished with wards in as
curious and complete a manner as it can be, those wards being
necessarily expressed on what is termed by locksmiths the bit or
web of the key, do not admit of a greater number of variations than
can be expressed on that bit or web; when, therefore, as many locks
have been completed of the given size as will include all the
variations which the surface of the bit will contain, every future lock
must be the counterpart of some former one, and the same key
which opens the one will of course unlock the other. It hence follows
that every lock which shall be fabricated on this given scale, beyond
the number at which the capability of variation ends, must be as
subject to the key of some other lock as to its own; and both
become less secure as their counterparts become more numerous.
This objection is confirmed by a reference to the locks commonly
fixed on drawers and bureaus, in which the variations are few, and
these so frequently repeated, from the infinite demand for such
locks, that, even if it were formed to resist the picklock, they would
be liable to be opened by ten thousand correspondent keys. And the
same observation applies in a greater or less degree to every lock in
which the variations are not endless.
“But if the variation of locks in which the bolt is guarded only by
fixed wards could be multiplied to infinity, they would afford no
security against the efforts of an ingenious locksmith; for though an
artful and judicious arrangement of the wards, or other
impediments, may render the passage to the bolt so intricate and
perplexed as to exclude every instrument but its proper key, a skilful
workman having access to the entrance will be at no loss to
fabricate a key which shall tally as perfectly with the wards as if the
lock had been open to his inspection. And this operation may not
only be performed to the highest degree of certainty and exactness,
but is conducted likewise with the utmost ease. For the block or bit,
which is intended to receive the impression of the wards, being fitted
to the keyhole, and the shank of the key bored to a sufficient depth
to receive the pipe, nothing remains but to cover the bit with a
preparation which, by a gentle pressure against the introductory
ward, may receive its impression, and thus furnish a certain direction
for the application of the file. The block or bit being thus prepared
with a tally to the first ward, gains admission to the second; and a
repetition of the means by which the first impression was obtained,
enables the workman to proceed, till by the dexterous use of his file
he has effected a free passage to the bolt. And in this operation he
is directed by an infallible guide; for, the pipe being a fixed centre on
which the key revolves without any variation, and the wards being
fixed likewise, their position must be accurately described on the
surface of the bit which is prepared to receive their impression. The
key therefore may be formed and perfectly fitted to the lock without
any extraordinary degree of genius or mechanical skill. It is from
hence evident that endless variations in the disposition of fixed
wards are not alone sufficient to the purpose of perfect security. I do
not mean to subtract from the merit of such inventions, nor to
dispute their utility or importance. Every approach towards
perfection in the art of lock-making may be productive of much
good, and is at least deserving of commendation; for if no higher
benefit were to result from it, than the rendering difficult or
impossible to many that which is still practicable and easy to a few,
it furnishes a material security against those from whom the greatest
mischiefs and dangers are to be apprehended.”
There can be little doubt, in the present day, that Bramah did not
over-rate the fallacies embodied in the system of wards for locks. He
was sufficiently a machinist to detect the weak points in the ordinary
locks; and, whatever may have been his over-estimate of his own
lock (presently to be described), he was certainly guilty of no
injustice to those who had preceded him; for their locks were
substantially as he has described them. To understand the true
bearings of his Dissertation too, we must remember that
housebreaking had risen to a most daring height in London at the
time he wrote (about the middle of the reign of George III.); and
men’s minds were more than usually absorbed by considerations
relating to their doors and locks.
Mr. Bramah, after doing due justice to the ingenuity of Barron’s
lock, in which, if the tumbler be either over lifted or under lifted the
lock cannot be opened, pointed out very clearly the defective
principle which still governed the lock. “Greatly as the art is indebted
to the ingenuity of Mr. Barron, he has not yet attained that point of
excellence in the construction of his lock which is essential to perfect
security. His improvement has greatly increased the difficulty but not
precluded the possibility of opening his lock by a key made and
obtained as above described (by a wax impression on a blank key);
for an impression of the tumblers may be taken by the same
method, and the key be made to act upon them as accurately as it
may be made to tally with the wards. Nor will the practicability of
obtaining such a key be prevented, however complicated the
principle or construction of the lock may be, whilst the disposition of
its parts may be ascertained and their impression correctly taken
from without. I apprehend the use of additional tumblers to have
been applied by Mr. Barron as a remedy for this imperfection.” Mr.
Bramah thought that Barron had a perception of a higher degree of
security, but had failed to realise it; because, by giving a uniform
motion to the tumblers, and presenting them with a face which
tallies exactly with the key, they still partake in a very great degree
of the nature of fixed wards, and the security of the lock is thereby
rendered in a proportionate degree defective and liable to doubt.
To shew how this insecurity arises, Mr. Bramah illustrates the
matter in the following way: “Suppose the key with which the
workman is making his way to the bolt to have passed the wards,
and to be in contact with the most prominent of the tumblers. The
impression, which the slightest touch will leave on the key, will direct
the application of the file till sufficient space is prepared to give it a
free passage. This being accomplished, the key will of course bear
upon the tumbler which is most remote; and being formed by this
process to tally with the face which the tumblers present, will
acquire as perfect a command of the lock as if it had been originally
made for the purpose. And the key, being thus brought to a bearing
on all the tumblers at once, the benefit arising from the increase of
their number, if multiplied by fifty, must inevitably be lost; for, having
but one motion, they act only with the effect of one instrument.”
It is worthy of notice, that even while thus shewing the weak
points of the Barron lock, Mr. Bramah seems to have had in his mind
some conception of infallibility or inviolability attainable by the lock
in question. After speaking of the defect arising from the bad
arrangement of the tumblers, he says: “But nothing is more easy
than to remove this objection, and to obtain perfect security from
the application of Mr. Barron’s principle. If the tumblers, which
project unequally and form a fixed tally to the key, were made to
present a plane surface, it would require a separate and unequal
motion to disengage them from the bolt; and consequently no
impression could be obtained from without that would give any idea
of their positions with respect to each other, or be of any use even
to the most skilful and experienced workman in the formation of a
false key. The correction of this defect would rescue the principle of
Mr. Barron’s lock, as far as I am capable of judging, from every
imputation of error or imperfection; and, as long as it could be kept
unimpaired, would be a perfect security. But the tumblers, on which
its security depends, being of slight substance, exposed to perpetual
friction—as well from the application of the key as from their own
proper motion—and their office being such as to render the most
trifling loss of metal fatal to their operation, they would need a
further exertion of Mr. Barron’s ingenuity to make them durable.”
It may perhaps be doubted whether the principle of Bramah’s lock
is not more clearly shewn in the original constructed by him than in
that of later date. In appearance it is totally different, but the same
pervading principle is observable in both; and the cylinder lock can
certainly be better understood when this original flat lock has been
studied. The annexed woodcut is taken from the first and very
scarce edition of Mr. Bramah’s Dissertation; the description is
somewhat more condensed, but perhaps sufficient for the purpose.
fig. 33. Bramah’s first model.

The lock is supposed to be lying flat, with the bolt b half-shot.


Ranged somewhat diagonally are six levers, turning on a horizontal
joint or pivot at a, each lever having a slight extent of vertical motion
independent of the others. Each lever rests on a separate spring of
sufficient strength to sustain its weight, or, if depressed by a
superior force, to restore it to its proper position when the force is
withdrawn. f is a curved piece of metal, pierced with six grooves or
passages; these grooves are exactly equal in width to the thickness
of the levers, but are of sufficient depth to allow the levers a free
motion in a perpendicular direction. The ends of the levers are
inserted in these grooves, and have this freedom of motion, whether
lifted by the elastic power of the springs or depressed by a weight
from above. In the bolt b is a notch to receive a peculiarly-shaped
lever, which shoots or withdraws the bolt according as it traverses to
the right or the left. This lever, the six long levers, the springs
beneath them, the bent piece f, and the pivot, all alike are fixed to a
circular platform p, which turns on a centre; so that if any force can
make this platform turn partially round, the bolt must be shot or
unshot by the lever which works in the notch. The six long levers are
the contrivances whereby the platform shall not be allowed to turn
until the proper moving agent (the key) shall have been applied, the
plate p being one of the assistants in this obstruction. This plate,
which is hollow underneath, has six notches in one of its edges; the
points of the levers catch into these notches; and while so caught,
the levers cannot move horizontally, and all the machinery is at a
stand-still. To enable the key to set the mechanism in action, other
contrivances are necessary. Each lever has a notch at its extreme
end, and the six are notched very irregularly in respect one to
another. These notches must be brought all into one plane, to
enable the levers to pass horizontally out of the notches in the plate,
in the same way as the two prongs of a fork might traverse one
above and the other below the blade of a knife; and when the lever-
notches are in this position, all in one plane and in the plane of the
plate, the levers can be moved, and with it the stump which shoots
the bolt. To ensure this due pressing down of the levers, a key is
used such as is shewn in the cut, having six steps or bits to
correspond with the six levers; this key, put upon the pin k, presses
down all the levers to the exact distance necessary for bringing their
notches into one plane, viz. the plane of the plate; the key then
being turned round turns the movable platform p, and shoots the
bolt. It is evident at a glance, that unless the various steps of the
key are so cut, that each shall press down its own lever to the
proper extent, the ends of the levers cannot pass the notches in the
plate, and the bolt can neither be locked nor unlocked.
It may be well to give Bramah’s own words in relation to this lock:
“I may safely assert that it is not in art to produce a key or other
instrument by which a lock constructed on this principle can be
opened. It will be a task, indeed, of great difficulty, even to a skilful
workman, to fit a key to this species of lock, though its interior face
were open to his inspection; for the levers being raised by the
subjacent springs to an equal height present a plane surface, and
consequently convey no direction that can be of any use in forming
a tally to the irregular surface which they present when acting in
subjection to the proper key. Unless, therefore, a method be
contrived to bring the notches on the ends of the levers in a direct
line with each other, and to retain them in that position till an exact
impression of the irregular surface which the levers will then exhibit
can be taken, the workman will in vain attempt to fit a key to the
lock, or by any effort of art to move the bolt. And when it is
considered that this process will be greatly impeded, and may
perhaps be entirely frustrated, by the action of the springs, it must
appear that great patience and perseverance, as well as great
ingenuity, will be required to give any chance of succeeding in the
attempt. I do not state this circumstance as a point essential or of
any importance to the purpose of the lock, but to prove more clearly
what I have before observed upon its principle and properties; for if
such difficulties occur to a skilled workman, as to render it almost, if
not altogether impracticable to form a key when the lock is open to
his inspection and its parts accessible to his hand, it pretty clearly
demonstrates the impossibility of accomplishing it when no part of
the movement can be touched or seen.”
It is evident that Mr. Bramah had his thoughts directed to that
mode of picking locks which depends on taking impressions of the
moving parts, rather than to the mechanical or pressure method
which has been developed in later times. There can be little doubt
that a lock was, to his mind, a beautiful and admirable machine, far
elevated above the level of mere blacksmith’s work; and his name
will ever be associated with what may be termed the philosophy of
lock-making.
After the model-lock, which has just been described, was
constructed, and found to corroborate the idea which was working in
Mr. Bramah’s mind, he proceeded to the construction of his barrel or
cylinder-lock, embracing similar elements placed in more convenient
juxta-position. In his Essay he gives an engraving to illustrate the
principle on which his lock acts, rather in the manner of a diagram
than as depicting any lock actually made; his main object being to
impart a clear notion of the action of the slides which form such a
distinguishing feature in his lock.

fig. 34. Diagram to illustrate the Bramah lock.

Viewed in this sense, therefore, simply as an illustrative diagram,


the annexed cut may represent the action of the safety slides. b is a
sliding bar or bolt, having a power of longitudinal motion in the
frame f. This frame has six notches cut on each of its long sides, the
two series being exactly opposite each other; and there are six
similar notches cut in the bolt b. The concurrent effect of all these
eighteen notches is, that the six slides a b c d e f can move freely up
and down across the bolt. When the slides are thus placed, the bolt
cannot move, and may in this case be considered to be locked.
There are six clefts or notches in the six slides, one to each (1, 2, 3,
4, 5, 6); and until all these are brought in a right line, the bolt
cannot move through them. If a tally or key be prepared, as shewn
at t in the lower part of the cut, with six projections, and if these
projections thrust up the six slides till their clefts rise to the plane of
the bolt, then can the bolt be withdrawn or the lock opened. This
serves to illustrate the relation between the slides and the key, as
carried out in the way now to be described.
One peculiarity of the Bramah lock is, that from the essential part
of the apparatus being a barrel or cylinder, much of the working can
be conducted in the lathe; and this has given a beauty to the details
generally and deservedly admired. Mr. Bramah, when he worked out
the theory of his lock, resolved to discard altogether the use of fixed
wards, and also the use of tumblers working on a pivot at one end;
substituting in their stead a system of slides, working in a very novel
way. The body of a Bramah lock may be considered as formed of
two concentric brass barrels, the outer one fixed, and the inner
rotating within it. The inner barrel has a projecting stud, which,
while the barrel is rotating, comes in contact with the bolt in such a
way as to shoot or lock it; and thus the stud serves the same
purpose as the bit of an ordinary key, rendering the construction of a
bit to the Bramah key unnecessary. If the barrel can be made to
rotate to the right or left, the bolt can be locked or unlocked; and
the problem is, therefore, how to ensure the rotation of the barrel.
The key, which has a pipe or hollow shaft, is inserted in the keyhole
upon the pin, and is then turned round; but there must be a very
nice adjustment of the mechanism of the barrel before this turning
round of the key and the barrel can be ensured. The barrel has an
external circular groove at right angles to the axis, penetrating to a
certain depth; and it has also several internal longitudinal grooves,
from end to end. In these internal grooves thin pieces of steel are
able to slide, in a direction parallel with the axis of the barrel. A thin
plate of steel, called the locking-plate, is screwed in two portions to
the outer barrel, concentric with the inner barrel; and at the same
time occupying the external circular groove of the inner barrel; this
plate has notches, fitted in number and size to receive the edges of
the slides which work in the internal longitudinal grooves of the
barrel. If this were all, the barrel could not revolve, because the
slides are catching in the grooves of the locking-plate; but each slide
has also a groove, corresponding in depth to the extent of this
entanglement; and if this groove be brought to the plane of the
locking-plate, the barrel can be turned, so far as respects that
individual slide. All the slides must, however, be so adjusted that
their grooves shall come to the same plane; but as the notch is cut
at different points in the lengths of the several slides, the slides have
to be pushed in to different distances in the barrel, in order that this
juxta-position of notches may be ensured. This is effected by the
key, which has notches or clefts at the end of the pipe equal in
number to the slides, and made to fit the ends of the slides when
the key is inserted; the key presses each slide, and pushes it so far
as the depth of its cleft will permit; and all these depths are such
that all the slides are pushed to the exact position where their
notches all lie in the same plane; this is the plane of the locking-
plate, and the barrel can be then turned.
fig. 35. Exterior of a Bramah lock.

This is the principle which Mr. Bramah


adopted; and we have now to trace it,
step by step, by means of illustrative
details. Fig. 35 represents the exterior of
a box or desk lock, one among many
varieties which the Bramah lock
presents. a a shews the bolt, formed
something like two hooks rising out of a
bar of metal, which bar has a backward
and forward motion upon the plate b b.
The upper edge of this plate is turned
over at right angles, forming a small
horizontal surface through which two
openings are cut to receive the two
hooked portions of the bolt. The
movements of the bolt are otherwise
guided by the edges of square holes
through which it works; the holes being
made in the edge-pieces of the lock,
riveted to the main plate. The bolt is
further prevented from rising out of its
place by means of a plate of metal c,
which is secured to the edge-pieces by
two screws 1, 1, and by two steadying
pieces. This plate has on its surface a
cylindrical projection d, which contains in
effect all the working mechanism of the
lock. The pins 4 4 are employed for
securing a plate, which we shall have to
fig. 36. Details of the Bramah describe presently. When such a lock is
lock. fixed upon a desk or box, the portion D
projects to a small distance through a
hole in the wood-work, forming in itself a very neat escutcheon, with
a key-hole in the centre.
So much for the exterior. We must now
proceed to examine the interior of the lock,
especially the part contained within the cylinder.
In fig. 36, for convenience of arrangement, the
several parts are exhibited separately, and as if
the plane of the lock were horizontal, with the
key acting vertically. The essential part of the
mechanism is a barrel or cylinder E, pierced or
bored with a cylindrical hole down its centre. The
inside of the bore has six narrow grooves, cut
parallel with the axis, and in the direction of
radii; the grooves are not cut through the
fig. 37. The slides.
thickness of the cylinder, but leave sufficient
substance of metal for strength. In every groove
is fitted a steel slide of peculiar form, such as is shewn at a´ a´ in
fig. 37. Each slide is split in its thickness (seen in section), so that it
may move up and down in its groove with a slight friction, and
thereby not fall simply by its own weight. Each slide has three small
notches (3, 2, 3´), the use of which will presently appear. Reverting
to fig. 36, the lower part of the opening through the cylinder E is
closed by a circular plate of metal, fixed to it by two screws; this
plate is represented at F, in the lower part of the figure. This plate
has a vertical pin rising from its centre (also seen at b, fig. 39), and
serving as a key-pin on which the pipe of the key may work or slide;
and it has also a short circular stud c projecting from its under side,
and fitted to enter into a curved opening in the bolt presently to be
described.
The point to be now borne in mind is this, that if the cylinder E
turns round, the plate F will also turn round, and with it the stud c;
and as this stud works into the peculiarly formed cavity d in a
portion of the bolt (fig. 38), it causes the bolt to be shot backwards
or forwards. Now, in order to prevent this rotating of the cylinder
unless the proper key be employed, the following mechanism is
introduced: the cylinder has a groove cut round its circumference at
e e, extending sufficiently near to the internal bore to produce the
desired effect without too much weakening the metal. Into this
notch is introduced the thin circular plate of metal f f, it being
divided into two halves for this purpose; and when so placed, it
occupies the position shewn by the dotted portion e e. When this
plate is screwed to the case of the lock by the screws 4, 4, it cannot
of course turn round; but the cylinder itself will or will not turn round
according to the position of the slides. The plate f f has six notches,
5, 5, 5, &c. in the inner edge or circle; so adjusted that, when the
plate is in its place, the slides a a can move up and down. The
cylinder cannot move round in a circle without carrying the slides
with it; and these cannot so move unless they are all depressed to
such exact distances in their respective grooves, that the deep notch
of each slider (shewn at 2 in fig. 37) shall come into the plane of the
circular plate: when all are so brought, the cylinder can be turned. If
any one of the slides be pressed down either too low or not low
enough, this turning of the cylinder cannot be effected, because the
slides will be intersected by the edges of the notches 5, 5; and it is
the office of the key, therefore, to press all the six slides down to the
exact distances required. When the slides are not pressed upon by
the key, they are forced upwards to the top of the cylinder by a
spiral spring 6, coiled loosely round the pin b; this pressure forces up
a small collet, 7, on which the upper part of the slides rest by a sort
of step.
fig. 38. The bolt.

The first locks were made with a separate and independent spring
to each slide; but it is a very great improvement, the introduction of
one common spring to raise up the whole number; because if a
person attempts to pick the lock by depressing the slides separately
by means of any small pointed instruments, and by chance brings
two or more of them to the proper depth for turning round, should
he press any one too low, it is difficult to raise it again without
relieving the spring 6, which immediately throws the whole number
of slides up to the top, and destroys all that had been done towards
picking the lock. Another improvement of this lock, and one which
very much increased the difficulty of picking, and its consequent
security, was the introduction of false and deceptive notches cut in
the sliders, as seen at 3, 3. It was found that in the attempt to pick
this lock, an instrument was introduced by the keyhole to force the
cylinder round. At the same time that the slides were depressed by
separate instruments, those slides which were not at the proper level
for moving round were held fast by the notches 5, 5 in the plate f f
bearing against their sides; but when pressed down to the proper
level, or till the notch 2 came opposite f f, they were not held fast,
but were relieved. This furnished the depredator with the means of
ascertaining which slides were pressed low enough, or to the point
for unlocking. The notches 3, 3 in the slides are sometimes cut
above the true notch 2, sometimes below, and at other times one on
each side (one above and one below); they are not of sufficient
depth to allow the cylinder to turn round, but are intended to
mislead any one who attempts to pick, by his not knowing whether it
is the true notch or otherwise, or even whether the slider be higher
or lower than the true notch.
We have not yet sufficiently described the key of the Bramah lock.
One merit of the lock is the remarkable smallness of the key, which
renders it so conveniently portable. The key, as shewn in the upper
part of the figure, has six notches or clefts at the end of its pipe or
barrel; these clefts are cut to different depths, to accord with the
proper extent of movement in the slides. There is a small projection,
10, near the end of the pipe, fitted to enter the notch d in the
cylinder; this forces the cylinder round when the parts are all
properly adjusted. The bolt of the lock, when properly shot or
locked, is prevented from being forced back by the stud c on the
bottom, f, of the cylinder coming into a direct line with its centre of
motion, as shewn in fig. 39; in this position no force, applied to drive
the bolt back, would have any tendency to turn the cylinder round.
fig. 39. Section of the Bramah cylinder.

To facilitate the comprehension of this very curious and beautiful


mechanism, the cylinder is shewn in section in the annexed fig. 39,
the same letters and figures of reference being used as before. In
the whole of this description we have spoken of six slides, and six
only; but Bramah locks may be, and have been, constructed with a
much larger number.
There have been several attempts made to modify the action of
Bramah’s lock, or to combine this action with that of some other
inventor. It will suffice to describe one of these. The lock invented by
Mr. Kemp of Cork, and for which a patent was obtained in 1816, is
called by him the Union lock, as combining the principles of Barron’s
and Bramah’s locks. It contains two, three, or more sliders or
tumblers, operated upon by two, three, or more concentric tubes.
These concentric tubes are of different lengths, and are placed
inside the barrel of the key; so that the barrel may, in fact, be
conceived to consist of a series of concentric tubes. These tubes are
made of such respective lengths as to push back the tumblers,
sliders, or pins which detain the bolt; and this to the precise extent
that will bring certain notches in all the sliders to the position which
will allow the bolt to pass. The inventor gives this lock its distinctive
appellation because it combines something of the pushing motion
which Bramah gives to his key, with something of the tumbler-
motion observable in Barron’s locks. The principle of safety is
considered here to rest chiefly on the extreme difficulty of imitating
the key.
Mr. Bramah calculates the number of changes of position which
the slides of his lock are capable of assuming before the right one
would be attained. “Let us suppose the number of levers, slides, or
other movables by which the lock is kept shut, to consist of twelve,
all of which must receive a different and distinct change in their
position or situation by the application of the key, and each of them
likewise capable of receiving more or less than its due, either of
which would be sufficient to prevent the intended effect. It remains,
therefore, to estimate the number producible, which maybe thus
attempted. Let the denomination of these slides be represented by
twelve arithmetical progressionals; we find that the ultimate number
of changes that may be made in their place or situation is
479,001,600; and by adding one more to that number of slides, they
would then be capable of receiving a number of changes equal to
6,227,020,800; and so on progressively, by the addition of others in
like manner to infinity. From this it appears that one lock, consisting
of thirteen of the above-mentioned sliders, may (by changing their
places only, without any difference in motion or size,) be made to
require the said immense number of keys, by which the lock could
only be opened under all its variations.”
CHAPTER VII.
AMERICAN LOCKS.

The lock-manufacture in America has undergone some such changes


as in England. The insufficiency of wards to the attainment of
security has been for many years known; and the unfitness of even
tumblers to attain this end, without auxiliary contrivances, has been
fully recognised for a dozen years back. In this, and in other
mechanical arts, the American machinists depended primarily on the
invention of the artisans in the mother country, rather than on those
of any continental European state. But the development of the art in
the United States has not been wanting in originality; the varieties of
locks have been very numerous, and many of them exceedingly
ingenious. It is not necessary, however, to describe or depict any of
those of simple form. The warded locks of different countries very
much resemble each other; the intricate warded locks made in
France in the last century have long fallen into disuse, in
consequence of the general conviction that no arrangement of
wards, however intricate, can afford the degree of security required
in a good lock. It will be more to the purpose, therefore, to proceed
at once to a notice of those American locks which, during the last
few years, have acquired some celebrity; first, however, noticing one
of older date.
Stansbury’s lock, invented in the United States about forty years
ago, may be regarded as a modification of the Egyptian lock. It had
a bolt, case, and key-hole somewhat similar to those of modern
locks; but there were peculiarities of construction in other respects.
There was a revolving plate, pierced with a series of holes, and
having a bit or pin which moved the bolt. On the lock-case were a
series of springs, each having a pin at one end; and the
arrangement was such that, when the bolt was locked or unlocked,
each pin would be pressed into some one of the holes. Like as in the
Egyptian lock (figs. 1 to 4), each pin had to be pushed out, and all of
them simultaneously, to allow the plate to turn and move the bolt.
The key was made with a barrel and bit; and on the front end of the
bit was a series of pins corresponding in position with the holes in
the plate. The mode of locking or unlocking was as follows: the key
was inserted in the key-hole, and turned to a certain position; it was
then pressed in with some force, until the pins on the key met those
in the plate; when the latter, yielding to the pressure, left the plate
free to turn and move the bolt. Modifications of the Egyptian lock,
more or less resembling this, have been brought out in some variety
on both sides of the Atlantic; but scarcely any have equalled in
simplicity the curious wooden relic of by-gone ingenuity in the art of
lock-making.
A lock made a few years ago by Mr. Yale, in the United States,
somewhat resembles the Bramah lock in having a cylinder or barrel,
or rather two concentric cylinders, one working within the other.
These cylinders are held together by pins which pass through them
both into the key-hole. On the back of the inner cylinder is a pin that
fits into a slot in the bolt, and moves it whenever the cylinder is
turned. The pins that hold the cylinders together are each cut in
two; the pieces of the various pins differing in lengths as irregularly
as possible. The key is so peculiarly formed, that, on inserting it in
the key-hole, it thrusts the pins radially outwards; each pin being
pushed just so far that the joint of the pin shall coincide with the
joint between the two cylinders. The inner cylinder can then be
turned, by which the bolt is locked or unlocked. If, by the use of a
false key, any pin be pushed in too far, it will be as ineffectual in
opening the lock as if it were not thrust in far enough; and some of
these locks having been made with as many as forty pins, the
chances are very numerous against the right combination being hit
upon. There is a combination of something like the Egyptian with
something like the Bramah lock, here attempted.
One of the principal constructions adopted in America a few years
back for bank-locks is that of Dr. Andrews of Perth Amboy, in New
Jersey. It was up to that time (1841) believed that the best locks,
both of England and America, were proof against any attempts at
picking derived from knowledge obtained by inspection through the
key-hole; but there still remained the danger that the sight of the
true key, or the possession thereof, for only a few minutes, would
enable a dishonest person to produce a duplicate. It was to contend
against this difficulty that Dr. Andrews directed his attention; and he
sought to obtain the desired object by constructing a lock, the
interior mechanism of which could be changed at pleasure. The lock
of his invention is furnished with a series of tumblers and a detector.
The tumblers are susceptible of being arranged in any desired order;
and the key has movable bits which can be arranged so as to
correspond with the tumblers. When the lock is fixed in its place, no
change can be made in the tumblers, and consequently only one
arrangement of the bits of the key will suit for the shooting and
withdrawing of the bolt. The owner can, however, before the fixing
of the bolt, adopt any arrangement of tumblers and bits which he
may choose. But though the tumblers cannot be actually re-arranged
in any new order within the lock while the latter is fixed, yet by an
ingenious contrivance the tumblers can be so acted upon as to
render the lock practically different from its former self. The
purchaser receives with his lock a series of small steel rings, each
ring corresponds in thickness with the thickness of some one of the
bits of the key; so that, by suitable adjustment, any one of the bits
may be removed from the key, and a ring be substituted in its place.
The effect of this substitution is, that the particular tumbler which
corresponds with the ring is not raised by it; it is drawn out with the
bolt, as if it were part of the bolt itself. Supposing the lock to be
locked by this means, the original key would not now unlock it; for
one of the tumblers has now been displaced, and can only be re-
adjusted by the same ring which displaced it. If an attempt be made
to open the lock by the original key, or by the key in its original
adjustment, a detector is set in action, which indicates that a false
key or other instrument has been put into the lock. One, or more
than one, of the bits may be removed from the key, and rings be
substituted, and consequently one or more of the tumblers may be
disturbed in this peculiar way; so that the lock may change its
character in all those permutating varieties which are so observable
in most “safety-locks.” The shape of the tumblers is, of course, such
as to facilitate this action; they have each an elongated slot, and
also two notches; when a tumbler is raised by one of the bits of the
key, one of the notches closes around a stump fitted into the case of
the lock, and prevents the tumbler from being moved onward with
the bolt; but when a ring has been substituted for a bit on the key,
the tumbler cannot be raised at all; it is carried onward by a stump
on the bolt.
Dr. Andrews is also the inventor of a lock which he terms the snail-
wheel lock. In this lock a series of revolving discs, or wheels, taking
the place of the tumblers, are mounted on a central pin, on which
the pipe of the key is inserted. Each disc has a piece cut out of it,
into which the bit of the key enters, and in turning round moves the
discs according to the various lengths of the steps on the key. On
the outer edge of each disc is a notch, and by the turning of the key
all these notches are brought into a line, so that a moveable tongue,
or toggle, attached to the bolt, falls into the notches; the key is then
turned the reverse way, by which means the bolt is projected.
About the time when Dr. Andrews invented his first lock, Mr.
Newell, of the firm of Day and Newell of New York, constructed a
lock which possessed the same distinctive peculiarity as that of
Andrews, viz. that the key might be altered any number of times
without rendering it necessary to remove the lock or change its
internal mechanism. This was brought about, however, in a different
manner. Instead of having, as in the Andrews lock, a two-fold
movement to every tumbler, Mr. Newell employed two sets of
tumblers, the one set to receive motion from the other, and having
different offices to fill, to be acted upon by the key in respect to the
first series, and to act upon the bolt in respect to the second. Calling
these two sets primary and secondary, the action of the lock may be
briefly described as follows. A primary tumbler being raised to the
proper height by the proper bit in the key, raises the corresponding
secondary tumbler; the secondary tumbler is held up in a given
position during the locking, while the primary becomes pressed by a
spring into its original position. It results from this arrangement that
the bolt cannot be unlocked until the primary tumbler has been
raised to the same height as before, so as to receive the tongue of
the secondary tumbler. And as this is the case in respect to any one
primary and its accompanying secondary tumblers, so is it the case
whether each set comprises four, five, or any other number. The key
may be altered at pleasure, and will in any form equally well shoot
the bolt; but the lock can only be unfastened by that arrangement of
key which fastened it.
It is, however, desirable to trace the course of improvements more
in detail, because every successive change illustrates one or other of
the several properties required in a good lock. Messrs. Day and
Newell’s lock was not finally brought to an efficient form without
many attempts more or less abortive. Mr. Newell conceived the idea
of applying a second series of tumblers, so placed as to be acted on
by the first series. Each of these secondary tumblers had an
elongated slot, such that a screw could pass through all of them; the
screw having a clamp to overlap the tumblers on the inside of the
lock. The head of the screw rested in a small round hole on the back
of the lock, so placed as to form a secondary key-hole, to which a
small key was fitted. There was thus a double system of locking,
effected in the following way: when the large key had been applied,
and had begun to act on the primary tumblers, the small key was
used to operate on the clamp-screw, and thus bind all of the
secondary tumblers together, ensuring their position at the exact
heights or distances to which the primary key had caused them to
be lifted. The bolt was then free to be shot, and the first series of
tumblers reverted to their original position.
But such an arrangement has obvious inconveniences. Few
persons would incur the trouble of using two keys; and besides this,
there were not wanting certain defects in the action and reaction of
the several parts; for if the clamp-screw were to be left unreleased,
the first series of tumblers would be upheld by the second series in
such a way that the exact impression of the lengths of the several
bits of the key could be obtained through the key-hole while the lock
was unlocked or the bolt unshot. To remedy one or both of these
evils was the next object of Mr. Newell’s attention. He made a series
of notches or teeth in each of the secondary tumblers,
corresponding in mutual distance with the steps or bits of the key;
and opposite these notched edges he placed a dog or lever, with a
projecting tooth suitable to fall into the notches when adjusted
properly in relation to each other. When the key was used, the
primary tumblers were raised in the usual way, and acted on the
secondary tumblers; these latter were so thrown that the dog-tooth
caught in the notches and held them fast, thereby rendering the
same service as the clamp-screw and the small key in the former
arrangement. No other relative position of the bits of the key could
now unlock the lock.
Still, improvement as it was, this change was not enough; Mr.
Newell found that his lock, like all the locks that had preceded it,
was capable of being picked by a clever practitioner; and candidly
admitting the fact, he sought to obtain some new means of security.
He tried what a series of complicated wards would do, in aid of the
former mechanism; but the result proved unsatisfactory. His next
principle was to provide a number of false notches on the abutting
parts of the primary and secondary tumblers, with alterations in
other parts of the apparatus. The theory now depended upon was
this, that if the bolt were subjected to pressure, the tumblers would
be held fast by false notches, and could not be raised by any lock-
picking instrument. To increase the security, a steel-curtain was so
adjusted as to cover, or at least protect, the key-hole. Great
anticipations were entertained of this lock, but they were destined to
be negatived. A clever American machinist, Mr. Pettit, accepted
Messrs. Day and Newell’s challenge (500 dollars to any one who
could pick this lock); he succeeded in picking the lock, and thus won
the prize.
Once again disappointed, Mr. Newell re-examined the whole affair,
and sought for some new principle of security that had not before
occurred to him. He had found that, modify his lock how he might,
the sharp-eyed and neat-fingered mechanician could still explore the
interior of the lock in such a way as to find out the relative positions
of the tumblers, and thus adapt their means to the desired end.
How, therefore, to shut out this exploration altogether became the
problem; how to make a lock, the works of which should be
parautoptic—to coin a word from the Greek, which should signify
concealed from view. The result of his labours was the production of
the American bank-lock now known by that name. The details of this
lock may now conveniently be given.

fig. 40. The American Parautoptic lock; bolt unshot.


fig. 41. The same with the bolt shot.

In fig. 40 the lock is represented in its unlocked state, with the


cover or top-plate removed; the auxiliary tumbler and the detector-
plate are also removed. In fig. 41 it is represented as locked, with
the cover and the detector-plate also removed, and the auxiliary
tumbler in its place. In these two figures, the same letters of
reference apply to the same parts, unless otherwise stated. b b is the
bolt; t1 are the first series of movable slides or tumblers; s shews
the tumbler-springs; t2 the secondary series of tumblers; and t3 the
third or intermediate series—these latter coming between the first
and secondary series; p p are the separating plates between the
several members of the first series of tumblers; s1 are the springs for
lifting the intermediate tumblers. On each of the secondary tumblers
2
t is a series of notches, corresponding in mutual distance with the
difference in the lengths of the movable bits of the key. It thence
happens that, when the key is turned in the lock to lock it, each bit
raises its proper tumbler, so that some one of these notches shall
present itself in front of the tooth t in the dog or lever l l. When the
bolt b is projected by the action of the key, it carries with it the
secondary tumblers t2, and presses the tooth t into the notches; in
so doing, it withdraws the tongues d from between the jaws j j of
the intermediate tumblers t3, and allows the first and intermediate
tumblers to fall to their original position. By the same movement, the
secondary tumblers t2 become held in the position given to them by
the key, by means of the tooth t being pressed into the several
notches, as shewn in the closed state of the lock (fig. 41). Now let
us see what results if any attempt be made to open the lock with
any arrangement of key but that by which it has been locked. In
such case, the tongues d will abut against the jaws j j, preventing
the bolt from being withdrawn; and should an attempt be made to
ascertain which tumbler binds and requires to be moved, the
intermediate tumbler t3 (which receives the pressure), being behind
the iron wall i i, which is fixed completely across the lock, prevents
the possibility of its being reached through the key-hole; and the
first tumblers t are quite detached at the time, thereby making it
impossible to ascertain the position of the parts in the inner chamber
behind the wall i i. k is the drill-pin, on which the key fits; and c is a
revolving ring or curtain, which turns round with the key, and
prevents the possibility of inspecting the interior of the lock through
the key-hole. Should, however, this ring be turned to bring the
opening upwards, a detector-plate d, fig. 42, is immediately carried
over the key-hole by the motion of a pin p1 upon the auxiliary
tumbler t4, which is lifted by the revolution of the ring c, thereby
effectually closing the key-hole. As an additional protection, the bolt
is held from being unlocked by the stud or stump s bearing against
the detector-plate; and, moreover, the lever l l holds the bolt, when
locked, until it is released by the tail of the detector-plate pressing
the pin p1; l1 is a lever which holds the bolt on the upper side, when
locked, until it is lifted by the tumblers acting on the pin p1; x are
separating-plates between the intermediate tumblers t3; u u1 are the
studs for preserving the parallel motion of the different tumblers.

fig. 42. The detector plate of the Parautoptic lock.

Fig. 43 represents the key in two different forms, or with the bits
differently arranged. Either form will lock the lock, but the other will
not then unlock it. The end of the key is represented in fig. 44,
shewing the screw which fixes the bits in their places. The bits for a
six-bitted key are shewn separately in fig. 45.
fig. 43. Key of the Parautoptic lock.

fig. 44. End view of the key.

fig. 45. Separate bits of the key.

In 1847 the parautoptic lock was exhibited at Vienna before the


National Mechanics’ Institute of Lower Austria; and towards the
close of the year Mr. Belmont, consul-general of Austria at New York,
placed in the hands of Messrs. Day and Newell a letter, a diploma,
and a gold medal, forwarded by the Institute. The letter was from
the president of the Institute to Mr. Newell, and was couched in the
following terms:
“The Institute of Lower Austria, at its last monthly session, has
passed the unanimous resolution to award to you its gold medal, as
an acknowledgment of the uncommon superiority of the

You might also like