Pragmatic unit testing in Java with JUnit 1st Edition Andy Hunt All Chapters Instant Download
Pragmatic unit testing in Java with JUnit 1st Edition Andy Hunt All Chapters Instant Download
com
https://ebookname.com/product/pragmatic-unit-testing-in-
java-with-junit-1st-edition-andy-hunt/
OR CLICK BUTTON
DOWNLOAD EBOOK
Mockito Made Clear Java Unit Testing with Mocks Stubs and
Spies Ken Kousen
https://ebookname.com/product/mockito-made-clear-java-unit-testing-
with-mocks-stubs-and-spies-ken-kousen/
ebookname.com
https://ebookname.com/product/the-art-of-unit-testing-with-examples-
in-net-1st-edition-roy-osherove/
ebookname.com
https://ebookname.com/product/javascript-unit-testing-1st-edition-
hazem-saleh/
ebookname.com
https://ebookname.com/product/combating-international-crime-the-
longer-arm-of-the-law-1st-edition-steven-da-brown/
ebookname.com
Terrorism Risk and the Global City Towards Urban
Resilience Jon Coaffee
https://ebookname.com/product/terrorism-risk-and-the-global-city-
towards-urban-resilience-jon-coaffee/
ebookname.com
https://ebookname.com/product/the-political-legacy-of-aung-san-josef-
silverstein-editor/
ebookname.com
https://ebookname.com/product/spike-lee-dennis-abrams/
ebookname.com
https://ebookname.com/product/vf-11-111-sundowners-1942-95-aviation-
elite-units-tillman/
ebookname.com
More Than Mayor or Manager Campaigns to Change Form of
Government in America s Large Cities 1st Edition James H.
Svara
https://ebookname.com/product/more-than-mayor-or-manager-campaigns-to-
change-form-of-government-in-america-s-large-cities-1st-edition-james-
h-svara/
ebookname.com
What readers are saying about
Pragmatic Unit Testing. . .
“I’m not totally new to testing, but I’ve struggled with many
aspects of it. I think this book does a good job of bringing
those along who are completely new to unit testing, but still
has enough advanced material to assist those of us who have
dabbled in testing and floundered once we’ve hit obstacles.”
Andrew Thompson,
Consultant, Greenbrier & Russel
Every precaution was taken in the preparation of this book. However, the
publisher assumes no responsibility for errors or omissions, or for damages
that may result from the use of information (including program listings) con-
tained herein.
http://www.pragmaticprogrammer.com
ISBN 0-9745140-1-2
Text printed on acid-free paper.
First printing, September 2003
Contents
About the Starter Kit viii
Preface x
1 Introduction 1
1.1 Coding With Confidence . . . . . . . . . . . . . . 2
1.2 What is Unit Testing? . . . . . . . . . . . . . . . 3
1.3 Why Should I Bother with Unit Testing? . . . . 4
1.4 What Do I Want to Accomplish? . . . . . . . . . 5
1.5 How Do I Do Unit Testing? . . . . . . . . . . . . 7
1.6 Excuses For Not Testing . . . . . . . . . . . . . . 7
1.7 Roadmap . . . . . . . . . . . . . . . . . . . . . . 12
8 Testing on a Project 87
8.1 Where to Put Test Code . . . . . . . . . . . . . . 87
8.2 Test Courtesy . . . . . . . . . . . . . . . . . . . . 91
8.3 Test Frequency . . . . . . . . . . . . . . . . . . . 92
8.4 Tests and Legacy Code . . . . . . . . . . . . . . 93
8.5 Tests and Reviews . . . . . . . . . . . . . . . . . 96
9 Design Issues 99
9.1 Designing for Testability . . . . . . . . . . . . . . 99
9.2 Refactoring for Testing . . . . . . . . . . . . . . . 101
9.3 Testing the Class Invariant . . . . . . . . . . . . 112
9.4 Test-Driven Design . . . . . . . . . . . . . . . . . 115
9.5 Testing Invalid Parameters . . . . . . . . . . . . 117
A Gotchas 119
A.1 As Long As The Code Works . . . . . . . . . . . 119
A.2 “Smoke” Tests . . . . . . . . . . . . . . . . . . . 119
A.3 “Works On My Machine” . . . . . . . . . . . . . . 120
A.4 Floating-Point Problems . . . . . . . . . . . . . . 120
A.5 Tests Take Too Long . . . . . . . . . . . . . . . . 121
A.6 Tests Keep Breaking . . . . . . . . . . . . . . . . 121
A.7 Tests Fail on Some Machines . . . . . . . . . . . 122
A.8 My main is Not Being Run . . . . . . . . . . . . 123
D Resources 132
D.1 On The Web . . . . . . . . . . . . . . . . . . . . . 132
D.2 Bibliography . . . . . . . . . . . . . . . . . . . . 134
2 http://www.pragmaticprogrammer.com/sk/ut/
3 http://www.xprogramming.com/software.htm
P REFACE xi
For the more advanced programmer, who has done unit test-
ing before, we hope there will be a couple of nice surprises for
you here. Skim over the basics of using JUnit and concentrate
on how to think about tests, how testing affects design, and
how to handle certain team-wide issues you may be having.
And remember that this book is just the beginning. It may be
your first book on unit testing, but we hope it won’t be your
last.
Typographic Conventions
italic font Indicates terms that are being defined, or
borrowed from another language.
Acknowledgments
We’d especially like to thank the following Practitioners for
their valuable input, suggestions, and stories: Mitch Amiano,
Nascif Abousalh-Neto, Andrew C. Oliver, Jared Richardson,
and Bobby Woolf.
Thanks also to our reviewers who took the time and energy
to point out our errors, omissions, and occasionally-twisted
writing: Will Gwaltney, Sharee L. Johnson, Eric Kalendra, Al
Koscielny, James J. O’Connor III, Mike Stok, Drew Thompson,
and Eric Vought.
Thanks to all of you for your hard work and support.
Introduction
There are lots of different kinds of testing that can and should
be performed on a software project. Some of this testing re-
quires extensive involvement from the end users; other forms
may require teams of dedicated Quality Assurance personnel
or other expensive resources.
But that’s not what we’re going to talk about here.
Instead, we’re talking about unit testing: an essential, if often
misunderstood, part of project and personal success. Unit
testing is a relatively inexpensive, easy way to produce better
code, faster.
Many organizations have grand intentions when it comes to
testing, but tend to test only toward the end of a project, when
the mounting schedule pressures cause testing to be curtailed
or eliminated entirely.
Many programmers feel that testing is just a nuisance: an
unwanted bother that merely distracts from the real business
at hand—cutting code.
Everyone agrees that more testing is needed, in the same way
that everyone agrees you should eat your broccoli, stop smok-
ing, get plenty of rest, and exercise regularly. That doesn’t
mean that any of us actually do these things, however.
But unit testing can be much more than these—while you
might consider it to be in the broccoli family, we’re here to tell
C ODING W ITH C ONFIDENCE 2
you that it’s more like an awesome sauce that makes every-
thing taste better. Unit testing isn’t designed to achieve some
corporate quality initiative; it’s not a tool for the end-users,
or managers, or team leads. Unit testing is done by program-
mers, for programmers. It’s here for our benefit alone, to make
our lives easier.
Put simply, unit testing alone can mean the difference be-
tween your success and your failure. Consider the following
short story.
Dale rarely used the debugger, if ever, and was somewhat puz-
zled at the picture of Pat, head in hands, muttering various
evil-sounding curses at the computer with wide, bloodshot
eyes staring at all those debugger windows.
The deadline came and went, and Pat didn’t make it. Dale’s
code was integrated and ran almost perfectly. One little glitch
came up, but it was pretty easy to see where the problem was.
Dale fixed it in just a few minutes.
Now comes the punch line: Dale and Pat are the same age,
and have roughly the same coding skills and mental prowess.
The only difference is that Dale believes very strongly in unit
testing, and tests every newly-crafted method before relying
on it or using it from other code.
Pat does not. Pat “knows” that the code should work as writ-
ten, and doesn’t bother to try it until most of the code has
been written. But by then it’s too late, and it becomes very
hard to try to locate the source of bugs, or even determine
what’s working and what’s not.
Viewing this olive leaf of the Old Red Sandstone as not at all devoid
of poetry, our author invites us to a voyage from the latest formation
up to the first zone of the Silurian formation,—thus passing from
ancient to still more ancient scenes of being, and finding, as at the
commencement of our voyage, a graceful intermixture of land and
water, continent, river, and sea.
But though the existence of a true Placoid, a real vertebrated fish,
in the Cambrian limestone of Bala, and of true wood at the base of
the Old Red Sandstone, are utterly incompatible with the
development hypothesis, its supporters, thus driven to the wall, may
take shelter under the vague and unquestioned truth that the lower
plants and animals preceded the higher, and that the order of
creation was fish, reptiles, birds, mammalia, quadrumana, and man.
From this resource, too, our author has cut off his opponents, and
proceeds to show that such an order of creation, “at once wonderful
and beautiful,” does not afford even the slightest presumption in
favor of the hypothesis which it is adduced to support.
This argument is carried on in a popular and amusing dialogue in
the eleventh chapter. Mr. Miller shows, in the clearest manner, that
“superposition is not parental relation,” or that an organism lying
above another gives us no ground for believing that the lower
organism was the parent of the higher. The theorist, however, looks
only at those phases of truth which are in unison with his own
views; and, when truth presents no such favorable aspect, he finally
wraps himself up in the folds of ignorance and ambiguity—the
winding-sheet of error refuted and exposed. We have not yet
penetrated, says he, in feeble accents, to the formations which
represent the dawn of being, and the simplest organism may yet be
detected beneath the lowest fossiliferous rocks. This undoubtedly
may be, and Sir Charles Lyell and Mr. Leonard Horner are of opinion
that such rocks may yet be discovered; while Sir Roderick Murchison
and Professor Sedgwick and Mr. Miller are of an opposite opinion.
But even were such rocks discovered to-morrow, it would not follow
that their organisms gave the least support to the development
hypothesis. In the year 1837, when fishes were not discovered in the
Upper Silurian rocks, the theorist would have rightly predicted the
existence of lower fossiliferous beds; but when they are discovered,
and their fossils examined, they furnish the strongest argument that
could be desired against the theory they were expected to sustain.
This fact, no doubt, is so far in favor of the supposition that there
may be still lower fossil-bearing strata; but, as Mr. Miller observes,
“The pyramid of organized existence, as it ascends into the by-past
eternity, inclines sensibly towards its apex,—that apex of ‘beginning’
on which, on far other than geological grounds, it is our privilege to
believe. The broad base of the superstructure planted on the
existing scene stretches across the entire scale on life, animal and
vegetable; but it contracts as it rises into the past;—man,—the
quadrumana,—the quadrupedal man,—the bird and the reptile are
each in succession struck from off its breadth, till we at length see it
with the vertebrata, represented by only the fish, narrowing as it
were to a point; and though the clouds of the upper region may hide
its apex, we infer, from the declination of its sides, that it cannot
penetrate much farther into the profound.”
In our author’s next chapter, the twelfth of the series, he proceeds
to examine the “Lamarckian hypothesis of the origin of plants, and
its consequences.”
In his thirteenth chapter, on “The two Floras, marine and
terrestrial,” he has shown that all our experience is opposed to the
opinion, that the one has been transmuted into the other. If the
marine had been converted into terrestrial vegetation, we ought to
have, in the Lake of Stennis, for example, plants of an intermediate
character between the algæ of the sea, and the monocotyledons of
the lake. But no such transition-plants are found. The algæ, as our
author observes, become dwarfish and ill-developed. They cease to
exist as the water becomes fresher, “until at length we find, instead
of the brown, rootless, flowerless fucoids and confervæ of the
ocean, the green, rooted, flowering flags, rushes, and aquatic
grasses of the fresh water. Many thousands of years have failed to
originate a single intermediate plant.” The same conclusion may be
drawn from the character of the vegetation along the extensive
shores of Britain and Ireland. No botanist has ever found a single
plant in the transition state.
The fourteenth chapter of the “Footprints” will be perused with
great interest by the general reader. It is a powerful and
argumentative exposure of the development hypothesis, and of the
manner in which the subject has been treated in the “Vestiges.”
Whether we consider it in its nature, in its history, or in the character
of the intellects with whom it originated, or by whom it has been
received and supported, Mr. Miller has shown that it has nothing to
recommend it. It existed as a wild dream before Geology had any
being as a science. It was broached more than a century ago by De
Maillet, who knew nothing of the geology even of his day. In a
translation of his Telhamed, published in 1750, Mr. Miller finds very
nearly the same account given of the origin of plants and animals, as
that in the “Vestiges,” and in which the sea is described as that
“great and fruitful womb of nature, in which organization and life
first begin.” Lamarck, though a skilful botanist and conchologist, was
unacquainted with geology; and as he first published his
development hypothesis in 1802, (an hypothesis identical with that
of the “Vestiges,”) it is probable that he was not then a very skilful
zoologist. Nor has Professor Oken any higher claims to geological
acquirements. He confesses that he wrote the first edition of his
work in a kind of inspiration! and it is not difficult to estimate the
intelligence of the inspiring idol that announced to the German sage
that the globe was a vast crystal, a little flawed in the facets, and
that quartz, feldspar, and mica, the three constituents of granite,
were the hail-drops of heavy showers of stone that fell into the
original ocean, and accumulated into rocks at the bottom!
Such is the unscientific parentage of the theories promulgated in
the “Vestiges.” But the author of this work appeals in the first
instance to science. Astronomy, Geology, Botany, and Zoology are
called upon to give evidence in his favor; but the astronomer,
geologist, botanist, and the zoologist, all refuse him their testimony,
deny his premises, and reject his results. “It is not,” as Mr. Miller
happily observes, “the illiberal religionist that casts him off. It is the
inductive philosopher.” Science addresses him in the language of the
possessed: “The astronomer I know, and the geologist I know; but
who are ye?” Thus left alone in a cloud of star-dust, or in brackish
water between the marine and terrestrial flora, he “appeals from
science to the want of it,” casts a stone at our Scientific Institutions,
and demands a jury of “ordinary readers,” as the only “tribunal” by
which “the new philosophy is to be truly and righteously judged.”
The last and fifteenth chapter of Mr. Miller’s work, “On the Bearing
of Final Causes on Geologic History,” if read with care and thought,
will prove at once delightful and instructive. The principle of final
causes, or the conditions of existence, affords a wide scope to our
reason in Natural History, but especially in Geology. It becomes an
interesting inquiry, if any reason can be assigned why at certain
periods species began to exist, and became extinct after the lapse of
lengthened periods of time, and why the higher classes of being
succeeded the lower in the order of creation? The incompleteness of
geological science, however, does not permit us to remove, for the
present, the veil which hangs over this mysterious chronology; but
our author is of opinion that in about a quarter of a century, in a
favored locality like the British Islands, geological history “will
assume a very extraordinary form.”
It is a singular fact, which will yet lead to singular results, that
Cuvier’s arrangement of the four classes of vertebrate animals
should exhibit the same order as that in which they are found in the
strata of the earth. In the fish, the average proportion of the brain to
the spinal cord is only as 2 to 1. In the reptile, the ratio is 2½ to 1.
In the bird, it is as 3 to 1. In the mammalia, it is as 4 to 1; and in
man, it is as 23 to 1. No less remarkable is the fœtal progress of the
human brain. It first becomes a brain resembling that of a fish; then
it grows into the form of that of a reptile; then into that of a bird;
then into that of a mammiferous quadruped, and finally it assumes
the form of a human brain, “thus comprising in its fœtal progress an
epitome of geological history, as if man were in himself a
compendium of all animated nature, and of kin to every creature
that lives.”
With these considerations, Mr. Miller has brought his subject to the
point at which Science in its onward progress now stands. It is to
embryology we are in future to look for further information upon the
most intimate relations which exist between all organized beings. We
may fairly entertain the hope that the time is not far when we shall
not only fully understand the Plan of Creation, but even lift some
corner of the veil which has hitherto prevented us from forming
adequate ideas of the first introduction of animal and vegetable life
upon earth, and of the changes which both kingdoms have
undergone in the succession of geological ages.
L. AGASSIZ.
Cambridge, September, 1850.
CONTENTS
PAGE
STROMNESS AND ITS ASTEROLEPIS.—THE LAKE OF STENNIS 21
THE DEVELOPMENT HYPOTHESIS, AND ITS CONSEQUENCES 37
THE RECENT HISTORY OF THE ASTEROLEPIS.—ITS FAMILY 48
CEREBRAL DEVELOPMENT OF THE EARLIER VERTEBRATA.—
ITS APPARENT PRINCIPLE 62
THE ASTEROLEPIS.—ITS STRUCTURE, BULK, AND ASPECT 94
FISHES OF THE SILURIAN ROCKS, UPPER AND LOWER.—
THEIR RECENT HISTORY, ORDER, AND SIZE 130
HIGH STANDING OF THE PLACOIDS.—OBJECTIONS
CONSIDERED 147
THE PLACOID BRAIN.—EMBRYONIC CHARACTERISTICS NOT
NECESSARILY OF A LOW ORDER 160
THE PROGRESS OF DEGRADATION.—ITS HISTORY 181
EVIDENCE OF THE SILURIAN MOLLUSCS.—OF THE FOSSIL
FLORA.—ANCIENT TREE 205
SUPERPOSITION NOT PARENTAL RELATION.—THE
BEGINNINGS OF LIFE 230
LAMARCKIAN HYPOTHESIS OF THE ORIGIN OF PLANTS.—ITS
CONSEQUENCES 243
THE TWO FLORAS, MARINE AND TERRESTRIAL.—BEARING
OF THE EXPERIENCE ARGUMENT 262
THE DEVELOPMENT HYPOTHESIS IN ITS EMBRYONIC STATE.
—OLDER THAN ITS ALLEGED FOUNDATIONS 277
FINAL CAUSES—THEIR BEARING ON GEOLOGIC HISTORY—
CONCLUSION 303
LIST OF WOOD-CUTS
PAGE
1. Internal ridge of hyoid plate of Asterolepis 31
2. Shagreen of Raja clavata:—of Sphagodus 54
3. Scales of Acanthodes sulcatus:—shagreen of Scyllium
stellare 55
4. Scales of Cheiracanthus microlepidotus:—shagreen of
Spinax Acanthias 56
5. Section of shagreen of Scyllium stellare:—of scales of
Cheiracanthus microlepidotus 56
6. Scales of Osteolepis microlepidotus:—of an undescribed
species of Glyptolepis 57
7. Osseous points Of Placoid Cranium 65
8. Osseous centrum of Spinax Acanthias:—of Raja clavata 67
9. Portions of caudal fin of Cheiracanthus:—of Cheirolepis 69
10. Upper surface of cranium of Cod 72
11. Cranial buckler of Coccosteus 74
12. Cranial buckler of Osteolepis 75
13. Upper surface of head of Osteolepis 77
14. Under surface of head of Osteolepis 79
15. Head of Osteolepis, seen in profile 80
16. Cranial buckler of Diplopterus 81
17. Ditto 82
18. Palatal dart-head, and group of palatal teeth, of
Dipterus 83
19. Cranial buckler of Dipterus 85
20. Base of cranium of Dipterus 86
21. Under jaw of Dipterus 87
22. Longitudinal section of head of Dipterus 88
23. Section of vertebral centrum of Thornback 92
24. Dermal tubercles of Asterolepis 95
25. Scales of Asterolepis 96
26. Portion of carved surface of scale 96
27. Cranial buckler of Asterolepis 98
28. Inner surface of cranial buckler of Asterolepis 99
29. Plates of cranial buckler of Asterolepis 102
30. Portion of under jaw of Asterolepis 103
31. Inner side of portion of under jaw of Asterolepis 104
32. Portion of transverse section of reptile tooth of
Asterolepis 105
33. Section of jaw of Asterolepis 106
34. Maxillary bone? 108
35. Inner surface of operculum of Asterolepis 109
36. Hyoid plate 110
37. Nail-like bone of hyoid plate 111
38. Shoulder plate of Asterolepis 112
39. Dermal bones of Asterolepis 113
40. Internal bones of Asterolepis 114
41. Ditto 115
42. Ischium of Asterolepis 116
43. Joint of ray of Thornback:—of Asterolepis 117
44. Coprolites of Asterolepis 118
45. Hyoid plate of Thurso Asterolepis 124
46. Hyoid plate of Russian Asterolepis 127
47. Spine of Spinax Acanthias:—fragment of Onondago
spine 143
48. Tail of Spinax Acanthius:—of Ichthyosaurus tenuirostris 172
49. Port Jackson Shark (Cestracion Phillippi) 177
50. Tail of Osteolepis 195
51. Tail of Lepidosteus osseus 196
52. Tail of Perch 197
53. Altingia excelsa (Norfolk-Island Pine) 212
54. Fucoids of the Lower Old Red Sandstone 216
55. Two species of Old Red Fucoids 217
56. Fern (?) of the Lower Old Red Sandstone 219
57. Lignite of the Lower Old Red Sandstone 221
58. Internal structure of lignite of Lower Old Red Sandstone 223
STROMNESS AND ITS
ASTEROLEPIS.
THE LAKE OF STENNIS.
When engaged in prosecuting the self-imposed task of examining in
detail the various fossiliferous deposits of Scotland, in the hope of
ultimately acquainting myself with them all, I extended my
exploratory ramble, about two years ago, into the Mainland of
Orkney, and resided for some time in the vicinity of Stromness.
This busy seaport town forms that special centre, in this northern
archipelago, from which the structure of the entire group can be
most advantageously studied. The geology of the Orkneys, like that
of Caithness, owes its chief interest to the immense development
which it exhibits of one formation,—the Lower Old Red Sandstone,—
and to the extraordinary abundance of its vertebrate remains. It is
not too much to affirm, that in the comparatively small portion which
this cluster of islands contains of the third part of a system regarded
only a few years ago as the least fossiliferous in the geologic scale,
there are more fossil fish enclosed than in every other geologic
system in England, Scotland, and Wales, from the Coal Measures to
the Chalk inclusive. Orkney is emphatically, to the geologist, what a
juvenile Shetland poetess designates her country, in challenging for
it a standing independent of the “Land of Cakes,”—a “Land of Fish;”
and, were the trade once fairly opened up, could supply with
ichthyolites, by the ton and the ship-load, the museums of the
world. Its various deposits, with all their strange organisms, have
been uptilted from the bottom against a granitic axis, rather more
than six miles in length by about a mile in breadth, which forms the
great back-bone of the western district of Pomona; and on this
granitic axis—fast jammed in between a steep hill and the sea—
stands the town of Stromness. Situated thus at the bottom of the
upturned deposits of the island, it occupies exactly such a point of
observation as that which the curious eastern traveller would select,
in front of some huge pyramid or hieroglyphic-covered obelisk, as a
proper site for his tent. It presents, besides, not a few facilities for
studying with the geological phenomena, various interesting points
in physical science of a cognate character. Resting on its granitic
base, in front of the strangely sculptured pyramid of three broad
tiers,—red, black, and gray,—which the Old Red Sandstone of these
islands may be regarded as forming, it is but a short half mile from
the Great Conglomerate base of the formation, and scarcely a
quarter of a mile more from the older beds of its central flagstone
deposit; while an hour’s sail on the one hand opens to the explorer
the overlying arenaceous deposit of Hoy, and an hour’s walk on the
other introduces him to the Loch of Stennis, with its curiously mixed
flora and fauna. But of the Loch of Stennis and its productions more
anon.
The day was far spent when I reached Stromness: but as I had a
fine bright evening still before me, longer by some three or four
degrees of north latitude than the midsummer evenings of the south
of Scotland, I set out, hammer in hand, to examine the junction of
the granite and the Great Conglomerate, where it has been laid bare
by the sea along the low promontory which forms the western
boundary of the harbor. The granite here is a ternary of the usual
components, somewhat intermediate in grain and color between the
granites of Peterhead and Aberdeen; and the conglomerate consists
of materials almost exclusively derived from it,—evidence enough of
itself, that when this ancient mechanical deposit was in course of
forming, the granite—exactly such a compound then as it is now—
was one of the surface rocks of the locality, and much exposed to
disintegrating influences. This conglomerate base of the Lower Old
Red Sandstone of Scotland—which presents, over an area of many
thousand square miles, such an identity of character, that specimens
taken from the neighborhood of Lerwick, in Shetland, or of Gamrie,
in Banff, can scarce be distinguished from specimens detached from
the hills which rise over the Great Caledonian Valley, or from the
cliffs immediately in front of the village of Contin—seems to have
been formed in a vast oceanic basin of primary rock,—a Palæozoic
Hudson’s or Baffin’s Bay,—partially surrounded, mayhap, by primary
continents, swept by numerous streams, rapid and headlong, and
charged with the broken debris of the inhospitable regions which
they drained. The graptolite bearing grauwacke of Banffshire seems
to have been the only fossiliferous rock that occurred throughout the
entire extent of this ancient northern basin; and its few organisms
now serve to open the sole vista through which the geological
explorer to the north of the Grampians can catch a glimpse of an
earlier period of existence than that represented by the ichthyolites
of the Lower Old Red Sandstone.
Very many ages must have passed ere, amid waves and currents,
the water-worn debris which now forms the Great Conglomerate
could have accumulated over tracts of sea-bottom from ten to fifteen
thousand square miles in area, to its present depth of from one to
four hundred feet. At length, however, a thorough change took
place; but we can only doubtfully speculate regarding its nature or
cause. The bottom of the Palæozoic basin became greatly less
exposed. Some protecting circle of coast had been thrown up around
it; or, what is perhaps more probable, it had sunk to a profounder
depth, and the ancient shores and streams had receded, through the
depression, to much greater distances. And, in consequence, the
deposition of rough sand and rolled pebbles was followed by a
deposition of mud. Myriads of fish, of forms the most ancient and
obsolete, congregated on its banks or sheltered in its hollows;
generation succeeded generation, millions and tens of millions
perished mysteriously by sudden death; shoals after shoals were
annihilated; but the productive powers of nature were strong, and
the waste was kept up. But who among men shall reckon the years
or centuries during which these races existed, and this muddy ocean
of the remote past spread out to unknown and nameless shores
around them? As in those great cities of the desert that lie
uninhabited and waste, we can but conjecture their term of
existence from the vast extent of their cemeteries. We only know
that the dark, finely-grained schists in which they so abundantly
occur must have been of comparatively slow formation, and that yet
the thickness of the deposit more than equals the height of our
loftiest Scottish mountains. It would seem as if a period equal to
that in which all human history is comprised might be cut out of a
corner of the period represented by the Lower Old Red Sandstone,
and be scarce missed when away; for every year during which man
has lived upon earth, it is not improbable that the Pterichthys and its
contemporaries may have lived a century. Their last hour, however,
at length came. Over the dark-colored ichthyolitic schists so
immensely developed in Caithness and Orkney, there occurs a pale-
tinted, unfossiliferous sandstone, which in the island of Hoy rises
into hills of from fourteen to sixteen hundred feet in height; and
among the organisms of those newer formations of the Old Red
which overlie this deposit, not a species of ichthyolite identical with
the species entombed in the lower schists has yet been detected. In
the blank interval which the arenaceous deposit represents, tribes
and families perished and disappeared, leaving none of their race to
succeed them, that other tribes and families might be called into
being, and fall into their vacant places in the onward march of
creation.
Such, so far as the various hieroglyphics of the pile have yet
rendered their meanings to the geologist, is the strange story
recorded on the three-barred pyramid of Stromness. I traced the
formation upwards this evening along the edges of the upturned
strata, from where the Great Conglomerate leans against the
granite, till where it merges into the ichthyolitic flagstones; and then
pursued these from older and lower to newer and higher layers,
desirous of ascertaining at what distance over the base of the
system its more ancient organisms first appear, and what their
character and kind. And, embedded in a grayish-colored layer of
hard flag, somewhat less than a hundred yards over the granite, and
about a hundred and sixty feet over the upper stratum of the
conglomerate, I found what I sought,—a well-marked bone,—in all
probability the oldest vertebrate remain yet discovered in Orkney.
What, asks the reader, was the character of this ancient organism of
the Palæozoic basin?
As shown by its cancellated texture, palpable to the naked eye,
and still more unequivocally by the irregular complexity of fabric
which it exhibits under the microscope,—by its speck-like life-points
or canaliculi, that remind one of air-bubbles in ice,—its branching
channels, like minute veins, through which the blood must once
have flown,—and its general groundwork of irregular lines of
corpuscular fibre, that wind through the whole like currents in a river
studded with islands,—it was as truly osseous in its composition as
the solid bones of any of the reptiles of the Secondary, or the
quadrupeds of the Tertiary periods. And in form it closely resembled
a large roofing-nail. With this bone our more practised
palæontologists are but little acquainted, for no remains of the
animal to which it belonged have yet been discovered in Britain to
the south of the Grampians,[3] nor, except in the Old Red Sandstone
of Russia, has it been detected any where on the Continent. Nor am
I aware that, save in the accompanying wood-cut, (fig. 1,) it has
ever been figured. The amateur geologists of Caithness and Orkney
have, however, learned to recognize it as the “petrified nail.” The
length of the entire specimen in this instance was five seven eighth
inches, the transverse breadth of the head two inches and a quarter,
and the thickness of the stem nearly three tenth parts of an inch.
This nail-like bone formed a characteristic portion of the Asterolepis,
—so far as is yet known, the most gigantic ganoid of the Old Red
Sandstone, and, judging from the place of this fragment, apparently
one of the first.
There were various considerations which led me to regard the
“petrified nail” in this case as one of the most interesting fossils I
had ever seen; and, before quitting Orkney, to pursue my
explorations farther to the south, I brought two intelligent geologists
of the district,[5] to mark its place and character, that they might be
able to point it out to geological visitors in the future, or, if they
preferred removing it to their town museum, to
indicate to them the stratum in which it had lain.
It showed me, among other things, how unsafe it
is for the geologist to base positive conclusions
on merely negative data. Founding on the fact
that, of many hundred ichthyolites of the Lower
Old Red Sandstone which I had disinterred and
examined, all were of comparatively small size,
while in the Upper Old Red many of the
ichthyolites are of great mass and bulk, I had
inferred that vertebrate life had been restricted to
minuter forms at the commencement than at the
Fig. 1.
close of the system. It had begun, I had ventured
INTERNAL RIDGE to state in the earlier editions of a little work on
OF HYOID PLATE the “Old Red Sandstone,” with an age of dwarfs,
OF ASTEROLEPSIS. and had ended with an age of giants. And now,
[4]
here, at the very base of the system,
(One third the
unaccompanied by aught to establish the
natural size, linear.) contemporary existence of its dwarfs,—which
appear, however, in an overlying bed about a
hundred feet higher up,—was there unequivocal
proof of the existence of one of the most colossal of its giants. But
not unfrequently, in the geologic field, has the practice of basing
positive conclusions on merely negative grounds led to a misreading
of the record. From evidence of a kind exactly similar to that on
which I had built, it was inferred, some two or three years ago, that
there had lived no reptiles during the period of the Coal Measures,
and no fish in the times of the Lower Silurian System.
I extended my researches, a few days after, in an easterly
direction from the town of Stromness, and walked for several miles
along the shores of the Loch of Stennis,—a large lake about fourteen
miles in circumference, bare and treeless, like all the other lakes and
lochs of Orkney, but picturesque of outline, and divided into an
upper and lower sheet of water by two low, long promontories, that
jut out from opposite sides, and so nearly meet in the middle as to
be connected by a thread-like line of road, half mound, half bridge.
“The Loch of Stennis,” says Mr. David Vedder, the sailor-poet of
Orkney, “is a beautiful Mediterranean in miniature.” It gives
admission to the sea by a narrow strait, crossed, like that which
separates the two promontories in the middle, by a long rustic
bridge; and, in consequence of this peculiarity, the lower division of
the lake is salt in its nether reaches and brackish in its upper ones,
while the higher division is merely brackish in its nether reaches, and
fresh enough in its upper ones to be potable. Viewed from the east,
in one of the long, clear, sunshiny evenings of the Orkney summer, it
seems not unworthy the eulogium of Vedder. There are moory hills
and a few rude cottages in front; and in the background, some eight
or ten miles away, the bold, steep mountain masses of Hoy; while on
the promontories of the lake, in the middle distance, conspicuous in
the landscape, from the relief furnished by the blue ground of the
surrounding waters, stand the tall gray obelisks of Stennis—one
group on the northern promontory, the other on the south,—
The shores of both the upper and lower divisions of the lake were
strewed, at the time I passed, by a line of wrack, consisting, for the
first few miles from where the lower loch opens to the sea, of only
marine plants, then of marine plants mixed with those of fresh-water
growth, and then, in the upper sheet of water, of lacustrine plants
exclusively. And the fauna of the loch is, I was informed, of as mixed
a character as its flora,—the marine and fresh-water animals having
each their own reaches, with certain debatable tracts between, in
which each kind expatiates with more or less freedom, according to
its specific nature and constitution,—some of the sea-fish advancing
far on the fresh water, and others, among the proper denizens of the
lake, encroaching far on the salt. The common fresh-water eel
strikes out, I was told, farthest into the sea-water; in which, indeed,
reversing the habits of the salmon, it is known in various places to
deposit its spawn. It seeks, too, impatient of a low temperature, to
escape from the cold of winter, by taking refuge in water brackish
enough, in a climate such as ours, to resist the influence of frost. Of
the marine fish, on the other hand, I found that the flounder got
greatly higher than any of the others, inhabiting reaches of the lake
almost entirely fresh. I have had an opportunity elsewhere of
observing a curious change which fresh water induces in this fish. In
the brackish water of an estuary, the animal becomes, without
diminishing in general size, thicker and more fleshy than when in its
legitimate habitat, the sea: but the flesh loses in quality what it
gains in quantity;—it grows flabby and insipid, and the margin-fin
lacks always its strip of transparent fat. But the change induced in
the two floras of the lake—marine and lacustrine—is considerably
more palpable and obvious than that induced in its two faunas. As I
passed along the strait, through which it gives admission to the sea,
I found the commoner fucoids of our sea-coasts streaming in great
luxuriance in the tideway, from the stones and rocks of the bottom. I
marked, among the others, the two species of kelp-weed, so well
known to our Scotch kelp-burners,—Fucus nodosus and Fucus
vesiculosus,—flourishing in their uncurtailed proportions; and the not
inelegant Halidrys siliquosa, or “tree in the sea,” presenting its
amplest spread of pod and frond. A little farther in, Halidrys and
Fucus nodosus disappear, and Fucus vesiculosus becomes greatly
stunted, and no longer exhibits its characteristic double rows of
bladders. But for mile after mile it continues to exist, blent with
some of the hardier confervæ, until at length it becomes as dwarfish
and nearly as slim of frond as the confervæ themselves; and it is
only by tracing it through the intermediate forms that we succeed in
convincing ourselves that, in the brown stunted tufts of from one to
three inches in length, which continue to fringe the middle reaches
of the lake, we have in reality the well-known Fucus before us.
Rushes, flags, and aquatic grasses may now be seen standing in
diminutive tufts out of the water; and a terrestrial vegetation at least
continues to exist, though it can scarce be said to thrive, on banks
covered by the tide at full. The lacustrine flora increases, both in
extent and luxuriance, as that of the sea diminishes; and in the
upper reaches we fail to detect all trace of marine plants: the algæ,
so luxuriant of growth along the straits of this “miniature
Mediterranean,” altogether cease; and a semi-aquatic vegetation
attains, in turn, to the state of fullest development any where
permitted by the temperature of this northern locality. A memoir
descriptive of the Loch of Stennis, and its productions, animal and
vegetable, such as old Gilbert White of Selborne could have
produced, would be at once a very valuable and curious document,
important to the naturalist, and not without its use to the geological
student.
I know not how it may be with others; but the special phenomena
connected with Orkney that most decidedly bore fruit in my mind,
and to which my thoughts have most frequently reverted, were
those exhibited in the neighborhood of Stromness. I would more
particularly refer to the characteristic fragment of Asterolepis, which
I detected in its lower flagstones, and to the curiously mixed, semi-
marine, semi-lacustrine vegetation of the Loch of Stennis. Both seem
to bear very directly on that development hypothesis,—fast
spreading among an active and ingenious order of minds, both in
Britain and America, and which has been long known on the
Continent,—that would fain transfer the work of creation from the
department of miracle to the province of natural law, and would
strike down, in the process of removal, all the old landmarks, ethical
and religious.
THE DEVELOPMENT HYPOTHESIS,
AND ITS CONSEQUENCES.
Every individual, whatever its species or order, begins and
increases until it attains to its state of fullest development, under
certain fixed laws, and in consequence of their operation. The
microscopic monad develops into a fœtus, the fœtus into a child, the
child into a man; and, however marvellous the process, in none of
its stages is there the slightest mixture of miracle; from beginning to
end, all is progressive development, according to a determinate
order of things. Has Nature, during the vast geologic periods, been
pregnant, in like manner, with the human race? and is the species,
like the individual, an effect of progressive development, induced
and regulated by law? The assertors of the revived hypothesis of
Maillet and Lamarck reply in the affirmative. Nor, be it remarked, is
there positive atheism involved in the belief. God might as certainly
have originated the species by a law of development, as he
maintains it by a law of development; the existence of a First Great
Cause is as perfectly compatible with the one scheme as with the
other; and it may be necessary thus broadly to state the fact, not
only in justice to the Lamarckians, but also fairly to warn their non-
geological opponents, that in this contest the old anti-atheistic
arguments, whether founded on the evidence of design, or on the
preliminary doctrine of final causes, cannot be brought to bear.
There are, however, beliefs, in no degree less important to the
moralist or the Christian than even that in the being of a God, which
seem wholly incompatible with the development hypothesis. It,
during a period so vast as to be scarce expressible by figures, the
creatures now human have been rising, by almost infinitesimals,
from compound microscopic cells,—minute vital globules within
globules, begot by electricity on dead gelatinous matter,—until they