100% found this document useful (3 votes)
33 views

Complete Download Concise Guide to Object Oriented Programming An Accessible Approach Using Java Undergraduate Topics in Computer Science 1st Edition Kingsley Sage PDF All Chapters

Using

Uploaded by

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

Complete Download Concise Guide to Object Oriented Programming An Accessible Approach Using Java Undergraduate Topics in Computer Science 1st Edition Kingsley Sage PDF All Chapters

Using

Uploaded by

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

Download Full Version ebook - Visit ebookmeta.

com

Concise Guide to Object Oriented Programming An


Accessible Approach Using Java Undergraduate
Topics in Computer Science 1st Edition Kingsley
Sage
https://ebookmeta.com/product/concise-guide-to-object-
oriented-programming-an-accessible-approach-using-java-
undergraduate-topics-in-computer-science-1st-edition-
kingsley-sage/

OR CLICK HERE

DOWLOAD NOW

Discover More Ebook - Explore Now at ebookmeta.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

Algebraic Graph Algorithms A Practical Guide Using Python


Undergraduate Topics in Computer Science K. Erciyes

https://ebookmeta.com/product/algebraic-graph-algorithms-a-practical-
guide-using-python-undergraduate-topics-in-computer-science-k-erciyes/

ebookmeta.com

Discrete Mathematics and Graph Theory: A Concise Study


Companion and Guide (Undergraduate Topics in Computer
Science) K. Erciyes
https://ebookmeta.com/product/discrete-mathematics-and-graph-theory-a-
concise-study-companion-and-guide-undergraduate-topics-in-computer-
science-k-erciyes/
ebookmeta.com

Ethical and Secure Computing A Concise Module


Undergraduate Topics in Computer Science Joseph Migga
Kizza
https://ebookmeta.com/product/ethical-and-secure-computing-a-concise-
module-undergraduate-topics-in-computer-science-joseph-migga-kizza/

ebookmeta.com

The Fantastic Tex Mex Cookbook 1st Edition Sophia Freeman

https://ebookmeta.com/product/the-fantastic-tex-mex-cookbook-1st-
edition-sophia-freeman/

ebookmeta.com
Immoral Indecent and Scurrilous The Making of an
Unrepentant Sex Radical 1st Edition Gerald Hannon

https://ebookmeta.com/product/immoral-indecent-and-scurrilous-the-
making-of-an-unrepentant-sex-radical-1st-edition-gerald-hannon/

ebookmeta.com

Illiberal Constitutionalism in Poland and Hungary: The


Deterioration of Democracy, Misuse of Human Rights and
Abuse of the Rule of Law 1st Edition Timea Drinoczi
(Editor)
https://ebookmeta.com/product/illiberal-constitutionalism-in-poland-
and-hungary-the-deterioration-of-democracy-misuse-of-human-rights-and-
abuse-of-the-rule-of-law-1st-edition-timea-drinoczi-editor/
ebookmeta.com

Guide to Venomous and Medically Important Invertebrates


1st Edition Bowles

https://ebookmeta.com/product/guide-to-venomous-and-medically-
important-invertebrates-1st-edition-bowles/

ebookmeta.com

Robotic Process Automation (RPA) in the Financial Sector


Mario Smeets

https://ebookmeta.com/product/robotic-process-automation-rpa-in-the-
financial-sector-mario-smeets/

ebookmeta.com

Love Detour 1st Edition Allie Mcdermid

https://ebookmeta.com/product/love-detour-1st-edition-allie-mcdermid/

ebookmeta.com
CPT 2022 Professional Edition American Medical Association

https://ebookmeta.com/product/cpt-2022-professional-edition-american-
medical-association/

ebookmeta.com
Undergraduate Topics in Computer
Science

Series Editor
Ian Mackie
University of Sussex, Brighton, UK

Advisory Editors
Samson Abramsky
Department of Computer Science, University of Oxford, Oxford, UK

Chris Hankin
Department of Computing, Imperial College London, London, UK

Dexter C. Kozen
Computer Science Department, Cornell University, Ithaca, NY, USA

Andrew Pitts
William Gates Building, University of Cambridge, Cambridge, UK

Hanne Riis Nielson


Department of Applied Math and Computer Science, Technical University
of Denmark, Kgs. Lyngby, Denmark

Steven S. Skiena
Department of Computer Science, Stony Brook University, Stony Brook,
NY, USA

Iain Stewart
Department of Computer Science, Science Labs, University of Durham,
Durham, UK
Mike Hinchey
Lero, Tierney Building, University of Limerick, Limerick, Ireland

‘Undergraduate Topics in Computer Science’ (UTiCS) delivers high-


quality instructional content for undergraduates studying in all areas of
computing and information science. From core foundational and
theoretical material to final-year topics and applications, UTiCS books
take a fresh, concise, and modern approach and are ideal for self-study
or for a one- or two-semester course. The texts are all authored by
established experts in their fields, reviewed by an international
advisory board, and contain numerous examples and problems, many
of which include fully worked solutions.
The UTiCS concept relies on high-quality, concise books in softback
format, and generally a maximum of 275-300 pages. For undergraduate
textbooks that are likely to be longer, more expository, Springer
continues to offer the highly regarded Texts in Computer Science series,
to which we refer potential authors.
More information about this series at http://​www.​springer.​com/​
series/​7592
Kingsley Sage

Concise Guide to Object-Oriented


Programming
An Accessible Approach Using Java
Kingsley Sage
School of Engineering and Informatics, University of Sussex, Falmer,
East Sussex, UK

ISSN 1863-7310 e-ISSN 2197-1781


Undergraduate Topics in Computer Science
ISBN 978-3-030-13303-0 e-ISBN 978-3-030-13304-7
https://doi.org/10.1007/978-3-030-13304-7

Library of Congress Control Number: 2019931822

© Springer Nature Switzerland AG 2019

This work is subject to copyright. All rights are reserved by the


Publisher, whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other
physical way, and transmission or information storage and retrieval,
electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.

The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.

This Springer imprint is published by the registered company Springer


Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham,
Switzerland
Preface
The twenty-first century continues to experience the relentless
expansion of the IT revolution into our daily lives. We consume
services, do our shopping on-line, listen to music streams and watch
movies on demand. The impact of social media has had a profound
impact on our society and has changed fundamentally the way we
obtain and consume news, information and ideas. There is little sign of
a slowdown in this dramatic shift in our relationship with technology.
Vast research budgets are being applied to the development of
autonomous vehicles, and in applying Artificial Intelligence to change
the way we live. But it has also changed the demand for skills within
our workforce. The demand for manual skills is in decline, and the
demand for IT and programming skills is rising at an unprecedented
rate.
In comparison to the industrialists of the nineteenth and twentieth
centuries, the twenty-first-century entrepreneurs are experts in IT,
programming, software design and development, and developing
practical applications using concepts such as Artificial Intelligence for
our daily lives. With this profound paradigm shift has come a need for
the workforce of many industrialised nations to evolve. Governments
recognise the need for a huge increase in the workforce with
programming skills. In the United Kingdom, and in many other
industrialised nations, core coding skills are now a part of the
secondary school curriculum. Learning to program is no longer
considered to be just a part of the traditional journey of the Computer
Science undergraduate, but a broader skill that underpins an IT literate
workforce for the modern age.

What is the Purpose of This Book?


When I was first approached to write this book, it was suggested that
its purpose was to provide an accessible introduction to coding and the
world of Object Oriented Programming (OOP). Standard texts on the
subject often fall between those that provide only a very lightweight
treatment of the subject (“a little knowledge can be a frustrating
thing”), and those that run to 500 pages or more that are rather better
suited as reference texts or as support on a lengthy period of study in
depth. The challenge for this book is to provide an accessible
introduction to the world of coding and OOP in a way that is helpful to
the first-time coder and allows them to develop and to understand their
knowledge and skills in a way that is relevant and practical. The
examples developed for this book are intended to show how OOP skills
can be used to create applications and programs that have everyday
value, rather than examples that have been synthesised solely to
demonstrate an academic point.
The reader should be able to use this book to develop a solid
appreciation of OOP and how to code. The programming language used
throughout is Java. Java has been chosen as it can be used across all
computing platforms, because it has a commercial skill that has a clear
on-going value derived from its adoption as a core language for
smartphone applications on the Android platform, and as the language
at the heart of the Java EE 8 Jakarta Enterprise scale framework. The
book focusses on the core Java language and does not consider
smartphone or EE 8 coding, as these require skills over and above what
this book is about. However, a knowledge of core Java coding and some
of the related issues also discussed in this book would form an
appropriate pre-requisite for the further study of these topics.
Although this book uses Java as its illustrative programming
language, many of the ideas may be translated directly into other OO
languages such as C++, C# and others. Throughout this book,
programming in Java is demonstrated using the BlueJ Integrated
Development Environment (IDE). BlueJ is a well-established IDE for
learning BlueJ and is widely used in schools and Universities. Eclipse is
the closest product to an industry standard for the development of Java,
but it is often found too complex for the task of teaching and learning.
Who is This Book Aimed at?
As someone with over 20 years of teaching experience from level 3
through to postgraduate, from traditional University teaching to adult
education, I have never been able to identify satisfactorily what defines
the ability of an individual to learn to program. Suffice to say, all that is
really needed is an interest in the subject and time. The aim of this book
is to provide an accessible entry into the world of Object Oriented
Programming (OOP).
The book does not assume any prior knowledge of coding, or any
prior knowledge of software engineering or OO, not does it require any
prior exposure to mathematics. Whilst such prior knowledge is not
unhelpful, it is not essential to learn to program. Instead, this book
takes a more everyday experience to the subject, drawing on examples
from everyday experience to explain what OO is and why it is relevant
in the modern programming experience. As such, the book is aimed at
those who are coming to OO programming for the first time. It is
therefore likely to be useful as a one-semester book introducing the
topic to those new to the study of computer science at the
undergraduate and postgraduate levels, and those who are just learning
for the purpose of self-improvement or professional development.
Whilst the book is aimed at those with no prior coding experience, it
does explore broader topics surrounding coding. This with some prior
knowledge may opt to skip some of the early chapters. That does not
impact the usefulness of this book in terms of learning to code in Java.

What’s in the Book?


Chapter 1 starts with an overview of what programming and coding is
all about. It includes some useful historical perspective on the
development of programming languages and the core ideas that
underpin all programming languages. It introduces the idea of a
computing machine and concepts such as a compiler. This section is
helpful to those who have no prior experience of computing as it helps
subsequent understanding of some of the core coding processes and
terminology. The chapter then continues to discuss how the need for
OOP arose in the period from the end of the 1970s to the present day,
and a discussion of why it is considered important to help us solve
modern-day programming problems.
Chapter 2 provides a short introduction to programming in Java
using BlueJ. It is intended to provide just enough knowledge and skills
to create and execute a single-class Java program under BlueJ. This is
significant as it then facilitates discussion of the core principles of
procedural and structured programming, such as loops and conditional
statements. Those with prior experience of coding using languages
such as C and Python may opt to skip this chapter, as they would
undoubtedly be familiar with much of the content. I chose to organise
the book this way as the basic procedural and structured coding
constructions are common to almost all programming (or at least those
that owe their syntactic ancestry to C), and getting these constructions
understood at this stage allows for a more specific focus later on the
principles of OO.
Chapter 3 gets into the details of what OO really is and how it can be
applied to solve modern programming challenges. We start with a
discussion of what classes and objects are, and how the construction
and execution of an OO program parallels the way that human
organisations such as a large office operate. Such analogies are
invaluable in appreciating the true benefits of the OO paradigm. In this
chapter, we develop a set of small multi-class Java applications and
consider the cornerstone issues in OO design of class cohesion and
coupling.
Chapter 4 considers a range of Java library objects and packages
such as the String and the ArrayList , and introduces the idea of
the Application Programming Interface (API). This enables the reader
to start building more complex applications involving simple linear
collections of objects. These ideas are developed using a set of simple
programs that can be enhanced in many different ways as an exercise
for the reader.
Chapter 5 delves further into the OO paradigm and considers how
OO design forms an essential part of producing a useful solution to a
problem. The chapter introduces the idea of class polymorphism (super
and sub-classes) and how this can be used to create a program with a
structure that more closely mirrors an underlying domain. The chapter
also looks further into the idea of selecting classes that are suited to
solving specific problem and so also has elements of software
engineering principles and practice.
Chapter 6 considers what to do when code encounters an error
condition. Software systems are not immune to errors either at the
coding or at the run time phases, and modern software systems need to
be built in a robust manner so that they behave in a predictable manner
when something goes wrong. The exception handling mechanism is
introduced, along with steps on laying out a program to assist in
debugging it. This chapter also considers practical measures that are
adopted in defensive coding.
Chapter 7 digs deeper into the work of arrays and collections,
notably fixed length arrays, the HashMap and HashSet , and shows
how different collection types can be used to effectively model different
real-world collections of data. This chapter also includes some
background on the underlying ideas for these collection types, such as
the hash table.
Chapter 8 provides an introduction to building a Graphical User
Interface (GUI) using Swing. Although some may consider Swing a
relatively old library for the development of a GUI, the key ideas are
relevant across a range of other libraries such as JavaFX, and Swing
forms more of a core element of the Java landscape. The development of
GUIs is a large topic in its own right, so this chapter can only ever serve
as an introduction. In this chapter, we also consider the concept of a
design pattern, specifically the idea of Model View Controller (MVC)
architecture, and how a Java application can be constructed in a well-
recognisable design configuration.
In the final Chap. 9 , two complete applications are presented, from
conceptual design to implementation to help cement the ideas
presented in the previous chapters. One is a text-based application with
no Graphical User Interface (GUI). The other is a small GUI-based
application to give a sense of how to build a GUI on top of an underlying
application.
All the code examples used in this book and the two example
projects described in Chap. 9 are available as on-line resource
accompanying this book.
It is my hope that this book will inspire the reader to learn more
about the world of OO and coding. As such, it represents the start of a
learning journey. As with all endeavours, clarity will improve with time
and effort. Few will write an award-winning book at their first attempt.
Few artists will paint their defining masterpiece at the outset of their
career. Programming is no exception and your skills will improve with
effort, time, reflection and experience. But every learning journey has
to start somewhere. For many, the story starts with the codebreakers of
Bletchley Park in the United Kingdom during WWII, but we shall start
our story in early nineteenth-century France …
Kingsley Sage
Falmer, UK
January 2019
Contents
1 The Origins of Programming
1.​1 The Stored Digital Program is not a New Idea
1.​2 The Birth of the Computing Age
1.​3 The Origin of Programming Languages
1.​4 The Object Oriented Revolution
1.​5 The Java Language
1.​6 Tools of the Trade
2 Procedural Programming Basics in Java
2.​1 First Program and Workflow
2.​2 Primitive Data Types
2.​3 The Procedural Programming Paradigm
2.​4 Sequence
2.​5 Alternation
2.​6 Repetition
2.​7 More on Methods
2.​8 Bringing It All Together
3 Getting into Object Oriented Programming
3.​1 Object Oriented in a Social Context
3.​2 Introducing the OO Class
3.​3 The Anatomy of a Class
3.​4 Creating Objects at Run Time
3.​5 Accessor and Mutator Methods
3.​6 Choosing the Right Classes
4 Library Classes and Packages
4.​1 Organisation of Java into the Core and Packages
4.​2 Using Library Classes
4.3 The String Class
4.​4 Application Programming Interfaces (APIs)
4.​5 Using Javadocs in BlueJ
4.6 The ArrayList Class
4.​7 The Wrapper Classes
5 Modelling the World the Object Oriented Way
5.​1 Hierarchies in the Real World
5.​2 Introducing Super and Sub-classes
5.​3 Adding Constructors
5.​4 Rules of Inheritance and Over-Riding
5.​5 Method Polymorphism
5.​6 Static and Dynamic Type
5.​7 Abstract Classes
5.​8 Interfaces
5.​9 Class Variables and Static Methods
6 Dealing with Errors
6.​1 The Nature of Errors
6.​2 Coding Defensively
6.​3 Using the Debugger Tool
6.​4 Unit Testing
6.​5 System Testing
6.​6 The Basics of Exception Handling
6.​7 More Advanced Exception Handling
7 Deeper into Arrays and Collections
7.​1 Fixed Length Versus Dynamic Length Arrays
7.​2 Fixed Length Arrays of Primitive Types
7.​3 Fixed Length Arrays of Objects
7.​4 Multi-dimensional Arrays
7.​5 Sorting Data
7.​6 Hash Functions
7.7 The HashMap Class
7.8 The HashSet Class
7.​9 Iterating Through Collections
8 Adding a Graphical User Interface
8.​1 The Model View Controller MVC Design Pattern
8.​2 Introducing Swing and AWT
8.​3 The Taxonomy of a GUI
8.​4 A Simple First Swing Application
8.​5 Event Handling
8.​6 Centralised and Distributed Event Management
8.​7 Applying the MVC Design Pattern
8.​8 Adding Menus, Text Fields, Text Areas and Images
8.​9 Layout Managers
9 Example Applications
9.​1 Software Engineering Process Models
9.​2 The Good Life Foods Project
9.​3 The Guessing Game Project
9.​4 Final Thoughts
Index
About the Author
Dr. Kingsley Sage is a Senior Teaching Fellow in Computing Sciences
in the Department of Informatics at the University of Sussex, Brighton,
UK, and a Senior Fellow of the Higher Education Academy (SFHEA). He
has more than 20 years of teaching experience, from the level of
further/continuing education through to postgraduate-level teaching,
in both traditional university teaching and adult education.
© Springer Nature Switzerland AG 2019
Kingsley Sage, Concise Guide to Object-Oriented Programming, Undergraduate Topics
in Computer Science
https://doi.org/10.1007/978-3-030-13304-7_1

1. The Origins of Programming


Kingsley Sage1

(1) School of Engineering and Informatics, University of Sussex,


Falmer, East Sussex, UK

Kingsley Sage
Email: [email protected]

In this first chapter we explore what a programming language is, and


something of the history of their development leading up to the Java
language. This will help us understand some of the most basic
terminology used in the process of creating programs. The history of
programming, and computing in general, does not have a universally
agreed timeline and shared sense of significance of contributions.
Nonetheless, computer science has progressed and innovated to bring
us a world that we may scarcely consider without its plurality of
systems with software, data and programs at their core.

1.1 The Stored Digital Program is not a New Idea


Whereas the digital electronic computer is a 20th century concept, the
idea of digital control goes back much further. Digital control simply
refers to the idea of a system controlled by a sequence of instructions
that are either 1 or 0, “on” or “off”. One of earliest notable examples of
such a system that used stored digital instructions was the Jacquard
weaving loom . In the early 1800s, Joseph-Marie Jacquard (1752–1834)
developed an automated weaving loom using a series of punched paper
cards to control the head of the loom to raise and lower different
threads to permit a wide range of fabric designs to be mass produced.
Any design could be expressed by the set of punched cards that were
fed to the machine.

Sources https://​commons.​wikimedia.​org/​wiki/​File:​Book_​Illustration,_​
Jacquard_​Weaving_​and_​Designing,_​Falcon_​Loom_​of_​1728,_​Figure_​12,_​
1895_​(CH_​68766143).​jpg (public domain) https://​commons.​
wikimedia.​org/​wiki/​File:​Jacquard.​loom.​cards.​jpg (public domain)
Jacquard’s ideas were a step innovation of previous work by Jacques
de Vaucanson (1709–1782) and others, but Jacquard is usually credited
with creating a commercial scale automated weaving loom that made
use of stored digital data. This idea proved inspirational for others in
the development of computer science. For example, Charles Babbage
used punched cards as a means of input and output for his designs for
the analytical engine—an early calculating device. As all data, whether
numeric, text, image or audio, can be formulated into an equivalent
binary representation, such cards provided a convenient means of
storing data. For example, the number 19 in denary (base 10) can be
converted into binary (base 2).

16 8 4 2 1
1 0 0 1 1
Here 19 = 1 + 2 + 16. Individual letters can be assigned to numeric
values (i.e. the ASCII code set) and thus text can be converted into a
sequence of numbers, and thus binary data. Continuous data can be
“sampled” at regular intervals and those samples can be converted to
numbers and subsequently to binary data.

1.2 The Birth of the Computing Age


Pioneers such as Charles Babbage (1791–1871) strove to create
mechanical calculating devices such as the Difference Engine (1830s)
and the rather more general purpose Analytical Engine (unfinished in
Babbage’s lifetime). The latter is recognisable by design in many
respects as a computer, as it featured a set of instructions stored on
punched cards, a memory that could remember results, and elements of
sequential control. However, Babbage was ahead of his time in that the
engineering challenges posed in building his mechanical machines
were substantial. But many of his ideas laid dormant until new forms of
technology emerged from the new sciences of electricity and
electronics.
In 1936, the British mathematician Alan Turing (1912–1954)
published his seminal paper “On Computable Numbers”. In it, he
describes an abstract computing apparatus called a “Turing machine
”—a type of universal machine that Turing was able to demonstrate,
using mathematics, could compute all computable things.
Source https://​en.​wikipedia.​org/​wiki/​Alan_​Turing (public domain)
The machine consisted of a paper tape of infinite length that
enabled read and write operations to be performed. Depending on the
symbol observed on the tape, the tape can be made to move forwards
and backwards. Turing is actually describing the underlying
requirements of a modern computer and a programming language—a
feat given that in 1936 the technologies needed to realise such devices
barely existed.
Turing and others would later realise electronic implementations of
Turing machines using electronic valve and later transistor technology,
allowing the realisation of general purpose “electronic digital
computers”. Turing is also widely credited for popularising the term
“Artificial Intelligence ” as he believed that one day such digital
computers would rival humans for computing and analytical ability.
The onset of World War 2 brought opportunities for Turing and
others in the form of the Allied effort to decipher Nazi Germany’s
secretive Enigma codes, particularly in respect of minimising shipping
losses to U-boats on the North Atlantic supply route (the “Battle of the
Atlantic”). U-boat command used Enigma machines, a type of modified
electronic typewriter, to convert plain text messages to cipher text that
was then broadcast by radio to the U-boats. Recovering the original
plain text required another Enigma machine with identical settings to
the original. The design was such that there were billions of
combinations of settings and it was statistically unlikely they could be
discovered by chance. A group of scientists, including Turing, worked at
the Bletchley Park site in England to build a range of machines, such as
Turing’s Bombe and later the Colossus device, that could sift through
millions of settings in just a few hours to find the correct one.

Source https://​en.​wikipedia.​org/​wiki/​File:​Wartime_​picture_​of_​a_​
Bletchley_​Park_​Bombe.​jpg (public domain) https://​en.​wikipedia.​org/​
wiki/​Colossus_​computer (public domain)
This was the start of the era of cryptoanalysis. Colossus is regarded
by many as the world’s first semi programmable electronic computer,
and a faithful recreation of the machine can be viewed today at the UK’s
National Machine of Computing at Bletchley Park.
The post-war years were less kind on Turing, with events leading to
his suicide in 1954. But the development of electronic computers
continued apace in the UK and the US, with the development of
machines such as the Manchester Mk 1 (UK, 1949) and ENIAC (US,
1945). 1952 heralded the arrival of the Ferranti Mk 1 , the world’s first
commercially available general-purpose computer.

1.3 The Origin of Programming Languages


By the 1950s, computer hardware was a reality. But as with all
technologies, the question arose of what it should be used for. ENIAC
was initially developed to produce artillery firing tables for the US army
—a repetitive and time-consuming task suited to a machine. The
Manchester Mark 1 was used for tasks including searching for prime
numbers and investigating the Riemann hypothesis.
The issue was the relatively low amounts of computing power
combined with the fact that there was only a small group of experts
who truly understood how to program the machines. Initially machines
were programmed using binary and very near binary “assembly
languages” supported by mnemonic aids. Creating programs at such a
low level required a great deal of time and intellect.
The idea of a higher-level view of a computing problem is widely
credited to Ada Lovelace (1815–1852), who collaborated with Charles
Babbage and wrote notes on the design of algorithms for Babbage’s
machines. Whilst not programs, these algorithms represented a higher-
level way of thinking about what a computing device could do.
The key development was to provide a means for programs to be
written in a higher level, more human centric manner, that could then
be translated into the lower level binary instructions that a computer
could process. The earliest programming languages included “Short
Code ” (John Mauchly 1950) and “Autocode ” (Alick Glennie and Ralph
Brooker 1954). These languages allowed a source code file to be
created with the high-level instructions, that were then “compiled ” or
“interpreted ” into the lower level instructions that the computer could
execute:

Compiled languages made the translation one-time and then stored


the resulting machine code for execution many times over. Interpreted
languages made the translation “on the fly” for immediate use. This
distinction is still very much in evidence today, with languages such as
C and Java belonging to the compiled group, and scripting languages
such as JavaScript and PHP belonging to the interpreted group. The
interpreted group has become particularly significant in the world of
web computing.
1954 saw the development of FORTRAN by a team lead by John
Backus at IBM. This was a very significant innovation as FORTRAN was
the first widely adopted general purpose programming language and it
still exists today, although it has long since fallen from wide use. Other
notable languages include COBOL (for business related programming
tasks) (Grace Hopper, 1959) and LISP (for symbolic computing)
(Russell, Hart and Levin, 1958). Nearly all these early languages are
now a matter of historical note, but 1972 brought a significant
milestone with the arrival of C (Bell Labs, Dennis Ritchie). C was
significant as it brought a consistent syntax, provided a range of high
and low level instructions and operations, was designed to encourage
cross platform support, was (and still is) the subject of international
standardisation. C was used to write the UNIX 4 operating system (still
very much in use today). C is also significant in that many
contemporary programming languages (including Java) owe their
syntactic history to it. C has also seen a reboot in the form of the object
oriented C++. Now a wide range of people could write programs using
high-level abstraction rather than needing to understand the detailed
internal operation of the host computer.

1.4 The Object Oriented Revolution


As computers became cheaper, more widespread and powerful, the
range of applications that they were put to increased. In the 1950s,
computers were mainly used for mathematical and scientific tasks, by
the 1970s they were in wide use in business data management, and
with the explosion of personal computing in the 1980s, they reached
out into every aspect of modern lives. That expansion of ambition for
creating ever new and more innovative program applications came
with its own challenges—the size and complexity of codebases was
increasing:

Typical codebase size


1950s 10s of lines
1960s 100s of lines
1970s 1000s of lines
1980s 100,000s of code
Now In some cases > 10,000,000 lines (e.g. Linux)
The challenge here is not technological, it’s human. By the 1970s, a
significant number of software development projects were failing (i.e.
required substantial or complete write-down of their costs due to
failure to deliver a working product) as they were becoming too
complex for teams to develop and manage using the programming
languages and techniques available. This period saw the birth of
software engineering as an academic discipline to try to counter this.
The problem lay in the fact that they kind of data employed by
programming languages was based in mathematical and fundamental
terms like characters, integers and pointers. These are not the atomic
elements that were needed to build something like a graphic computer
game, or a word processor. Humans don’t think of most problem
domains in atomic terms. We think of them in terms of entities like
“Player”, “Paragraph” and a “Spell checker” and so on.
So there was a basic mismatch between the programming concepts
on offer and the problem domains that developers wanted to address.
Furthermore, a program written for one computer would not
necessarily execute on another. By the 1980s there was a proliferation
of competing brands of computer, with little or no interoperability
between them.
In 1967, the Simula language (Dahl, Nygaard) was the first Object
Oriented (OO) language. In 1980, Smalltalk-80 (Kay, Ingalls and
Goldberg) was released, drawing heavily on Simula for inspiration.
These languages were developed part in response to the challenges
faced by ever expanding code base sizes and part by the need to
express solutions in a human centric manner. Smalltalk is significant in
the programming language development timeline as it directly
influenced the design of a generation of OO languages such C++ ,
Flavors and Java . Smalltalk had at its centre the concept of a “class ” as
an organisational unit of a program, capable of describing a meaningful
entity that formed part of the problem domain. Instances of these
classes (“objects ”) could then message each other to work together to
solve some collective problem, much as a team of people would
communicate and cooperate to solve a problem. The world has never
looked back, and the OO paradigm is now an established cornerstone of
our modern programming landscape.
1.5 The Java Language
The Java language had its 1990s origins in a language called Oak
intended for use in interactive television set top boxes. Initially
developed by James Gosling, Michael Sheridan and Patrick Naughton,
the aim was to produce an OO language to build applications that could
run on any interactive television, regardless of the underlying hardware
that any individual unit had. Although Oak was not successful, it
developed further into the Java 1.0 released by Sun Microsystems
promising “Write Once, Run Anywhere” (WORA ) code. This was a
major innovation that arrived at a time where there was a demand for
lower cost development capable of producing applications that could
run in a range of machines, and on the fast-paced range of new web
browsers that were emerging.
At the heart of this innovation was the idea of the Java Virtual
Machine (JVM) . The JVM was an abstract implementation of a general-
purpose microprocessor, with a corresponding low-level byte code
language specification. Although this abstract microprocessor did not
actually exist, it was similar in design to the vast range of commercial
microprocessors available, so the “last leg” translation of the JVM byte
code to actual machine code for a specific microprocessor was a simple,
speedy and low-cost task. Any Java compiler just needed to translate
the Java source code to JVM bytecode, and the code could then execute
on any device equipped with a JVM.
Software developers soon provided JVMs for all popular platforms.
This idea of a virtual machine or “sand box” has been widely adopted in
other software engineering applications and frameworks as it offers
flexibility with very little loss of efficiency. It’s how Macs can pretend to
be PCs, and how systems can be built with components written in
different languages.
Java received a particular boost resulting from the emergence of
mobile computing platforms. Manufacturers of smartphone and tablet
devices faced the same challenges as the earlier developers of
interactive television set top boxes—the need to run the same code on
different underlying devices. So, Java was a natural choice as the
implementation language for the Android operating system (Google,
2007) and its applications.
Java has continued to evolve and was acquired by the Oracle
Corporation following their acquisition of Sun Microsystems in 2010
and continues to be free to use. It is available as a run time only package
(JRE ) and as a development toolkit (JDK ). As at 2018, Java is in version
SE 11 and there is an Enterprise Edition EE 8 (known as Jakarta EE ). A
separate version of the JVM (Android Runtime and, before that, Dalvik )
and a branch of the language exist for mobile development.
So, Java is a modern OO compiled language that relies on the virtual
JVM for execution of its byte code. It owes its syntactic ancestry to C and
draws on Smalltalk-80 for inspiration. It is, and has always been, free to
use and embodies the “WORA” principle.

1.6 Tools of the Trade


To create Java programs, you will need to download some tools. They
can all be downloaded from reputable sources for free:
The Java Development Kit ( JDK ): choose the latest version
appropriate for your development machine. All major platforms are
supported. For this book, we assume you are using a desktop
development environment rather than a mobile platform. The JDK
contains the Java compiler and several other tools to help you
develop, debug and document your work. Ensure that your download
the Java Development Kit (JDK) rather than the Run Time
Environment (JRE)—your computer likely has the latter installed
already.
An Integrated Development Environment (IDE) : this is a toolset
to help you edit and manage the code that you produce. There are
many popular IDEs available. The professional market leaders are
Eclipse and Netbeans which are rich in features, but overly complex
for learning and teaching. This book, and many others, uses the BlueJ
IDE that can be freely downloaded for all major platforms. BlueJ was
developed specifically for teaching and learning and offers just the
right set of features to enable you to develop code easily.

All the code examples used in this book are available freely in the on-
line package that accompanies this book.
With that knowledge, it’s time to start writing some programs.
© Springer Nature Switzerland AG 2019
Kingsley Sage, Concise Guide to Object-Oriented Programming, Undergraduate Topics
in Computer Science
https://doi.org/10.1007/978-3-030-13304-7_2

2. Procedural Programming Basics in


Java
Kingsley Sage1

(1) School of Engineering and Informatics, University of Sussex,


Falmer, East Sussex, UK

Kingsley Sage
Email: [email protected]

In Chap. 1 we learned some of the key concepts and terminology


around programming. In this chapter it’s time to jump in and start to
create our first programs in Java using the BlueJ Integrated
Development Environment (IDE). The first programs that we shall
consider will be necessarily simple., and are intended to introduce the
reader to the basic workflow necessary to write, compile, execute and
debug a Java program, and to the elements of procedural programming
that constitute core programming knowledge applicable not just to
Java, but a wide range of other procedural and Object Oriented (OO)
languages. At this stage, we will not focus on the OO elements of Java—
that subject is explored in depth Chap. 3. Instead we shall master some
basic procedural programming elements that make up an essential
component of the broader landscape of coding.

2.1 First Program and Workflow


The traditional first program in many textbooks is “Hello World ”, so we
shall start there. To create a Java program using BlueJ, first start the
BlueJ program and under the Project menu tab select “New Project”.
Give the project a name. The project name will be used to create a
directory on your PC/Mac. A BlueJ project is effectively a set of files
contained within a directory. That set of files will ultimately consist of
source code ( .java files) , compiled Java byte code ( . class
files) and other files that, taken together, constitute your Java
application. Once you have done that you should have a screen that
looks like this:
The precise appearance and layout may vary slightly depending on
which version of BlueJ you have installed on your machine. There are
some key controls to appreciate:
Menu bar: where you will find key operations such as saving and
opening projects.
Central panel: the large panel on the top right where organisational
chunks of code will ultimately be represented.
Workbench: the panel at the bottom of the screen where you will be
able to monitor your completed program as it executes.
The left-hand side key controls panel: where you will find buttons
to create a “New class” and “compile” your programs.

To create a Java program, the workflow is as follows:


Create a project: A project is a collection of files that make up a
program or application.
Create one or more “classes”: A class is an organisational unit of a
Java program. We shall consider this is much more depth in Chap. 3.
For now, we just need to understand that a Java program is built from
one or more organisational units of functionality. At this stage we
shall build a program from just one class, and that class will contain
all the code that we need.
Compile the class into Java byte code: this may require several
attempts at editing the code using the BlueJ source code editor.
Create an instance of the class: again, this terminology will become
clearer in Chap. 3. For now, we can think of this as “creating a
functioning incarnation of our program on the Java Virtual Machine”.
Call a method: summoning some aspect of the instance of the class
to make the program “do something useful”.
If there are problems, we may also need to go back and fix
errors: this is the process (some would say art) of “debugging”.

So, we start by creating a class. To do this, press the “New Class” button
on the left-hand panel. Your will be asked for a Class Name. Provide an
alphanumeric name. By convention, Java classes start with a capital
(upper case) letter. They should not start with a number, and there
should not be any spaces in the name. Many experienced programmers
Discovering Diverse Content Through
Random Scribd Documents
When the Riflemen were occupying their camp on the Pyrenees,
an owl had taken up its quarters with them, and always pitched on
the tent of Lieutenant Doyle, who was killed at the Nivelle. Its
accustomed haunt being gone, it transferred its perch to Captain
Duncan’s tent. The joke ran, in the rough mirth of the camp, that he
must be next on the roster; a joke of which he neither liked the
point, nor saw the wit. Yet so it was that he fell in this day of Tarbes.
This fight was a strictly regimental one; for (as I have said) the
Rifle Battalions only were engaged. It excited the admiration of their
companions in arms. One of them, an eye-witness, thus speaks of
this action: ‘Our Rifles were immediately sent to dislodge the French
from the hills on our left, and our battalion was ordered to support
them. Nothing could exceed the manner in which the ninety-fifth set
about this business. Certainly I never saw such skirmishers as the
ninety-fifth, now the Rifle Brigade. They could do the work much
better and with infinitely less loss than any other of our best light
troops. They possessed an individual boldness, a mutual
understanding, and a quickness of eye in taking advantage of the
ground, which, taken altogether, I never saw equalled. They were in
fact as much superior to the French Voltigeurs as the latter were to
our skirmishers in general. As our regiment was often employed in
supporting them, I think I am fairly qualified to speak of their
merits.’[135]
The enemy having been driven from the hill retreated across the
plain, which was covered with the pursued and the pursuers. As they
were crossing it, the Riflemen came upon a considerable body of the
French who were retreating from the town of Tarbes, whence they
had been driven by the 3rd Division; and it was proposed that the
Riflemen, quickening their pace, should fall upon their flank and
intercept them. But the French were too quick for them. For
perceiving their intention, they inclined to the right and got away.
The enemy having crossed the plain took up a strong position on
some heights at the extremity of it; but while Lord Wellington was
making dispositions to attack them, darkness came on; and the
Riflemen bivouacked that night on the plain. The French cannonaded
the bivouack from the height, but the fire was almost harmless; and
as the troops did not move from the ground on which they had
bivouacked, it gradually ceased. And in the night the enemy
abandoned the position and continued their retreat; pursued in the
morning by the Riflemen, who halted that night at Lannemazen. The
next day they proceeded, still in pursuit, to Castelnau. And starting
early in the morning of the 24th, halted that night at L’Isle-en-
Dodon. And on the next day (moving on Toulouse) reached Mont
Ferrand. On the 27th they advanced to the village of Tournefeuille, a
little beyond which the enemy still held some ground, occupying
some hedges and enclosures, in front of a bridge about half a mile
from the village. The 3rd Battalion and a Portuguese regiment were
ordered to dislodge them. And the Riflemen extending to the left
while the Portuguese moved on the road, the French gradually fell
back towards the bridge and crossed it, taking the road to Toulouse;
and the Riflemen did not pursue. The loss was trifling. But a most
curious circumstance occurred during this skirmish. A Rifleman of
the name of Powell was shot in the mouth, the ball knocking several
of his teeth out. One of these struck a Portuguese and wounded him
in the arm. The surgeon of the 43rd who happened to be at hand,
dressing the wound of the Portuguese, found in it not a bullet but a
tooth. On this the cry went among the Riflemen that ‘The French
were firing bones and not bullets.’
On enquiry being made and the relative positions of the
Portuguese soldier and Powell being ascertained, no doubt remained
that his tooth had caused the wound. Powell was afterwards killed
by a cannon-ball near New Orleans. I relate this extraordinary
circumstance on the authority of Surtees, who was near Powell at
the time he was wounded, and who minutely examined into the
circumstances at the time. I ought to add that I have invariably
found Surtees’ statements corroborated in every particular by the
relations or journals of others; and as he was a man of strong
religious impressions his veracity cannot I think be questioned.
On the 29th the Regiment moved forward to near Toulouse, and
occupied some villages and châteaux in the neighbourhood. On the
31st the engineers attempted to throw a bridge over the Garonne
above its junction with the Ariège above the town, and the Regiment
was assembled to pass it; but the number of pontoons being
insufficient, and it not being possible to construct a bridge on
trestles, they returned to their cantonments. But it would seem that
the 3rd Battalion did cross (ferried over probably)[136] and were left
as a picquet in one of the villages on the bank.[137]
On April 2 all had recrossed the Garonne, and again occupied
cantonments, on this occasion the houses occupied being lower
down the river than those in which they were formerly cantoned; the
3rd Battalion were quartered in a wine-store, amongst the casks of
which the men slept. During the time they occupied it no
depredation whatever was committed, nor was any man of the
Battalion found to be drunk. On the 6th the Regiment moved down
the river towards Grenade, and encamped near the village of Seilh.
A bridge of pontoons had been thrown across the Garonne here, and
some divisions had crossed; but the river having risen, and fallen
trees having been floated down the river, the pontoons broke away
from the right bank, and were swung round with the stream, being
still fast to the left bank. Though exertions were made to re-
establish it, it was not practicable till the 9th. And early in the
morning of the 10th the Regiment with the other troops of the Light
Division crossed it, and moved up into position in front of Toulouse.
The roads were excellent, and they quickly attained the position they
were to occupy. Their right, the 3rd Battalion, was to touch Picton’s
left, and the left was to communicate with the Spanish force under
General Freyre. In front of the Riflemen the enemy occupied some
houses, and they had constructed a battery near the bridge over the
canal of Languedoc; and at the end of the bridge stood a Convent
which they had loop-holed and fortified in a very effective manner.
The Riflemen commenced by driving the enemy from the houses,
and keeping up their attention during the day. But some of the 3rd
Battalion (and of Picton’s division on their right) pushed on too far,
and getting under the fire of the defenders of the Convent, they
suffered severely. To cover themselves they had to leap into an open
sewer; and detestable as was this position, they had to remain in it
for some time, so severe was the fire of their opponents. But on the
left of the Riflemen a different scene was taking place. The
Spaniards had claimed, as a place of honour, to lead the attack on
the Calvinet. Their rout and their flight under the fire of its defenders
are well known. The Riflemen, and the other regiments of the Light
Division, were mainly occupied during the day in covering the retreat
of the Spaniards, who re-formed more than once and advanced to
the attack; but always to be repulsed by the French fire, and to fly
from it. As often as the English troops interposed, the French
retired; as often as they left the fight to the Spaniards, the French
pursued them.
When the left of the Division was thus occupied in shielding the
flying Spaniards the French rushed out again with loud cries, in front
of the 3rd Battalion, and only with hard fighting were again driven
in. So the battle raged till about four o’clock, when Beresford having
carried the heights on the left of the Riflemen, the French withdrew
within the place, and the battle ended.
Captain Michael Hewan of the 2nd Battalion was severely
wounded. 14 Riflemen of that Battalion were killed; and 3 Sergeants
and 23 Riflemen wounded.[138]
The Regiment bivouacked on the ground they had occupied, being
saluted from time to time by shot or shell from the place.
On the 11th the Regiment remained perfectly quiet, and on the
12th entered Toulouse, Marshal Soult having in the previous night
retreated from the place in the direction of Carcassonne. On the
same day Colonel Cooke and Colonel St. Simon, as English and
French commissioners, arrived with intelligence of the abdication of
Napoleon. This was at once communicated to Marshal Soult; but as
he refused to acknowledge the authority of those making the
communication, the Regiment with other troops was started in
pursuit, and marched on the 16th towards Villefranche. On the
second day’s march, as they were halted on the roadside, loud
huzzas were heard in front, and a carriage approached containing
Count Gazan, the bearer of intelligence that Soult recognised the
abdication of the Emperor, and acceded to a suspension of arms.
The Regiment, therefore, at once returned to Toulouse and occupied
their former quarters.
Towards the end of April the Regiment moved out of Toulouse,
and descending the Garonne were quartered in Castel Sarazin and
the neighbouring villages, the 1st Battalion occupying Castel Sarazin,
and the 3rd Grisolles. The 2nd appear to have been at Castelnau
d’Estrettefons.
Here they remained until the 1st June, when they forded the
Garonne and halted at Grenade. On the next day they reached
Cadours near Cologne, at which the 2nd Battalion halted. On the 5th
they marched to Leitoure; and passing next day through Condom
and Nerac halted at Castel Jaloux. On the 11th they reached Bazas
and on the 12th arrived at Langon. The next day they proceeded to
Barsac. On the 14th they halted at Castres, and the next day
entered Bourdeaux. They were not however quartered there, but
merely passed through it, and marched on to Blanquefort. On the
road the Riflemen were reviewed by Lord Wellington, and the men
and officers as they passed saluted with loud cheers the chief who
had for six years led them to victory.
They remained at Blanquefort till the 13th July, when the 1st and
2nd Battalions embarked at Paulliac on board H.M. ship ‘Ville de
Paris’ and disembarked at Portsmouth on the 22nd.
The 3rd Battalion embarked on the 8th July on board H.M. ship
‘Dublin,’ and sailing on the 9th arrived at Plymouth on the 18th, and
disembarking there occupied the barracks.

I have been unwilling to interrupt the narrative of events in which


the Regiment was engaged in the North of Spain and the South of
France; but I have now to turn to operations in Holland in which
detachments of the three Battalions were engaged.
An expedition to that country having been decided on, under the
command of General Sir Thomas Graham[139] (afterwards Lord
Lynedoch), some companies of the Regiment, from the depôts of
each Battalion at Shorncliffe, were selected to form part of it.
Of the 1st Battalion, Captain Glasse’s company; of the 2nd,
Captain M’Cullock’s; and of the 3rd, two companies, Captains
Fullerton’s and William Eeles’, formed the detachment to accompany
this expedition.[140]
They marched from Shorncliffe on November 28; but in
consequence of the continuance of easterly winds, did not embark
from Deal until December 9. In this embarkation the Deal boat
which was conveying Captain Glasse’s company on board H.M. ship
‘Grampus’ was swamped; but the men, after being in considerable
danger, were all saved. Yet their dangers were not over; for on that
or the next night the ‘Grampus,’ in which the Rifle companies were
embarked, came into collision with the ‘Monarch.’ These dangers
being overcome, the Riflemen disembarked at St. Martin’s dyck in
the Island of Tholen on December 17; and made a night march to
Wosmaer. On the next day they proceeded to Halteren, and thence
to near Bergen-op-Zoom, near which they halted. At this time
Bergen was partially invested, and the Riflemen were moved up on
the 23rd close to the walls. But on the 24th they made a night
march to Steenberghen; and on the next day proceeded to
Oudenbosch. Here they halted some days; and on the 29th an
attack was anticipated, but none took place.
Early in January 1814 a combined movement was arranged
between Sir Thomas Graham and General Bülow, who commanded
the Prussian force with which Graham’s was to co-operate, by which
the French were to be dislodged from Hoogstraten, and a
reconnaissance was to be made on Antwerp. Accordingly the
Riflemen moved to Roosendael on January 9, and thence to
Calmthout, where they arrived at daybreak on the 11th. The
combined movement of the English and Prussians was to have taken
place on the 12th; and on that day the enemy threatened an attack;
but learning from their patrols that the Prussians were also
approaching, they fell back, and being reinforced from the garrison,
took up a position in front of Antwerp, their left resting on the village
of Merxem, their right on Bergerhout. The Riflemen on the enemy
retiring had advanced in pursuit to Capellen.
On the 13th they advanced towards Antwerp, and soon came up
with the enemy’s rear, as they were retiring into the place. There
was a smart skirmish; and the enemy were driven into Antwerp. The
Riflemen distinguished themselves in this affair; and Sir Thomas
Graham in his despatch particularly mentions ‘the rapid but orderly
advance of the detachment of the 3rd Battalion of the Rifle Corps
under Captain Fullerton’s command,’ with great praise.[141]
In this affair one Rifleman of the 3rd Battalion was killed, and one
wounded.
On the 14th they fell back to Calmthout, and on the 15th marched
to Eckeren, where they remained for some days. The Riflemen had
suffered much from the extreme cold; and on January 26 it reached
its maximum, the thermometer marking 13° of frost.
During the month of January the army under Sir Thomas Graham,
which originally amounted to hardly 6,000 men, was increased by
reinforcements of about 3,000 men. And at this time Major and
Brevet Lieutenant-Colonel Cameron of the 1st Battalion arrived in
Holland and took command of the detachments from the three
Battalions.
As the French had 12,000 men in Antwerp under Carnot’s
command, no regular siege could be attempted with this force and
with the means at Graham’s disposal; it was resolved therefore to
attempt to set fire to the enemy’s ships at Antwerp. With this object
the troops were moved forward. And the Riflemen returned on
January 30 from Eckeren to Calmthout; on the 31st marched to
Braeschaet; and on February 1 advanced to Donk. On that evening
the picquets had some fighting with those of the enemy. On the 2nd
the enemy advanced to Merxem, which had been strengthened with
field works, and the Riflemen had some hard fighting in and about
that village, and at Schooten. Merxem was carried in gallant style;
and Graham specially notes the conduct of ‘the detachments of the
three Battalions of the Rifle Corps,’ under Colonel Cameron’s
command, ‘for the distinguished manner in which they attacked the
left and centre of the village, forcing the enemy from every
stronghold.’[142]
On this day Lieutenant Wright of the 1st Battalion was returned as
wounded;[143] as were Captain William Eeles, Lieutenants Ferguson
and Fitzgerald of the 3rd Battalion. One bugler and 2 Riflemen of the
2nd Battalion were killed, and 6 wounded.[144]
The attempt to burn the ships in the Scheldt and in the docks was
unsuccessful; for our mortars numbering only seventeen, two-thirds
of which were Dutch or French ones found on the ramparts of
Willemstadt (where part of the force had disembarked), were
unserviceable, and unable to throw shells a sufficient distance. The
enemy too nightly flooded the decks with water, which the intense
frost converted into a thick coating of ice, which, at that range,
helped to resist the shells thrown by the imperfect mortars. And the
enemy were able at once to extinguish any fire among the shipping
which might take place.
On the 3rd the Riflemen occupied the château of Merxem, where
they remained until the 6th, when the partial investment of Antwerp
and the attempt on the ships having been found a failure, they
moved to Braeschaet. On the next day they were again moved
forward to Donk to repel a sortie of the garrison, which having
effected they returned to Braeschaet; and on the 9th fell back to
Klein Zundert, and on the 15th to Loënhout.
About this time the Prussians, having received orders to proceed
to the south, separated from the British force; and Graham’s position
on the frontier of Holland was far from secure. He fell back, as we
have seen, from Antwerp, and occupied ground between that place
and Breda. He eventually resolved to attempt the capture of Bergen-
op-Zoom. The Riflemen moved on February 28 to West Wesel. In the
storm of Bergen and its failure they had no part; for on March 8 (the
day on which the attempt was made) they marched in the evening
towards Antwerp, it being understood that their destination was to
attack Fort Lillo. They marched all night, and towards morning were
countermanded and halted; and some hours afterwards heard of the
failure at Bergen-op-Zoom. However a picquet of the 3rd Battalion
was left near Bergen; and on the failure of the attack on it, they
were ordered late in the night of the 8th to retire, and to make the
best of their way to their companies. This they effected; but with
barely sufficient time to call in their advanced sentries.[145]
On the 9th the Riflemen halted at Stabroek, and on the 11th
moved to Capellen.
Another sortie was made by the enemy from Antwerp on March
26, and the Riflemen were under arms expecting an attack; but
none took place on them, the enemy having retired. Such alarms
and affairs occasionally occurred; for on the 30th the Riflemen
pursued a foraging party of the enemy, but unsuccessfully, for they
made good their return into Antwerp before the Riflemen could
intercept them. But all really active operations of this expedition
terminated with the failure at Bergen-op-Zoom. Some further
operations were contemplated; but as Graham was on the point of
executing them, news reached the Riflemen on April 4 of the
entrance of the Allies into Paris on March 31.
However by the Treaty of Paris the Kingdom of the Netherlands
was to be established; and pending the details of that measure
being arranged by the Congress of Vienna, an Anglo-Hanoverian
force was to remain in the country. The Rifle detachments formed
part of it.
Early in April a detachment of one company was sent to occupy
Fort Batz, and on April 15 the Riflemen moved from Capellen to
Braeschaet and Schooten; on the 29th they marched to Contich, and
on the 30th to Mechlin, where they remained about a fortnight. On
May 14 they arrived at Brussels; where on the 30th they were
reviewed by the Prince Sovereign of the Netherlands, as he was then
styled, afterwards the King of the Netherlands.
On Sir Thomas Graham, then Lord Lynedoch, returning to
England, the Anglo-Hanoverian force was placed under the
command of General the Prince of Orange. The Riflemen remained
at Brussels until August 29, when they moved to Ypres, and on the
31st arrived at Courtrai. On September 5, they marched to Menin;
but returned to Ypres on October 12. Remaining there till November
22, they moved on that day to Dixmude, and to Furnes on
December 9. About this time the Rifle detachments received some
reinforcements. Captain Logan, Lieutenant Robert Cochrane and 45
men of the 2nd Battalion embarked at Deal on November 7 to join
them. On March 8, 1815, they were at Nieuport, with a detachment
of two companies at Furnes; their strength being then 4 captains, 14
subalterns, 2 staff, 21 sergeants, 9 buglers and 388 rank and file,
under the command of Captain Glasse of the 1st Battalion. But on
March 24 they were re-united at Menin.[146]
On the renewal of hostilities in 1815 the companies of the 1st and
2nd Battalions joined those Battalions on their arrival in Flanders.
The 2nd Battalion company joined at Leuze on April 18; and the two
companies of the 3rd Battalion were (with the 2nd Battalion) in Sir
Frederick Adam’s brigade at Waterloo.[147]
I have said that the five companies of the 3rd Battalion, on their
return from the Peninsula disembarked at Plymouth, and moved into
barracks there. On September 18, 1814, exactly two months after
their arrival in England, they re-embarked for service; the
commanding officer, Major Mitchell, and three companies on board
the ‘Fox,’ and the other two companies on board the ‘Dover’ frigates.
Their destination and the nature of their service were kept a
profound secret, but they were, in fact, intended to effect a descent
on the American coast near New Orleans. They reached Madeira on
the 8th October, where they remained till the 11th, and having
touched at Barbadoes early in November, anchored in Negril Bay,
Jamaica, on the 25th. Here they were joined by four line regiments,
and two West India regiments; and setting sail on the 29th, arrived
off the American coast near Mobile on December 10, and on the
11th anchored near the Chandeleur Islands near the entrance to
Lake Borgne.
New Orleans is situated on the left bank of the Mississippi, here
about 800 or 1,000 yards across; below the town are great marshes,
covered with reeds six or seven feet high. While on the river bank
runs a strip of firm ground, varying from one to three miles across,
and mostly under sugar plantations. From this the marsh extends six
or seven miles to the shores of Lake Pontchartrain, which
communicates by Lake Borgne with the sea.
It was deemed impossible to approach New Orleans by the
Mississippi, as well because very strong works existed at its mouth,
and on the way up to the city, as because the course of the river is
so tortuous that no wind would have carried the ships up, without
considerable delay. It was therefore resolved to disembark the
troops on the shore of one of the lakes. But it was ascertained that
the Americans, already cognisant of the intended invasion, had
placed gun-boats on these lakes to prevent the landing. The
previous destruction of these was therefore necessary; and this was
effected in very fine style and in a very short time by the boats of
the fleet under Captain Lockyer.
On the 15th the Riflemen were moved from the ships of war into
brigs, which drew less water, but in which they were so crowded as
to be unable to lie down or almost to turn. But even these were too
deep for the shoal waters of the lake, and they were transferred into
long boats, from which they were landed on the 19th on the Île au
Poix (or as our men called it Pearl Island), formed by the branches
of the Pearl river. The weather in moving from the ships to the island
was very bad; and on arrival at it, it was found to be a perfect
desert. Nothing but reeds grew on it, except a few scrubby pine-
trees at one end. To add to their discomfort, a severe frost came on
at night; the men were without shelter of any kind, and they
suffered severely. And as all their supplies had to be furnished from
the fleet, want of provisions was added to their other hardships.
On the 22nd the Battalion (which formed part of the advance
under Colonel Thornton) embarked in boats, and about two o’clock
pushed off to land on the mainland. The place decided on for their
disembarkation was at the head of a creek called Bayou Catalan in
Lake Borgne. The distance was between thirty and forty miles, and
the men were so crowded in the boats that they could not move.
They did not reach the entrance to the creek till after dark. As a
picquet of the enemy was posted about half a mile up the creek,
Captain James Travers, with his company, were placed in small boats
and pushed forward. The picquet was stationed at some huts; near
these Travers landed, and having moved his men to both ends of the
huts, prevented the escape of the picquet, which was secured
without a shot being fired. This was admirably effected; and was a
most important service. For had this picquet escaped or raised an
alarm, the landing would have been opposed. And this would have
been a serious check; for on the morning of the 23rd, when the
leading boat reached the narrow part of the Bayou it was found
impracticable to ascend higher, and the boats being drawn up one
after another the men passed over them as a bridge. This of course
was a very slow operation, and one which, if opposed, would have
been very difficult. The Battalion disembarked about an hour after
daylight, having been upwards of sixteen hours cramped in the
boats.
As soon as the whole advance were on shore, they marched,
Travers’ company leading; and to give their force as imposing an
appearance as possible, and to scour the country, they advanced
with extended files. They moved in this order through a wood which
skirted the swamp on this side, and as soon as they had cleared it,
came upon a house, surrounded with out-buildings and huts for
slaves, belonging to a M. Villeroy. The Battalion advancing at the
double, took possession of it; and in this and some neighbouring
houses took about thirty prisoners, and a good many stand of arms,
belonging, as was supposed, to the local militia. Unhappily M.
Villeroy escaped, and probably gave information to the enemy; this,
before the night was over, entailed very disastrous consequences.
The Battalion then advanced, and turning to the right, marched for
about a mile on the road to New Orleans, and then bivouacked in a
green field in quarter distance column.
The road ran near the river’s bank which was on the left; and an
embankment about three or four feet high was thrown up to keep
the overflow of the river from the cultivated ground, here about
three-quarters of a mile or a mile broad; beyond this was a strip of
wood, the way through which was, in fact, impracticable, the ground
under the trees being wet and swampy. The cultivated land was
much intersected with wet ditches, and divided by strong wooden
palings five feet high.
On arriving at the bivouack Travers’ company, which had formed
the advanced guard on the march, was pushed forward about a mile
to the front, on the main road, as a picquet.
The troops halted somewhat after mid-day; and as the men had
been without provisions since the morning before, they began as
soon as dismissed to cook. While doing so, between three and four
o’clock, firing was heard in the front from the picquet; it turned out
to be in consequence of an American officer, attended by some
mounted men, riding up to the picquet to reconnoitre. However, the
Riflemen saluted him with a few shots, one of which wounded him,
and another killed the horse of one of the party, on which they
retired, getting off the wounded officer with them.
At nightfall, Captain Hallen’s company relieved Travers at the
advanced picquet; and the men of the rest of the Battalion, being
much fatigued by their uncomfortable night in the boats, their
tedious landing, and their march, lay down in bivouack. They had
torn down some of the palings dividing the fields, and had made
good fires which then burned brightly. While they were thus, as they
fancied, secure, a schooner dropped down the Mississippi, and
guided by the light of their fires, opened a heavy cannonade upon
them with great effect. The men of course were aroused and
dispersed; but no shelter could be found, in this dead flat, except by
crouching under the embankment by the riverside. Hallen had seen
the schooner pass his post and had sent a man off to alarm the
Battalion; but the schooner having the current of the river in her
favour reached the bivouack before the Rifleman could get there.
While in this state of alarm from the sudden cannonade from the
schooner, heavy and continued firing was heard in the front. A body
of 5,000 Americans had attacked Hallen’s picquet, detaching 1,500
men through the wood to turn the right of the troops. Nobly Hallen
kept them at bay; but being himself wounded, and his picquet
threatened by such overpowering odds, reinforcements advanced
from the Battalion. Meanwhile the enemy made way through the
garden of a house on the right, where a picquet of the 85th had
been placed; and the night being very dark, a hand to hand fight
took place. Every deception was practised by the enemy; and having
discovered (from prisoners probably made in the mêlée) the
regiments opposed to them, they would call out, ‘Come on my brave
ninety-fifth (or eighty-fifth),’ and then make those who advanced
prisoners.
But this ruse was not always successful; more than once they
found that instead of making Riflemen prisoners, they had
themselves ‘caught a Tartar.’ On one such occasion an officer and
some men of the Battalion made a body of the Yankees prisoners,
and when they were desired to lay down their arms, the cowardly
officer who commanded them made a stab at the 95th officer with a
knife. He was summarily disposed of; for a Rifleman instantly shot
him through the body.
Meanwhile the fight continued at Hallen’s post. Two battalions
came up and fired volleys by word of command as at a drill. Not
much to their advantage, for the Riflemen, warned by the words,
‘Ready! Present!’ took care to lie pretty close before the word ‘Fire!’
which, having been pronounced and obeyed, they sprang up, and
gave them a severe return before they could reload. This continued
for some time; but at last, the picquet was obliged to give way
before superior numbers. Yet they only retired a little way to get
under cover and re-form. Eventually the Riflemen advanced again,
attacked their assailants, repulsed them, and regained the post.
Hallen, as I have said, was wounded, so was Lieutenant Forbes, who
held a separate post, and about forty men were killed or wounded.
This defence by Hallen has truly been characterised as ‘an affair of
posts but rarely equalled, and never surpassed in devoted
bravery.’[148]
‘Had the expedition terminated more favourably,’ he who makes
the foregoing remark goes on to observe, ‘it is to be presumed that
the brave commander of the company would not have gone
unrewarded.’ It may be so: this is the presumption; the fact is, that
Hallen retired from the Service in 1824 with the rank of Captain,
which he had obtained fifteen years before. Thus England rewarded
acts of valour performed by all but her superior officers.
When the fire was first heard at Hallen’s picquet, Major Mitchell,
taking with him twenty or thirty Riflemen, had hurried to the front to
reinforce it. On the way, however, he fell in with a body of the
enemy, whom, in consequence of the darkness of the night, he could
not distinguish, and he and the men with him were made prisoners.
Altogether the loss of the Battalion on that night was 6 Sergeants
and 17 Riflemen killed; Captain Hallen, Lieutenants Daniel Forbes,
(severely), and W. S. C. Farmer (slightly), 5 Sergeants and 54
Riflemen wounded; and Major Samuel Mitchell, 2 Sergeants, and 39
Riflemen missing. A total (exclusive of officers) of 123, or one-fifth
of their whole number.
The loss of the Americans, who were finally driven off about
midnight, must have been very great, for the field was strewn with
their dead.
Yet still the schooner, and a ship which had joined her, inflicted
amazing annoyance on our people. With a brutality happily unknown
among European nations, they fired into the houses to which the
wounded had been carried. One shot struck a house in which a
wounded Rifleman was lying, and knocked away his knapsack, which
he was using as a pillow, without doing him any actual injury.
However, this savage warfare was to end. On the night of the 25th
a battery was constructed close to the river’s edge, and furnaces
erected for heating red-hot shot. At daybreak on the 26th the
battery commenced its fire on the schooner. Its crew, whose courage
did not equal their cruelty, at once took to their boats and fled; the
fourth shot set her on fire, and she soon afterwards blew up. While
the ship, warned by her fate, and esteeming discretion as the better
part of valour, had herself towed, as rapidly as possible, out of the
range of the little English battery.
In this bivouack the Riflemen continued till the 28th. But it was
toilsome work. The picquets were continually fired at; the reliefs
waylaid; the officers going round their sentries exposed to chance
shots from a concealed marksman. How different this from the
courtesies and chivalry of their European enemies, which I have so
often had occasion to narrate!
Compiled & Drawn by Captn H. M. Moorsom, Rifle Brigade. E. Weller, Litho.
London, Chatto & Windus.

O p e ra t i o n s n e a r
NEW ORLEANS
in 1814–15.

Early on the 28th the army advanced towards New Orleans, the
Riflemen leading, by the high road along the river’s bank. They
drove in the enemy’s picquets, and proceeded along the road here
called ‘Le détour des Anglais,’ till, on turning round some houses on
the left, they suddenly found themselves in front of a strong work
the enemy had thrown up, and from which they opened a
cannonade from four guns; while their old enemy the ship, now
moored a little in advance of the work, brought a flank fire to bear
on them. The Riflemen, leading and extended, did not suffer so
much;[149] but the 85th which followed in close formation were
mown down by this fire. Some houses were on the right, which
might have afforded some temporary cover; but the enemy, by their
shells, set them on fire, and the flames added to the confusion. To
escape in some measure from the effects of the fire the regiments
were deployed to the right, while the Riflemen advancing about a
hundred yards got into a ditch, which in a great degree sheltered
them. In the afternoon the regiments moved off by wings, so as to
present as small a body as possible to the enemy’s fire. The
Riflemen, however, did not move off till after dark, nor till some of
the Yankees had ventured out of their works ‘in a very triumphant
manner.’ But a few shots from the Riflemen immediately produced
the conviction among them that it was more advisable to return to
the protection of their rampart. This work was a stout parapet, in
front of which was a wet ditch or canal. Its extent was about 1,000
yards, and its left touched the river, while its right was defended by
the wood.
The army now took up a position about a mile and a half or two
miles from this work. The Battalion was placed in a house rather in
advance, and on the left of the line. This was exposed, not only to
the fire from the work, but also, as it was near the bank, from a
redoubt which the enemy had constructed on the opposite side of
the river. The men were placed in a sugar-house belonging to this
farm, the floor of which being sunk below the level of the natural
ground afforded some protection. Yet on one occasion at least their
cooking utensils were knocked off the fire by shot passing through
this house.
So matters continued until the 31st. It was resolved to bring up
some of the ships’ guns and to place them in battery against the
enemy’s work. Accordingly on the night of the 31st strong working
parties were employed in constructing two batteries near it; one with
the object of keeping down the flank fire from the ship; the other
with the view of breaching the centre of the rampart. The night was
dark; the men worked in silence; and before daylight the batteries
were completed, and the guns in position.
Early in the morning of January 1, 1815, the troops were moved
up, with the object of attacking the enemy’s work. A thick fog
favoured their advance, and concealed their movements from the
Americans. About nine o’clock the fog rose, and our batteries at
once began their fire. This threw the Yankees, who were seen on
parade, into utter confusion; and had a charge on the works been
made at that moment, no doubt it would have been successful. But
unhappily the orders were that the attack was not to be made till the
enemy’s fire had been silenced, and his works breached. When,
therefore, the Americans saw that nothing took place but a
cannonade, their courage returned, and after about twenty minutes
they began to return our fire; and gradually increased to a vigorous
cannonade, which effectually overpowered our guns, and
dismounted some of them. The flank fire too from the battery on the
opposite bank of the river, in which they had placed their ship’s
guns, was very galling.
After being kept under this fire inactive till between two and three
o’clock in the afternoon, the troops were withdrawn and bivouacked
on the ground, and some occupied the houses they had held during
the last few days. At night the troops were turned out and employed
in withdrawing the guns from the batteries in which they had been
placed. This was hard work; and some of the guns had to be buried,
it being found impossible to remove them before daylight. Thus the
men had been up, and at hard work, two nights; and in the
intervening day had been for many hours under the enemy’s fire,
without the chance of fighting them. The loss of the Battalion was, 1
Rifleman killed, and 2 missing.
Things continued in this state till the 7th, the picquets being as
before constantly harassed by the enemy.
No other course remained but to carry the enemy’s work by an
attack de vive force, and it was decided that this should take place
on the 8th. Three companies of the Battalion were to precede the
advance of the right column under General Gibbs, consisting of the
4th, 21st and 44th regiments; while the other two companies were
in like manner to act with the left column. The Riflemen were to
extend along the edge of the canal or ditch in front of the enemy’s
rampart, and both parties so extended were to occupy the whole of
the bank, or as it might be called, the crest of the glacis. At four
o’clock in the morning the troops paraded; and by daylight the
Riflemen were in their place. But the 44th Regiment, which had been
appointed to carry ladders and fascines to enable the attacking force
to cross the ditch, had come without them. Their commanding
officer, the Hon. Colonel Mullens, had said loudly the night before
when the regiment was detailed for this duty in orders, that ‘his
regiment was sent on a forlorn hope’ and ‘was doomed.’ And on the
regiment returning to fetch the ladders and fascines, he prudently
did not come back to the front with them. The enemy meanwhile
opened a furious fire on the troops, specially destructive to the
Riflemen who were extended within 100 or 150 yards of the work.
One regiment of the right attack, finding itself exposed to this fire,
and without the fascines and ladders they had been led to expect,
wavered, broke up, and fled to the rear, throwing the regiment
which was following in support into confusion. Sir Edward
Pakenham, who commanded, in trying to rally this column was
killed; General Gibbs, who commanded it, was mortally wounded;
and General Keane, who commanded the left attack, was wounded.
This attack succeeded better; and for a time the troops composing it
held a redoubt which the enemy had constructed in front of the
ditch, and which they had stormed. But in the end they were obliged
also to give way. Thus the Riflemen, extended in skirmishing order
along the edge of the ditch, were left unsupported, and were obliged
to retire as best they could. As their files were extended they
presented a less prominent object for the enemy’s guns, and they
eventually got away with comparatively small loss. Some of them
had got quite to the edge of the ditch, and reported that they could
have passed it, but the attacking columns which they expected
never came up; and to have entered the enemy’s work without them
would, of course, have been certain destruction.
A gallant and successful diversion was made on the right bank of
the Mississippi by a column under Colonel Thornton; but as the
Battalion did not form part of it, it is not my province, as historian of
the Regiment only, farther to notice it.
It was regretted by the Riflemen, that Pakenham, himself a
Peninsular soldier, did not employ troops who had seen fighting
more prominently in so arduous an operation as storming this work.
The 7th and 43rd had arrived just before; beside both these
regiments the Riflemen had fought in Spain and Portugal; the latter
were especially companions in arms, and they had hailed their
advent with delight. Yet these he held in reserve, while he advanced
comparatively unseasoned troops to the fire of the Americans.
The Battalion retired at last, sorrowful and weary, to its bivouack.
It lost 1 Sergeant and 10 Riflemen killed; and Captains James
Travers (severely) and Nicholas Travers (slightly), Lieutenants John
Reynolds, Sir John Ribton, John Gossett, William Backhouse, and
Robert Barker (severely), 5 Sergeants and 89 Riflemen wounded.
[150]

During the night the wounded were removed, and a truce for two
days, to enable the dead to be buried and the wounded cared for,
was made between General Lambert (who succeeded to the
command) and General Jackson who commanded the American
force. This truce was effected, not without difficulty, by Major Harry
Smith, Assistant Adjutant-General, who passed and repassed
frequently between the opposing armies.
During this truce every attempt was made by the Yankees to
induce our men to desert. The non-commissioned officers were
promised commissions, the men land, if they would enter the
American service. On one such occasion two Sergeants and a private
of the 95th were accosted by an officer of American Artillery, who
with such large promises invited them to enter the American service.
The Riflemen heard the tempter out; and then, in language perhaps
rather forcible than complimentary, assured him that they would
rather be privates in their own Corps, than officers with such ‘a set
of ragamuffins’ as they saw before them; assuring him that if he did
not move off, he should have a taste of their rifles. On that hint, he
fled; but getting into the work turned a gun on them and fired,
knocking over the private, whom however he only wounded.
A Rifleman on sentry was exposed to the solicitations of another
of these gentry. He heard all his generous offers of money, land, and
promotion; but pretending he did not, he begged him to come a
little nearer and ‘tell him all about it.’ The Yankee elated at his
success walked up to the post, and when he was well within range,
the Rifleman levelled and shot him in the arm. Then walking
forward, he led him prisoner to the guard-room; on the way
informing him what a real soldier thought of such sneaking attempts
on his fidelity.[151]
These attempts were not always unsuccessful, and much
desertion took place; but Surtees records with natural pride, that as
far as he knew not a single instance took place among the Riflemen
of the 3rd Battalion.
During this truce an officer of the American army was observed
plundering a wounded soldier. This excited the ire of Corporal Scott
of the 3rd Battalion, who (with the permission of his officer) took a
shot at the marauder, and tumbled him over the man he was
plundering.
The last duties having been paid to the dead, and all the wounded
that were capable of being moved having been withdrawn, a retreat
was effected on the night of the 18th. The fires were trimmed, and
the men fell in and marched in silence. The weather had latterly
broken up; heavy rains by day, and sometimes thunderstorms, were
often followed by frost at night. As it was impossible, owing to the
narrowness and shallow water of the Bayou Catalan, to embark the
troops where they had landed, a road, or an attempt at a road, had
been constructed across the marsh, from the great road to New
Orleans, along the river’s bank to the shore of Lake Borgne. This
extended some miles, and was made of reeds, which it was thought
would support the men across the morass; and where it crossed
open ditches, as it frequently did, the reeds were laid on boughs of
trees brought with great labour from the wood. This road, a bad one
at the best, was much injured by the rains, and sunk in with the
tramp of the head of the column; so that this night march was very
fatiguing, the men often sinking in to the knees, and sometimes in
the dark slipping off into the marsh, from whence they were with
difficulty rescued.
However at last on the 19th they reached the shore of the lake
about one mile from its entrance. Here they were ordered to hut
themselves; but this was no easy task, the place being a desert, and
almost the only material the reeds which grew on the marsh.
Here they remained till the 25th, when the Battalion embarked on
board the ‘Dover,’ which had brought out two of its companies. The
Battalion was reduced by its losses in the field to almost half its
strength on landing. On the 27th they set sail; and it was resolved to
attempt the capture of Mobile. This place, lying about 100 miles to
the eastward of New Orleans, is situated in a bay, the entrance to
which is defended by a work called Fort Boyer, which therefore had
first to be reduced. In order to effect this the 4th, 21st, and 44th
Regiments were landed, and commenced the investment of and
approach to the place. While on the 8th February the Riflemen and
the rest of the troops were disembarked on Île Dauphine at the
other side of the bay, till the reduction of Fort Boyer should enable
them to move up to Mobile. Here the men hutted themselves; for
the island, though otherwise almost a desert, is well covered with
pine wood; while the officers, or some of them, had tents.
During the time that they were here, General Lambert inspected
the troops by regiments. On making his inspection of the 3rd
Battalion, James Travers (in Mitchell’s absence, who had been taken
prisoner) was in command. ‘Well, Travers,’ said the General, ‘I hear
your Sergeant-Major ran away on the night of the 23rd December.’
‘Nay, General,’ answered Travers, ‘that he did not. He fought as well
as any man could, and was towards the end of the affair severely
wounded. But,’ added he, ‘I think I know what may have given rise
to that report. A sergeant of ours was in or near one of the houses
where the wounded were taken, and the surgeon made him remain
there as Hospital Sergeant. I did all I could to get him back to the
Battalion; but I could not succeed.’ ‘Well,’ said the General, ‘since I
had done the Sergeant-Major some wrong, I must see what I can do
to make him amends.’ He did procure him an ensigncy in a West
India Regiment, to which he was gazetted soon after.
While the Battalion was on Île Dauphine, a gallant act was
performed by Sergeant Thomas Fukes. He, with four or five
Riflemen, was sent over to the mainland to shoot bullocks. Fukes
with a couple of Riflemen went inland, leaving the other men in
charge of the boat. Here one Shiel of the American navy (who had
captured a boat in bad weather with some of the 14th Light
Dragoons, when embarking at Lake Borgne, and who in
consequence fancied himself a hero) came upon them round a
jutting point, and having captured them, put them in charge of some
of his own crew into their own boat, and dispatched them to an
American ship or post. Then waiting for the sergeant, the other two
Riflemen, and the Commissary, he of course made them prisoners,
since their boat and the rest of their party had disappeared. The
Commissary was placed aft with Mr. Shiel; Sergeant Fukes and his
two men forward; and they were being rowed off. When well off the
shore the Commissary seizing Shiel by the thighs chucked him
overboard, while Sergeant Fukes at the same instant sent one of the
boat’s crew to follow him, and the Riflemen disposed of the rest.
They now recovered their rifles, and having taken security of Mr.
Shiel for his good behaviour, admitted him at his urgent importunity
into the boat, from whence they landed him, a moist and dispirited
prisoner of war, on Île Dauphine.
The approaches to Fort Boyer being completed, Harry Smith was
sent in with a summons to surrender. The poor Yankee commandant,
sadly puzzled, asked Major Smith what he would advise him to do.
He strongly recommended him to surrender immediately, as the
place must be taken by assault. Acting on such good advice, which
fell in probably with his own sinking courage, he surrendered with
his garrison, and signed a capitulation on the 11th February.
This important work having fallen, immediate preparations were
made for re-embarking the troops, and attacking Mobile. But on the
14th news arrived of the preliminaries of peace between England
and the United States having been settled at Ghent on December
24. All warlike operations of course terminated; and the troops only
awaited on Île Dauphine the ratification of the treaty by President
Madison. Intelligence of this reached them on the 5th March, and on
the 15th the officers and Riflemen who had been made prisoners re-
joined the Battalion, having been released under the terms of the
treaty. Major Mitchell had been roughly treated by General Jackson,
because he refused to furnish him with information of our strength
or movements.
On the 31st March the Battalion embarked on board the ‘Dover,’
some few men being placed on board the ‘Norfolk’ transport. On the
4th April they set sail, and, having called at the Havannah, arrived at
Plymouth, whence they were ordered round to Dover, where they
disembarked on the 2nd June and moved to Shorncliffe, where they
found three companies of the Battalion, the remaining two being in
Flanders, as is now to be narrated.
F O OT N OT E S :
[131] George Simmons had been brought up to the medical
profession.
[132] ‘Napier,’ Book xxiii. chap. 3.
[133] Nineteen men of the 1st Battalion, and 1 bugler and 12
men of the 2nd Battalion, were returned as ‘missing.’
[134] He was, while the 1st Battalion were absent, temporarily
attached to the 2nd Battalion; being employed on the telegraph
of the Light Division.
[135] ‘Twelve Years’ Military Adventure.’
[136] See Napier, Book xxiv. chap. 5.
[137] Surtees, 296, 297. The context is very confused, the editor
not having been able to decipher or to arrange Surtees’ MS.
[138] Record, 2nd Battalion. As the return in the ‘London Gazette’
does not distinguish the regiments of the non-commissioned
officers and privates, I am unable to give the casualties of the
other Battalions.
[139] It is evident from Sir Thomas Graham’s letters to Lord
Bathurst and Lord Wellington (‘Supplementary Despatches,’ viii.
376-7) that he undertook this command very unwillingly and only
from a sense of duty. To Lord Wellington he says ‘I cannot look
forward to it otherwise than an irksome service, with scarce a
chance of any material success.’
[140] It would appear from a private letter from Lord Bathurst to
Lord Wellington, that the strength of the detachment of the 3rd
Battalion was 250 men. ‘Supplementary Despatches,’ viii. 390.
This is a clerical or typographical error for ‘of the three Battalions.’
The depôt companies were at this time very weak, and the
strength of the whole detachment was about 250 men.
[141] Graham’s Despatch, ‘Annual Register,’ lvi., 154.
[142] Despatch, ‘Annual Register,’ 157.
[143] I am informed by Mr. Wright that he was not wounded on
this occasion. This is a curious illustration of Byron’s remark about
‘Gazette fame’ (‘Don Juan,’ canto viii., stanza 18 and note). The
officer of the 1st Battalion who was wounded at Merxem on
February 2 was Lieutenant Church. He had been taken prisoner in
one of the fights at Arcangues on December 10, 1813 (see p.
160); but had made his escape, had found his way across France
without being discovered, and had joined Glasse’s company in
Holland. Like M’Cullock after the Coa (p. 56) he had trusted
himself to the fair sex, who had assisted his disguise, and
favoured his escape.
[144] ‘London Gazette,’and 2nd Battalion Record. As the ‘Gazette’
does not distinguish the regiments of the non-commissioned
officers and lower ranks, I am unable to state the losses of the
detachments of the other two Battalions.
[145] I derive this information from Michael Mappin, a pensioner
in the Royal Hospital at Chelsea, who served in the 3rd Battalion
from April 1813 till it was disbanded, and afterwards in the 2nd
Battalion, and who was himself on this picquet. He was wounded
before Antwerp.
[146] ‘Wellington Supplementary Despatches,’ x. 704-5-6, and
718.
[147] I owe almost all the particulars of this expedition to the
kindness of Lieutenant Wright, on half-pay of the Regiment, who
served in it, and who survives in good health and perfect
memory, whose acquaintance I had the pleasure of making while
these sheets were passing through the press. The information
and papers he communicated to me enable me to supply many
details of this campaign, which, squeezed out between the
Peninsular and Waterloo campaigns, and eclipsed by the latter,
has never had its history sufficiently written. Yet it was arduous
service, albeit unsuccessful.
[148] Leach, ‘Sketch of Field Services,’ 27.
[149] Their loss between December 25 and 31 was 1 Rifleman
killed; 1 Sergeant and 3 Riflemen wounded; and 1 Rifleman
missing.
[150] Major James Travers, K.H., died February 5, 1841. The ball
received at New Orleans had never been extracted, and is said
eventually to have caused his death. Lieutenant Backhouse died
of his wounds.
[151] Gleig, ‘Campaigns of the British Army at Washington and
New Orleans’ p. 186. He regrets that he has forgotten, or did not
know, the name of this soldier; a regret in which all Riflemen will
join.
CHAPTER VI.

I now return to the narrative of services of the 1st Battalion, who


had marched to Dover on their return from the Peninsula in 1814.
Napoleon having landed from Elba, on the resumption of hostilities
against him, six companies of this Battalion, under the command of
Sir Andrew Barnard, embarked at Dover on the 25th April 1815 on
board the ‘Wensleydale’ transport and landed at Ostend on the 27th.
The officers present with these six companies were:
Colonel Sir Andrew Barnard.
Major and Brevet Lieut.-Col. Cameron.
Captain Leach, Brevet Major.
” Chas. Beckwith, Brevet Major.
” Glasse.
” Lee.
” Smyth.
” Chawner.
Lieutenant Layton.
” Molloy.
” Archibald Stewart.
” Freer.
” Gardiner.
” Lister.
” George Simmons.
” Stilwell.
” Haggup.
” FitzMaurice.
” E. D. Johnston.
” Orlando Felix.
2nd Lieutenant Church.
” Allen Stewart.
” Wright.
Volunteer Charles Smith.
Lieutenant and Adjutant Kincaid.
Paymaster McKenzie.

You might also like