(eBook PDF) Java Foundations: Introduction to
Program Design and Data Structures 5th Edition
download
https://ebookluna.com/product/ebook-pdf-java-foundations-
introduction-to-program-design-and-data-structures-5th-edition/
Download full version ebook from https://ebookluna.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookluna.com
to discover even more!
(eBook PDF) Introduction to JAVA Programming and Data Structures
Comprehensive Version 11
https://ebookluna.com/product/ebook-pdf-introduction-to-java-programming-
and-data-structures-comprehensive-version-11/
Data Structures and Abstractions with Java 5th Edition (eBook PDF)
https://ebookluna.com/product/data-structures-and-abstractions-with-
java-5th-edition-ebook-pdf/
(eBook PDF) Introduction to Java Programming and Data Structures,
Comprehensive Version, 11th Global Edition
https://ebookluna.com/product/ebook-pdf-introduction-to-java-programming-
and-data-structures-comprehensive-version-11th-global-edition/
C++ Programming. Program Design including Data Structures 8th Edition D.S.
Malik - eBook PDF
https://ebookluna.com/download/c-programming-program-design-including-data-
structures-ebook-pdf/
(eBook PDF) Data Structures and Abstractions with Java 5th Edition by Frank
M. Carrano
https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-5th-edition-by-frank-m-carrano/
(eBook PDF) Data Structures and Abstractions with Java 4th Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-edition/
(eBook PDF) Data Structures and Abstractions with Java 4th Global Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-global-edition/
(eBook PDF) Data Structures and Other Objects Using Java 4th Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-other-objects-
using-java-4th-edition/
(eBook PDF) Data Structures and Problem Solving Using Java 4th Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-problem-
solving-using-java-4th-edition/
To my wife, Sharon, for everything.
– John
To my wonderful wife Susan, and our children, Grace, Anthony, Adam, Lily, EJ, and Peter IV.
Your continued love and support keep me going as always.
– Pete
To my loving wife, Melissa, for her support and encouragement.
– Joe
Contents
Prefacevii
Creditsxxix
VideoNotesxxxi
Chapter 1 Introduction 1
1.1 The Java Programming Language 2
A Java Program 3
Comments 5
Identifiers and Reserved Words 7
White Space 9
1.2 Program Development 11
Programming Language Levels 11
Editors, Compilers, and Interpreters 13
Development Environments 15
Syntax and Semantics 16
Errors 17
1.3 Problem Solving 18
1.4 Software Development Activities 20
1.5 Object-Oriented Programming 21
Object-Oriented Software Principles 22
Chapter 2 Data and Expressions 33
2.1 Character Strings 34
The print and println Methods 34
String Concatenation 36
Escape Sequences 40
2.2 Variables and Assignment 41
Variables 41
The Assignment Statement 44
Constants 46
xiii
xiv CONTENTS
2.3 Primitive Data Types 47
Integers and Floating Points 47
Characters 48
Booleans 50
2.4 Expressions 51
Arithmetic Operators 51
Operator Precedence 52
Increment and Decrement Operators 56
Assignment Operators 57
2.5 Data Conversion 58
Conversion Techniques 60
2.6 Reading Input Data 61
The Scanner Class 61
Chapter 3 Using Classes and Objects 75
3.1 Creating Objects 76
Aliases 78
3.2 The String Class 80
3.3 Packages 83
The import Declaration 84
3.4 The Random Class 86
3.5 The Math Class 89
3.6 Formatting Output 92
The NumberFormat Class 92
The DecimalFormat Class 94
The printf Method 96
3.7 Enumerated Types 97
3.8 Wrapper Classes 100
Autoboxing 102
Chapter 4 Conditionals and Loops 111
4.1 Boolean Expressions 112
Equality and Relational Operators 113
Logical Operators 114
CO N T E N T S xv
4.2 The if Statement 116
The if-else Statement 119
Using Block Statements 121
The Conditional Operator 124
Nested if Statements 125
4.3 Comparing Data 127
Comparing Floats 127
Comparing Characters 127
Comparing Objects 128
4.4 The switch Statement 130
4.5 The while Statement 134
Infinite Loops 140
Nested Loops 141
Other Loop Controls 144
4.6 Iterators 145
Reading Text Files 146
4.7 The do Statement 148
4.8 The for Statement 151
Iterators and for Loops 156
Comparing Loops 157
Chapter 5 Writing Classes 169
5.1 Classes and Objects Revisited 170
Identifying Classes and Objects 171
Assigning Responsibilities 173
5.2 Anatomy of a Class 173
Instance Data 178
UML Class Diagrams 179
5.3 Encapsulation 181
Visibility Modifiers 182
Accessors and Mutators 183
5.4 Anatomy of a Method 188
The return Statement 194
Parameters 196
Local Data 197
Constructors Revisited 198
xvi CONTENTS
5.5 Static Class Members 199
Static Variables 199
Static Methods 200
5.6 Class Relationships 203
Dependency 203
Dependencies among Objects of the Same Class 204
Aggregation 206
The this Reference 211
5.7 Method Design 212
Method Decomposition 213
Method Parameters Revisited 218
5.8 Method Overloading 223
5.9 Testing 224
Reviews 225
Defect Testing 226
Unit Testing 227
Integration Testing 228
System Testing 228
Test-Driven Development 228
5.10 Debugging 229
Simple Debugging with print Statements 230
Debugging Concepts 230
Chapter 6 Graphical User Interfaces 245
6.1 Introduction to JavaFX 246
GUI Elements 249
Alternate Ways to Specify Event Handlers 252
Determining Event Sources 253
6.2 Other GUI Controls 256
Text Fields 256
Check Boxes 259
Radio Buttons 263
Color and Date Pickers 267
6.3 Mouse and Key Events 270
Mouse Events 271
Key Events 276
CO N T E N T S xvii
6.4 Dialog Boxes 279
File Choosers 283
6.5 JavaFX Properties 286
Change Listeners 289
Sliders 292
Spinners 295
6.6 Tool Tips and Disabling Controls 299
Chapter 7 Arrays 313
7.1 Array Elements 314
7.2 Declaring and Using Arrays 315
Bounds Checking 318
Alternative Array Syntax 323
Initializer Lists 324
Arrays as Parameters 325
7.3 Arrays of Objects 325
7.4 Command-Line Arguments 335
7.5 Variable-Length Parameter Lists 337
7.6 Two-Dimensional Arrays 341
Multidimensional Arrays 344
7.7 Arrays and GUIs 346
An Array of Color Objects 346
Choice Boxes 349
Chapter 8 Inheritance 361
8.1 Creating Subclasses 362
The protected Modifier 367
The super Reference 368
Multiple Inheritance 372
8.2 Overriding Methods 373
Shadowing Variables 376
8.3 Class Hierarchies 376
The Object Class 377
Abstract Classes 379
xviii CONTENTS
8.4 Visibility 381
8.5 Designing for Inheritance 383
Restricting Inheritance 384
8.6 Inheritance in JavaFX 385
Chapter 9 Polymorphism 395
9.1 Dynamic Binding 396
9.2 Polymorphism via Inheritance 397
9.3 Interfaces 409
Interface Hierarchies 414
The Comparable Interface 415
The Iterator Interface 415
9.4 Polymorphism via Interfaces 416
Chapter 10 Exceptions 425
10.1 Exception Handling 426
10.2 Uncaught Exceptions 427
10.3 The try-catch Statement 428
The finally Clause 431
10.4 Exception Propagation 432
10.5 The Exception Class Hierarchy 435
Checked and Unchecked Exceptions 439
10.6 I/O Exceptions 439
Chapter 11 Analysis of Algorithms 449
11.1 Algorithm Efficiency 450
11.2 Growth Functions and Big-Oh Notation 451
11.3 Comparing Growth Functions 453
11.4 Determining Time Complexity 455
Analyzing Loop Execution 455
Nested Loops 456
Method Calls 457
CO N T E N T S xix
Chapter12 Introduction to Collections—Stacks 463
12.1 Collections 464
Abstract Data Types 465
The Java Collections API 467
12.2 A Stack Collection 467
12.3 Crucial OO Concepts 469
Inheritance and Polymorphism 470
Generics 471
12.4 Using Stacks: Evaluating Postfix Expressions 472
Javadoc 480
12.5 Exceptions 481
12.6 A Stack ADT 482
12.7 Implementing a Stack: With Arrays 485
Managing Capacity 486
12.8 The ArrayStack Class 487
The Constructors 488
The push Operation 490
The pop Operation 492
The peek Operation 493
Other Operations 493
The EmptyCollectionException Class 494
Other Implementations 495
Chapter 13 Linked Structures—Stacks 503
13.1 References as Links 504
13.2 Managing Linked Lists 506
Accessing Elements 506
Inserting Nodes 507
Deleting Nodes 508
13.3 Elements without Links 509
Doubly Linked Lists 509
13.4 Stacks in the Java API 510
13.5 Using Stacks: Traversing a Maze 511
xx CONTENTS
13.6 Implementing a Stack: With Links 520
The LinkedStack Class 520
The push Operation 524
The pop Operation 526
Other Operations 527
Chapter 14 Queues 533
14.1 A Conceptual Queue 534
14.2 Queues in the Java API 535
14.3 Using Queues: Code Keys 536
14.4 Using Queues: Ticket Counter Simulation 540
14.5 A Queue ADT 545
14.6 A Linked Implementation of a Queue 546
The enqueue Operation 548
The dequeue Operation 550
Other Operations 551
14.7 Implementing Queues: With Arrays 552
The enqueue Operation 556
The dequeue Operation 558
Other Operations 559
14.8 Double-Ended Queues (Dequeue) 559
Chapter 15 Lists 565
15.1 A List Collection 566
15.2 Lists in the Java Collections API 568
15.3 Using Unordered Lists: Program of Study 569
15.4 Using Indexed Lists: Josephus 579
15.5 A List ADT 581
Adding Elements to a List 582
15.6 Implementing Lists with Arrays 587
The remove Operation 589
The contains Operation 591
The add Operation for an Ordered List 592
CO N T E N T S xxi
Operations Particular to Unordered Lists 593
The addAfter Operation for an
Unordered List 593
15.7 Implementing Lists with Links 594
The remove Operation 595
15.8 Lists in JavaFX 597
Observable List 597
Sorted List 597
Chapter 16 Iterators 605
16.1 What’s an Iterator? 606
Other Iterator Issues 608
16.2 Using Iterators: Program of Study Revisited 609
Printing Certain Courses 613
Removing Courses 614
16.3 Implementing Iterators: With Arrays 615
16.4 Implementing Iterators: With Links 617
Chapter 17 Recursion 623
17.1 Recursive Thinking 624
Infinite Recursion 624
Recursion in Math 625
17.2 Recursive Programming 626
Recursion versus Iteration 629
Direct versus Indirect Recursion 629
17.3 Using Recursion 630
Traversing a Maze 630
The Towers of Hanoi 638
17.4 Analyzing Recursive Algorithms 643
Chapter 18 Searching and Sorting 651
18.1 Searching 652
Static Methods 653
Generic Methods 653
Linear Search 654
xxii CONTENTS
Binary Search 656
Comparing Search Algorithms 658
18.2 Sorting 659
Selection Sort 662
Insertion Sort 664
Bubble Sort 666
Quick Sort 668
Merge Sort 672
18.3 Radix Sort 675
18.4 A Different Way to Sort—Comparator 679
Chapter 19 Trees 693
19.1 Trees 694
Tree Classifications 695
19.2 Strategies for Implementing Trees 697
Computational Strategy for Array
Implementation of Trees 697
Simulated Link Strategy for Array
Implementation of Trees 697
Analysis of Trees 699
19.3 Tree Traversals 700
Preorder Traversal 700
Inorder Traversal 701
Postorder Traversal 701
Level-Order Traversal 702
19.4 A Binary Tree ADT 703
19.5 Using Binary Trees: Expression Trees 707
19.6 A Back Pain Analyzer 719
19.7 Implementing Binary Trees with Links 724
The find Method 728
The iteratorInOrder Method 730
Chapter 20 Binary Search Trees 737
20.1 Binary Search Trees 738
Adding an Element to a Binary Search Tree 739
CO N T E N T S xxiii
Removing an Element from a Binary
Search Tree 741
20.2 Implementing a Binary Search Tree 743
20.3 Implementing Binary Search Trees: With Links 745
The addElement Operation 746
The removeElement Operation 748
The removeAllOccurrences Operation 752
The removeMin Operation 753
Implementing Binary Search Trees:
With Arrays 755
20.4 Using Binary Search Trees: Implementing
Ordered Lists 755
Analysis of the BinarySearchTreeList
Implementation 758
20.5 Balanced Binary Search Trees 759
Right Rotation 760
Left Rotation 761
Rightleft Rotation 762
Leftright Rotation 762
20.6 Implementing Binary Search Trees: AVL Trees 762
Right Rotation in an AVL Tree 763
Left Rotation in an AVL Tree 764
Rightleft Rotation in an AVL Tree 764
Leftright Rotation in an AVL Tree 765
20.7 Implementing Binary Search Trees:
Red/Black Trees 766
Insertion into a Red/Black Tree 766
Element Removal from a Red/Black Tree 770
Chapter 21 Heaps and Priority Queues 779
21.1 A Heap 780
The addElement Operation 782
The removeMin Operation 783
The findMin Operation 784
21.2 Using Heaps: Priority Queues 784
xxiv CONTENTS
21.3 Implementing Heaps: With Links 788
The addElement Operation 788
The removeMin Operation 792
The findMin Operation 795
21.4 Implementing Heaps: With Arrays 795
The addElement Operation 797
The removeMin Operation 798
The findMin Operation 800
21.5 Using Heaps: Heap Sort 800
Chapter 22 Sets and Maps 807
22.1 Set and Map Collections 808
22.2 Sets and Maps in the Java API 808
22.3 Using Sets: Domain Blocker 811
22.4 Using Maps: Product Sales 814
22.5 Using Maps: User Management 818
22.6 Implementing Sets and Maps Using Trees 823
22.7 Implementing Sets and Maps Using Hashing 823
Chapter 23 Multi-way Search Trees 831
23.1 Combining Tree Concepts 832
23.2 2-3 Trees 832
Inserting Elements into a 2-3 Tree 833
Removing Elements from a 2-3 Tree 835
23.3 2-4 Trees 838
23.4 B-Trees 840
B*-Trees 841
B+ -Trees 841
Analysis of B-Trees 842
23.5 Implementation Strategies for B-Trees 842
CO N T E N T S xxv
Chapter 24 Graphs 849
24.1 Undirected Graphs 850
24.2 Directed Graphs 851
24.3 Networks 853
24.4 Common Graph Algorithms 854
Traversals 854
Testing for Connectivity 858
Minimum Spanning Trees 860
Determining the Shortest Path 863
24.5 Strategies for Implementing Graphs 863
Adjacency Lists 864
Adjacency Matrices 864
24.6 Implementing Undirected Graphs with an
Adjacency Matrix 865
The addEdge Method 870
The addVertex Method 870
The expandCapacity Method 871
Other Methods 872
Chapter 25 Databases 879
25.1 Introduction to Databases 880
25.2 Establishing a Connection to a Database 882
Obtaining a Database Driver 882
25.3 Creating and Altering Database Tables 885
Create Table 885
Alter Table 886
Drop Column 887
25.4 Querying the Database 887
Show Columns 888
25.5 Inserting, Viewing, and Updating Data 890
Insert 891
xxvi CONTENTS
SELECT ... FROM 891
Update 896
25.6 Deleting Data and Database Tables 897
Deleting Data 897
Deleting Database Tables 898
Appendix A Glossary 903
Appendix B Number Systems 937
Place Value 938
Bases Higher Than 10 939
Conversions940
Shortcut Conversions 943
Appendix C The Unicode Character Set 949
Appendix D Java Operators 953
Java Bitwise Operators 955
Appendix E Java Modifiers 959
Java Visibility Modifiers 960
A Visibility Example 960
Other Java Modifiers 961
Appendix F JavaFX Graphics 963
Coordinate Systems 964
Representing Colors 964
Basic Shapes 965
Arcs970
CO N T E N T S xxvii
Images974
Fonts976
Graphic Transformations 979
Translation979
Scaling980
Rotation981
Shearing982
Polygons and Polylines 982
Appendix G JavaFX Scene Builder 987
Hello Moon 988
Handling Events in JavaFX Scene Builder 993
Appendix H Regular Expressions 997
Appendix I Hashing 999
I.1 A Hashing 1000
I.2 Hashing Functions 1001
The Division Method 1002
The Folding Method 1002
The Mid-Square Method 1003
The Radix Transformation Method 1003
The Digit Analysis Method 1003
The Length-Dependent Method 1004
Hashing Functions in the Java Language 1004
I.3 Resolving Collisions 1004
Chaining1005
Open Addressing 1006
I.4 Deleting Elements from a Hash Table 1009
Deleting from a Chained
Implementation1009
Deleting from an Open Addressing
Implementation1010
Another Random Scribd Document
with Unrelated Content
1775
May 17 To a Key for a lock 0 26
Work done for the Capitol By James Anderson
1773
May 24 To Cleaning a Stove 1 00
July 26 To 4 Bars prs Statue 2 45
Octr 3 To 3 Bars prl Doors @ 2/6 0 76
To 4 Do @ 5/ . 20 mendg a hinge 2/6 1 26
4 To Eight hooks @ 7½ 0 50
15 To 2 Keys prs locks @ 3/9 0 76
To a Box prs do 0 16
1773 Country Dr
Apr 25 To half a Year Salary as Armourer to the
Magazine £10
1760 Collo Custis Estate to Thos Pate Dr.
Feb. 11 To lenthening a Chain and mending a Bed pin £0 3 0
for Cart
To altering a Sett of Clamps Do 0 26
19 To Pointing a Plough 0 26
22 To Making a Screw key for the mill 0 26
23 To Mending 2 Keys for Locks 0 26
27 To Making 2 Bed pins and 2 Linch pins for Cart 0 63
To making Cleavey and Pin Do 0 39
To making Iron work for a Ox yoke 0 50
March 5 To Making a Ox Chain 0 10 6
To making Iron Work for a Ox Yoke 0 39
11 To Altering 3 Mill Hoops 0 39
April 4 To mending a Lock and Key 0 20
26 To Altring a Mill Spindle 0 50
May 1 To Pointing a fluke hoe 0 26
2 To Making 2 Wedges for the Mill 0 26
7 To Mending a Sane 0 13
30 To Pointing a fluke hoe 0 26
June 3 To Dressing 3 mill Peaks and Lengthening a 0 50
crane
30 To Pointing a fluke hoe 0 26
July 5 To Making a Hoope for Mill 10 pounds 0 78
To making 2 Wedges Do 0 26
11 To mending a Broad Ax 0 13
24 To mending a Key for a Lock 0 07½
Novm 17 To making a box for a whip saw 0 39
1761
Feb. 3 To making 2 peed pins for Small Cart 0 26
9 To Mending a Lock 0 13
16
It will be noticed that Pate made or repaired several items “for
the mill.” No doubt this was the windmill shown on the “Frenchman’s
Map” of 1782 as standing on or near Custis’s property to the south of
town. The millwright, the wheelwright, the coachmaker, and the
shipwright all depended heavily on the blacksmith to produce
essential parts of their respective products. The builder of houses,
too, could do little without the nails and the tools that came from the
local smithy.
However, when the “public hospital, for persons of insane and
disordered minds” was built in Williamsburg in 1771, the removable
iron gratings and padlocks to be installed at all the windows were
imported from England. For this large specialty job, even James
Anderson, the town’s foremost smith, was passed over. Similarly,
wrought-iron gates and balconies on the public buildings of
Williamsburg appear to have been ordered from England. The Capitol
was to have “on each Side ... an Iron Balcony upon the first Floor,”
and the assembly explicitly empowered the overseers in charge of
building both the first Capitol and the Governor’s Palace to send to
England for ironwork, glass, and other materials necessary.
Likewise, the elaborate gates at Westover plantation were made for
William Byrd II in England. A “Set of Iron Palisades and Gates
curiously wrought,” sold as part of a prize cargo in Norfolk in 1748,
probably came from France. When the House of Burgesses in 1768
commissioned a statue of the beloved Governor Botetourt, the
sculptor, Richard Hayward of London, was also to provide the iron
railing that surrounded the base of the statue when it was set up in
the portico of the Capitol. One reason for importing ironwork for
these large jobs may have been that local smiths were not equipped
to handle them; more likely, the importation was politically wise since
manufacturing in the colonies was discouraged by the British
government.
17
Ornamental ironwork is less characteristic of the colonial Virginia
scene than of Charleston, South Carolina, and New Orleans.
Nevertheless, there are some survivals, none finer than these
two gates at Westover plantation on the James River.
18
TOOLS AND TECHNIQUES
The bills and accounts quoted a few pages back, and others, give
ample evidence that most colonial smiths could read and write—
although their spelling (like George Washington’s) might have a way
of its own. At least one Williamsburg blacksmith, Hugh Orr, seems to
have been quite a reader; at his death in 1764 he left a library of
about forty books. But neither he nor any other colonial smith sat
down to write out and illustrate a description of the work he did and
how he did it.
This is not intended to be a how-to-do-it manual either. A few pages
of text and pictures can hardly substitute for the apprenticeship of as
much as seven years through which a blacksmith gained mastery of
his craft. Only the close daily supervision of an expert and years of
practice will enable a smith to know when the eye of his fire is large
enough—but not too large ... when the forced draft of his bellows has
made the fire hot enough—but not too hot ... when his iron is red
enough—but not too red ... when his hammer blows fall heavily
enough—but not too heavily to accomplish the particular job at hand.
Readers unfamiliar with the processes and products of a smithy are
likely to be strangers also to many of the smith’s tools—which makes
for something of a problem in trying to describe them. For this and
other reasons it seems wise to start with what may be the most
familiar items today.
Nails. In the early years of the Jamestown colony land was plentiful
and nails were scarce. They, like every other object of iron—except
the “little chissels” mentioned by Captain John Smith—had to be
brought over from England. When the soil of their tobacco fields was
worn out, planters simply took up, cleared, and planted new land
farther west. Sometimes they set fire to buildings on the abandoned
land in order to salvage the nails for re-use, a practice that was
forbidden by law in 1644.
However, nails were not difficult to make if one had a supply of
wrought-iron rods and a few tools. Frontier farmers—which in
eighteenth-century Virginia meant those living one or two 19
hundred miles to the west of Williamsburg—sometimes spent
winter days in nailmaking. The fireplace served as forge, and even
the younger members of the family could wield tongs, hammers, and
cold chisel or man the vise.
Nails and tacks of various sizes and shapes and for various
special uses, from Diderot’s encyclopedia. Figure 14 at the lower
right is a wheel nail, for example.
Where there was a blacksmith, as we have already seen, he—or more
likely his apprentice—made the nails. James Anderson estimated that
eight boys could turn out twenty-five thousand nails in a week. Isaac
Zane, who had an ironworks in the neighborhood of Winchester,
owned “17 nailors tools great & small” and “2 nailors anvills.” The
smith probably started with iron several feet long, about one-quarter-
inch in width and the same thickness, produced in a slitting mill. His
first procedure was to draw them down—and here we come to 20
the first terminological stumbling block. Drawing down (or
drawing out or beating out) is the smith’s phrase for thinning and
lengthening a piece of metal by heating and hammering it. The
contrary process of thickening—by hammering on the end of a rod—
is called upsetting and is the technique used in making the head of
the nail. Before he did that, though, the smith, having drawn down
the rod to the proper thickness for the nails to be made, cut them to
the desired length. Most likely he did this on a hardie, which is like a
chisel held with the point upward in the square hardie hole of the
anvil.
Horseshoes. Hugh Jones in 1724 wrote that horseshoes were “seldom
used in the lower part of the country, where there are few stones.” It
is true that the soil of tidewater Virginia tends to be sandy and free of
stones, so that horses could and did go unshod much of the time. Yet
there is ample evidence—some of which we have seen in the
accounts excerpted above—that blacksmiths and farriers worked in
the Williamsburg area at making and mounting horseshoes.
The forge of Master Delafosse, royal farrier, in Paris in the mid-
eighteenth century. From Diderot’s encyclopedia.
A smith who made, fitted, and applied shoes to horses, mules, 21
and oxen was properly called a farrier. The trade demands
knowledge and skill in handling iron, and also knowledge and skill in
handling the animals being shod. Because of his close familiarity with
these animals, his “horse sense,” so to speak, the farrier often served
the function of veterinarian too. More often, however, it was the
blacksmith who also served as farrier.
Horseshoes were made from bar iron, and they were normally
custom made to fit not just a particular horse, but a particular one of
his feet. Each shoe of a set of four will differ in one or more respects
—size, shape, or weight—from its fellows, and each set may differ
from others depending on the type of horse involved—draft, riding,
carriage, etc.—and the condition of surface on which the shoes are to
be used—ice, mud, stone, etc. In addition, special shoes can correct
defects in gait, guard against lameness, and the like. To describe how
a smith made all of these possible variations is no part of this
booklet. Suffice it to say that in the making of a horseshoe all of the
blacksmith’s basic tools come into use: forge, anvil, tongs, and vise.
Some attention to each of these in turn will help to round out an
understanding of the workings of the smithy.
Forge. The blacksmith’s forge, which he sometimes calls his fire, is
the most important feature of his shop. It consists of a square
hearth, usually raised about two and one-half feet and made of brick,
with a bellows at the side or back to blow the fire, a hood or hovel
above to carry smoke and fumes away, and a trough or tub of water
close by in which to quench the iron or cool the tongs.
The fire itself, of coal rather than charcoal, is always small and
concentrated, a few inches across in the center of a hearth that may
be four or five feet square. Around it lies unburnt fuel that the smith
can handily bring closer when needed. With his slice—a long-handled,
light-weight shovel—his fire-hook—a similarly long-handled rake—and
his washer—a bunch of twigs to flick water around the fire—he
carefully manages the size and depth of the fire. With the bellows he
regulates its intensity.
The blacksmith must be able to judge when his stock is hot 22
enough, and he does it by eye, the right degree of heat for a
particular operation being revealed by the color of the iron. Blood-red
heat is called for when the iron is not to be reshaped but only the
surface to be smoothed. Flame heat or white heat is necessary when
the work is to be hammered to a different shape, drawn down, or
upset. Sparkling heat or welding heat is used only for the delicate
and highly skilled process of welding.
Anvil. This is hardly less important to the smith than the forge, as he
does practically all of his work on it. The common smith’s anvil, made
of cast or wrought iron, may weigh up to about three hundred
pounds. It has had the same basic shape since ancient times, each of
its features being functionally tried and perfected ages ago. The
anvil’s upper surface, called the face, is flat, smooth, so hard that a
file will not cut it, and made of cast steel welded to the wrought iron
body. One end of the anvil is a cone-shaped projection called the
horn (also called beak, bick, bickern, or pike), used to work curved or
rounded pieces of iron such as rings, links, or shackles. Between the
horn and the face of the anvil is a small square area called the table.
Its surface is not as hard as that of the face, and the smith places on
it any work he wants to cut with a cold chisel. Near the other end or
heel of the anvil are two holes, one round, called the pritchel hole,
and the other square, called the hardie hole. When the smith intends
to punch a hole through a piece of metal, he positions it over the
pritchel hole so that the punch will pass into the hole rather than
strike the face of the anvil. The hardie hole (also called the swage
hole) is designed to take the square shanks of a variety of special-
purpose bottom tools—which make their impact on the underside of
the work when the smith strikes it from above.
Tongs. Iron being a metal that transmits heat readily, the blacksmith
often cannot hold the piece he is working on, even with a gloved
hand. He needs tongs to do the holding, and because of the differing
shape of different objects being worked, he needs a variety of tongs
of different shapes and sizes. These he ordinarily makes 23
himself. John Brush of Williamsburg, for instance, owned “7
pair of Smiths Tongs.”
Hammers. It has already been said that the smith’s forge and anvil
are among his essential tools. So is his hammer—or rather hammers,
for he needs several of different shapes and weights, as well as a
sledge or two.
A small selection of tools such as would be found in almost any
blacksmith’s shop: fire tools, tongs, pincer, hammers, chisels,
stamps, and stakes or hardies. From Diderot.
Vises. Smiths’ vises are of two types, the large standing vise, 24
used to hold iron for bending, riveting, filing, or polishing, and
the small or hand vise to hold work of similar size. In both cases the
work will have already undergone the major part of its forming on the
anvil, and the vise comes into use almost solely for finishing
operations.
Other tools that have particular uses may be no less important to the
smith when he has occasion to use them. Among them may be
mentioned drills, swages, swage blocks, hardies, stakes, punches,
cold chisels, files, screw plates, flatter, fuller, header, and mandrel. It
is recommended to the reader who wants to know the nature and
uses of these and other tools in a smithy that he become an
apprentice to the nearest blacksmith; there is no better way to learn.
Certainly no one can learn to anneal, braze, case-harden, temper, lay,
and weld iron just by reading about it. But we can at least offer some
definitions:
Annealing is the process of softening steel so that it can be worked
by cutting tools. It is done by heating the piece in the fire to blood-
red heat, then allowing it to cool slowly.
Brazing joins together two or more pieces of metal by the use of a
brass solder, called spelter. It is used when the pieces to be joined
are too thin to be welded.
Case hardening is the process of hardening the outer surfaces of iron
or steel, while leaving the core soft and therefore tougher. According
to Joseph Moxon’s Mechanick Exercises (third edition published in
London in 1703) it was to be accomplished as follows: Cover the iron
all over with a cement made of powdered cow horn or hoof, coarse
sea salt, stale urine or white wine vinegar, and clay, with more clay
added to enclose the whole; when the clay has dried hard, put the
whole lump in the fire and bring it to blood-red heat, no more; then
take the iron out and quench it.
Tempering is the opposite of annealing, in that it slightly softens and
toughens iron or steel. It is accomplished by bringing the object to
the proper heat—which may differ according to the {...}
25
Laying was one of the most frequent operations performed by
colonial smiths. Such implements as axes, hoes, and plows usually
had wooden handles and wrought-iron heads, with a strip of steel
welded on to make the cutting edge or face. When the last become
worn, the process of replacing it was called laying or steeling.
Welding two pieces of iron is at the same time very simple in theory
and very difficult in fact. At the proper heat the two pieces placed
firmly face to face will—if the faces are clean—stick together without
further ado. But accomplishing this feat requires great skill with the
fire and great quickness with the hammer so that scale will not form
on the surfaces to be welded. Normally the weld is hammered
together on the anvil to refine the grain of the metal as it cools.
Another farrier’s shop, no doubt drawn on the spot with tools
and equipment just as they were seen by the artist. From
Diderot.
26
THE ESSENTIAL CRAFT
James Anderson was described earlier in these pages as
Williamsburg’s foremost blacksmith during the years when his shop
occupied a lot on Francis Street. Several of his ledger books are still
in existence, some of them treasured possessions of Colonial
Williamsburg. Among endless entries covering the laying of axes,
hoes, plows, and colters, appear others that show the less routine
aspects of Anderson’s daily work: mending a poker; making a nut for
a bolt of a chair (probably a riding chair); dressing two mill picks;
mending a lock; altering 40 window hooks; making a hasp and staple
for a henhouse; providing handle, wedges, and ring for a scythe;
fixing a new end to an oyster clamp; putting a handle on a
“teakittle”; forging a well chain; making a “strike tier,” i.e., strakes for
wagon wheel and nails to attach them; spindle for a wheel; prong for
a dung fork; putting a hoop on a barrel; mending a coffee mill; 9
“fronts” and a rib for a griddle; 50 spikes; a pair of flatirons; mending
and installing locks, keys, window bars, leg irons, and chains for the
“lunatick hospital”; lengthening the bearer and adding a new middle
foot to an andiron; “a Sett of Iron for a dressing table”; four breast
plate buckles (for a harness); drilling a gun; mending an umbrella;
“triming a horse feet”; making, mending, putting on, and taking off
leg irons and hand cuffs for the jail.
Clearly everyone in town had to patronize the blacksmith sooner or
later. He was, in a very real sense, a craftsman for all seasons.
27
THE BLACKSMITHS OF WILLIAMSBURG
This list includes only the men who were primarily blacksmiths or
who clearly did blacksmithing along with their work in other iron
crafts. The dates designate the years when they are known to have
been in Williamsburg.
James Anderson, 1762-1798. Born in Gloucester County in 1740.
Public armorer in Williamsburg from 1766, and supplier of arms
to the Revolutionary forces of Virginia. His forge probably
occupied the lot on Francis Street in Williamsburg next to the
Barraud House. He employed a number of journeymen
gunsmiths, blacksmiths, and nailers, and at one time had as
many as nine apprentices. He and his shops were moved to
Richmond along with other government agencies when that city
became the seat of government in 1780; in 1793 he turned his
Richmond shop over to his son and moved back to Williamsburg.
William Ashburn, 1774. Advertised in April of that year that he had
opened shop near the Capitol in Williamsburg. May have been in
town three years earlier, but little else is known of him.
John Bell, 1753-1776. Called himself both whitesmith and blacksmith.
Served as public armorer from 1763 to 1766, when he moved to
Portsmouth.
James Bird, 1740-1758. Established his shop “in the Market Square”
on land leased from the trustees of the city of Williamsburg. Was
lacking both as master and as businessman: an apprentice sued
in court and obtained release from his indenture; pleading that
the blacksmith “misused” him, and after his creditors foreclosed
the mortgage on his property, Bird departed town “in low 28
Circumstances.”
Robert Bond, 1761-1783. Learned blacksmithing as an apprentice in
Yorktown. Bought large quantities of bar iron from Robert Carter.
Worked for the state during the Revolution and got caught in a
bureaucratic vise: when the British destroyed his bellows he
could not, despite an order from the commissioner of war, obtain
“any Lether With out the Money and i am in tylerly idle theay
wont Let Me Draw any Provisions because i ant at Work and i
Cant Doe anything With out my Bellus.”
John Brush, 1717-1726. Primarily a gunsmith; may also have
engaged in the blacksmith’s trade. Thought to have been a
protégé of Governor Spotswood because he did “work and
reparations about the Governors House,” and built his home on
the Palace Green nearby. Was keeper of the public arms and
those of the governor; in 1723 petitioned the legislature (in vain)
for an allowance “for his misfortune in being blown up and hurt
in firing the Guns on his Majtys Birthday.”
Thomas Cowles, 1772-1775. He was a patient of Dr. John M. Galt,
bought bar iron from Robert Carter, and repaired the arms of
“Capt. Lynes Compy of Minute Men.” Nothing else is known of
him.
John Draper, 1769-1789. Blacksmith, farrier, and veterinary, whose
shop was on Duke of Gloucester Street and who lived on the
corner of Francis and Waller streets “where the Old Play House
lately stood.” During the Revolution he made guns, rented out
riding chairs, rode express, repaired arms, and supplied nails and
shot.
James, David, and William Geddy, 1736-about 1780. James Geddy,
gunsmith, father of David and William (also of James Geddy, Jr.,
the silversmith), established his shop in Williamsburg sometime
before 1736; he died in 1744. He and two of his sons did cutlery
work, brass casting, and iron founding as well as gunsmithing;
the sons also purveyed rupture bands and a vermifuge for
horses, and offered to cure “the most inveterate Pole-evils 29
and Fistulas ... and all Diseases incident to Horses.” During
the Revolution William was paid for repairing arms and casting
ball; he died in 1784.
John Moody, 1776-1779. Smith and farrier, from Philadelphia by way
of Norfolk, advertised his shop near the church in 1776. Was
paid on several occasions for shoeing horses, but little more is
known of him before his death in 1779.
Hugh Orr, 1738-1764. Captain Orr called himself both blacksmith and
“hammer man,” and settled in Williamsburg by 1738. His house
and smithy were on Duke of Gloucester Street. He may have
acted as farrier, and either he or a slave trained to do so
performed phlebotomy—bleeding. He served as armorer for the
colony for three years and may have been an officer in the
Williamsburg militia. He is buried in Bruton churchyard.
Thomas Pate, 1760-1814. Did blacksmith work for John Custis and
Lord Botetourt among others, and repaired arms for Virginia
troops during the Revolution. The location of his shop is not
known, but his purchase of more than 3,000 pounds of bar iron
from Robert Carter in 1773 alone indicates a lively trade.
William Willis (or Willess), 1768-1770. Came from Birmingham and
opened his gunsmith and blacksmith shop “near the playhouse”
and “below the Capitol,” but soon moved to Norfolk.
30
Suggestions for Further Reading
Alex W. Bealer, The Art of Blacksmithing. rev. ed. New York, Funk and
Wagnalls, 1976.
Garry Hogg, Hammer & Tongs: Blacksmithery Down the Ages.
London, Hutchinson Co., 1964.
J. G. Holmstrom, Modern Blacksmithing and Horseshoeing. Chicago,
F. J. Drake & Co., 1941.
John Jernberg, Forging: Manual of Practical Instruction in Hand
Forging of Wrought Iron.... Chicago, American Technical Society,
1917.
William Allyn Richards, Forging of Iron and Steel. New York, D. Van
Nostrand Co., 1915.
F. W. Robins, The Smith: The Traditions and Lore of an Ancient Craft.
London, Rider and Co., 1953.
H. R. Bradley Smith, Blacksmiths’ and Farriers’ Tools at Shelburne
Museum: A History of Their Development from Forge to Factory.
Shelburne, Vt., Shelburne Museum, 1966.
Albert H. Sonn, Early American Wrought Iron. New York, Charles
Scribner’s Sons, 1928.
Aldren A. Watson, The Village Blacksmith. New York, Thomas Y.
Crowell Co., 1968.
The Blacksmith in Eighteenth-Century Williamsburg, first published in
1971, is based largely on an unpublished monograph by Harold B.
Gill, Jr., of the Colonial Williamsburg research staff. It has been
prepared with the assistance of Thomas K. Ford, editor until 1976,
Colonial Williamsburg Department of Publications.
Transcriber’s Notes
Retained publication information from the printed edition: this
eBook is public-domain in the country of publication.
Silently corrected a few palpable typos.
In the text versions only, text in italics is delimited by
_underscores_.
Marked a lacuna in the original printed edition with “{...}”.
*** END OF THE PROJECT GUTENBERG EBOOK THE BLACKSMITH
IN EIGHTEENTH-CENTURY WILLIAMSBURG ***
Updated editions will replace the previous one—the old editions will
be renamed.
Creating the works from print editions not protected by U.S.
copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.
START: FULL LICENSE
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!
ebookluna.com