100% found this document useful (3 votes)
21 views79 pages

Concise Guide To Object Oriented Programming An Accessible Approach Using Java Undergraduate Topics in Computer Science 1st Edition Kingsley Sage Instant Download

The document outlines a concise guide to Object-Oriented Programming (OOP) using Java, aimed at beginners with no prior coding experience. It emphasizes practical applications and includes chapters on core programming concepts, Java libraries, error handling, and GUI development. The book serves as an accessible introduction to OOP, providing resources and examples for self-study or course use in computer science education.

Uploaded by

debbslaveeiv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
21 views79 pages

Concise Guide To Object Oriented Programming An Accessible Approach Using Java Undergraduate Topics in Computer Science 1st Edition Kingsley Sage Instant Download

The document outlines a concise guide to Object-Oriented Programming (OOP) using Java, aimed at beginners with no prior coding experience. It emphasizes practical applications and includes chapters on core programming concepts, Java libraries, error handling, and GUI development. The book serves as an accessible introduction to OOP, providing resources and examples for self-study or course use in computer science education.

Uploaded by

debbslaveeiv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

Concise Guide to Object Oriented Programming An

Accessible Approach Using Java Undergraduate


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

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

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/

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/

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/

Only The Stains Remain Ross Jeffery

https://ebookmeta.com/product/only-the-stains-remain-ross-
jeffery/
Anti Catholicism in Victorian England Routledge Library
Editions The Victorian World Norman

https://ebookmeta.com/product/anti-catholicism-in-victorian-
england-routledge-library-editions-the-victorian-world-norman/

A Concise History Of International Finance From Babylon


To Bernanke 1st Edition Larry Neal

https://ebookmeta.com/product/a-concise-history-of-international-
finance-from-babylon-to-bernanke-1st-edition-larry-neal/

Deconstructing Doctoral Discourses: Stories and


Strategies for Success 1st Edition Deborah L. Mulligan

https://ebookmeta.com/product/deconstructing-doctoral-discourses-
stories-and-strategies-for-success-1st-edition-deborah-l-
mulligan/

Xero : A Comprehensive Guide for Accountants and


Bookkeepers 1st Edition Amanda Aguillard

https://ebookmeta.com/product/xero-a-comprehensive-guide-for-
accountants-and-bookkeepers-1st-edition-amanda-aguillard/

The Public Speaking Playbook 3rd Edition Teri Kwal


Gamble

https://ebookmeta.com/product/the-public-speaking-playbook-3rd-
edition-teri-kwal-gamble/
Architecture Patterns with Python 1st Edition Harry
Percival

https://ebookmeta.com/product/architecture-patterns-with-
python-1st-edition-harry-percival/
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
use the “camel caps” style of naming where capital letters are used at
the start of key words e.g. “ MyFirstClass ”, or “ My1stClass ”.
The Class Type should be left as “Class” and this is the BlueJ default.
The BlueJ source code editor will open. Once you have done this an
orange box will appear in the central panel with a hatched marking
through it.

A class (an organisational unit of a Java program) is represented in


BlueJ by an orange box in the central panel. Double click on a class to
invoke the BlueJ source code editor.

If a class is shown with a hatched marking through it, then it has not
yet been compiled into Java byte code. Pressing the Compile button
will start that process.

If a class is shown in solid orange, then it has been compiled


successfully and is ready for use.

Note that BlueJ does produce some sample code when a class is
created. This sample code is not particularly useful, so we will delete
most of it. Just leave the skeleton of the class definition as shown below:

Note carefully the type of curly brackets (often called “braces ”) that
are used in the definition of the class. We will be making a great deal of
use of two types of brackets:
Braces: { and } used in the definition of chunks of code.
Round brackets: ( and ) used in the definition of statements and
method calls.
Now we will add some useful source code to make our first working
program:

This example is a complete definition of the MyFirstClass class.


The class definition is contained within a pair of braces. Everything
inside that pair of braces is a part of the class definition. To help us
remember what we are doing, we add comments to our source code.
Comments do not form part of the compiled byte code—they are there
for our benefit, and for the benefit of others reading our code.
Comments come in two types.

Multi line comments: starting with the symbol pair /* and


ending with the symbol pair */ . Any text can appear between those
pairs and can run over many lines. Here we have used a multi-line
comment to provide information about who has written the
program.
Single line comments: start with the symbol pair // . Any text
after this symbol pair up to the end of the line are treated as text
comments.

Inside the class definition we have a public method called


myFirstMethod() . A method is one of the component parts of a
class definition and represents something that the class can do (a
behaviour ). If you have previous experience of procedural
programming (e.g. using C) you will recognise this as the concept of a
function (however there is a difference between a function and a
method that we explore in Chap. 3). Note that by convention method
names start with a lower-case letter so that we can easily distinguish
them from classes. Note also that the method has a pair of round
brackets after it.
In the case of both the class and the class’ method definitions, the
keyword public simply means that the functionality is openly
accessible. We will return to the importance of the keyword void later
when we delve further into the concept of a method.
System.out.println () is a pre-defined library method that
displays text on the console. As we have not created any kind of
Graphical User Interface (GUI), our output will be simple text on the
console window. BlueJ will cause the console window to open as
required when we execute the code. You will notice that System starts
with a capital letter. This is because it refers to a class.

The System class is a programmatic representation of the Java


Virtual Machine. As Java was created as a platform independent
language, it does not readily provide any means of addressing the
underlying hardware that your program is running is running on.

If you need to communicate with the host PC, for example to display
something on the screen, or open a file, you do so by interacting with
the System class. There is only ever one System object, and you
do not need to do anything to bring it into existence. You can think of
the System object as a proxy for the JVM.

The final thing to note is the semi-colon at the end of a line of code.
This marks the end of a complete statement of Java code, a bit like the
full stop that we put at the end of a sentence when writing in English.
If you have written everything correctly, you can now press the
Compile button and the source code will be translated into Java byte
code. If you have made an error, the compiler will produce an error
message (a syntax error) and you will need to fix the problem and try to
compile again. When the source code is free from syntax errors and
compiled, you will see the message “Class compiled—no syntax errors”.
Now it’s time to run our first program. To run the program, you will
need to create an instance of MyFirstClass . To do this, right click
the solid orange box on the central panel and select new
MyFirstClass . You can then give the instance of the class a name.
Just use the default name for now. Once you have done that you a red
box will appear on the BlueJ workbench.
The red box is a Java object built from the MyFirstClass class
definition.

A Java class is a definition of an organisational unit of a Java


program. They appear as orange boxes on the BlueJ central panel.

A Java object is an instance of a Java class. An object is “instantiated”


from a Java class. We can instantiate many Java objects from the
same Java class definition.

Now that we have created a Java object, we have a functioning


program working in the memory of our machine. Now all we need to do
is to tell the object what we want to do. The object only has one thing
that it can do. We need to invoke the myFirstMethod() chunk of
code. To do this, we right click on the object on the workbench and
select the void myFirstMethod() . This will cause the console
window to open and your message will appear. Well done, you have
created and executed your first Java program!

2.2 Primitive Data Types


Now that we have looked at the basic workflow for creating and
executing a Java program, we can now delve deeper into the basics of
the procedural aspects of programming. Our first program just
displayed some text on the console window. More useful programs will
do rather more, and in particular, will allow us to store and manipulate
data. By data, we mean any type of information including, although not
limited to, numeric data, logical data, text and objects. We can view the
purpose of a program as a means of doing some useful work on data.
Data is stored in the form or variables. We start by considering the
most basic kind of data, called “primitive data ”. The term “primitive”
here is used to distinguish between data that is atomic (in the sense
that it cannot be broken down into any smaller useful units) and that
does not have the status of an object, and objects. We consider much
more about objects in Chap. 3. Java has 8 primitive types in total, 6 for
numeric data, 1 for single character data and 1 for logical or boolean
expressions. Each is characterised by a range of values that a variable of
that type can hold and the number of bytes in memory that it occupies.
The 8 primitive types are:

Type Description Size Example value


boolean True or false 1 bit true, false

byte Integer 1 byte (8 bits)


char Unicode character 2 bytes 'a', '\u0030'

short Integer 2 bytes − 3, − 2, − 5


int Integer 4 bytes − 3, − 2, − 5
long Integer 8 bytes − 3L, 0L, 4L
float Floating point 4 bytes 1.2f, − 1.2e03f

double Floating point 8 bytes 1.2, − 1.2e03


The choice of integer and floating-point types simply reflects the
range of values that each type can accommodate. In Java, all numeric
types are signed, meaning that they can take on positive and negative
values (there is no distinction between signed and unsigned types as
there is in languages such as C).
Primitive data is stored in the form of variables. To use a variable we
must declare it first. This ensures that the compiler knows how much
memory to set aside to store each variable. Java is a strongly typed
language , meaning that we must always state what kind of data
something is before we can use it. This declaration happens only once.
We can store values in the variables and manipulate those values as our
needs dictate. Note that the primitive data type keywords start with
lower case letters to remind us that they do not have the status of a
class. Primitive variables also have default values (0 for the numeric
ones and false for boolean ones).
Here are some example of primitive variables being declared and
then given some values:
You can also combine a declaration with setting an initial value:

You can manipulate variable values using an expression. Here are


some examples of valid expressions using a range of mathematical
operators .
For an expression, the right-hand side of the equals sign is evaluated
and used to set the variable on the left-hand side. Many programmers
do not care for the x = x + 2 way of writing “add two to 2”
as it resembles an impossible equation. But in practice it does not
matter—just use a style that works for you. Note that all expressions
end with the semi-colon. You can also see the quite popular “side style”
of commenting.
Variables must be declared before they are used. Failure to do so
will result in the compiler reporting an error. However, it is important
to understand that where we place the declarations of variables
determines their “ownership” under the “rules of scope ”. Variables can
be declared within the scope of a class, or within an individual method,
or indeed part of a method. The first two cases are relevant at this
stage.

A variable that is declared within the class definition, but outside the
scope of any method within that class is referred to
(interchangeably) as an instance variable , a class attribute , and a
field of a class . However, the term “class variable” is not
appropriate. We shall see in a later chapter that class variable refers
to something different. Such a variable is accessible at any point in
the source code within that class. We say that it has scope of the
class.

A variable that is declared within an individual method within a


class definition is referred to a method variable . It is accessible
only within the code for that method. When the method is not
actively executing, the variable cannot be accessed and does not
exist. We say that it has the scope of the method.

Unlike other programming languages, there is no concept in Java of


a global variable. All variables must belong to some organisational unit
of your program. We can use built in methods such as
System.out.println() to display the current value of any
variable in the console window. Here is an example method that does
exactly that:
Note the use of the + symbol in the call to
System.out.println() . Here the + symbol is called the
“concatenation operator ”. Concatenation simply means to place one
thing after another

2.3 The Procedural Programming Paradigm


Now that we know about the primitive data types, we turn our
attention to the fundamental concepts of procedural programming .
Java is an Object Oriented language, but it also has the procedural
programming concepts as its core, as do many other programming
languages. The term “procedural programming” is not entirely well-
defined, and is contentious for some academics. In the broadest terms,
it refers to a style of programming where a problem is broken down in
a set of smaller procedures, also called functions and, in Java’s case,
methods. But the term is also used to include a set of programming
code constructions (structured programming ) that deliver the minimal
requirements of a general-purpose programming language. These
constructions themselves arise from the pioneering work of Alan
Turing and his abstract Turing machine mentioned in Chap. 1.
Rather than dwell on the detailed mathematical treatments that
many purists attach to programming paradigms, we will instead
describe what is required of a general-purpose programming language
in rather more everyday terms. Suffice to say that it can be
demonstrated that a programming language is general purpose (i.e. can
perform any computable calculation) provided it exhibits 3
characteristics:
Sequence : processes one instruction after another, until all
instructions have been executed.
Alternation (also called selection ): selects one execution path
from a set of alternatives.
Repetition (also called iteration ): repeatedly executes some code
whilst some condition persists.
All general-purpose languages exhibit these three characteristics.
They may do so in different ways, and they may have other features
besides. But these other features are present only to make the language
easier to use, and they are not actually a pre-requisite for the language
being general purpose. As Java is a general-purpose programming
language, it provides (a variety of) means of delivering these core
characteristics.

2.4 Sequence
The notion of sequence from structured programming is simply the
idea that instructions are executed in a given reliable order i.e. from
start to finish. It is up to the programmer to determine what the correct
sequence is to achieve the intended result. This idea contrasts with the
concept of declarative programming, where the user simply states what
their requirements are, and the order of these declarative statements is
unimportant.
The only additional aspect of sequence comes from the procedural
programming paradigm, that adds the notion of a “call stack ”. This
reflects the idea that a larger program can be broken down int smaller
pieces—methods in the case of Java. One method can then call upon
another. This is also the concept behind the program design philosophy
of “task decomposition ” where a large task is broken down into a set of
smaller tasks, until each task is sufficiently simple to be understood and
implemented.
When a method calls upon another method, execution of the calling
method is parked whilst the called method is executed. Once the called
method has completed execution, control passes back to the calling
method. At any stage of the execution of the program, there is a stack of
calling methods where the order of the stack is determined by the
sequence in which the method calls took place. The following example
will help you understand this point:

Let’s imagine that we invoke method1() . We see that


method1() does some work, then calls method2() . This parks
method1() on the call stack and method2() starts to execute. Then
method2() calls method3() , parking method2() on the call
stack. Next, method3() finishes and control passes back to
method2() . We then see that method2() finishes, and control
passes back to method1() . Finally, method1() finishes. Note that
in this example the variable y is used in all three methods. But y is a
method variable, so the version in method1() is unique to that
method, and distinct from the y used in method2() and so on. In
general, “what goes inside the method, stays in the method”.
We can visualise a call stack as follows:

We shall see later that as well as passing control from one method
to another, we can pass and return values as well.

2.5 Alternation
The next element from structured programming to understand is
alteration (also known as selection ). Alternation is concerned with
selecting an execution path from a set of possible alternatives i.e.
making a choice. That choice will depend on some decision criteria, and
only one of the possible alternatives can be pursued i.e. the choices are
mutually exclusive. We can use a simple flowchart diagram to illustrate
the concept:
Here we see that we are required to evaluate a question. This
question has a boolean nature in that the answer can only be either
“yes” ( true ) or “no” ( false ). If the answer to question 1 is true
, we perform action 1. If the answer to question 1 is false , we
instead evaluate question 2. If the answer to question 2 is false , we
perform action 2. Note that is question 1 was true , we never
evaluated question 2, so the two questions here have answers that are
mutually exclusive. We could have carried on extending the chain of
questions as long as we liked. But once we find a question that
evaluates to true , the decision-making process is complete.
Alternation in Java (as in many other languages) is delivered using
if and switch statements. They are both equally expressive in that
anything that is written using switch can be re-written using if .
There are situations where it is aesthetically more pleasing to use one
over another, but this is a choice for the programmer.
The if statement takes the general form:
Note carefully the use of brackets here. The test conditions are
contained in round brackets, and the body of the statement (the code
that is to be executed if the test condition is true) is contained in braces.
Note also that there is no semi-colon at the end of the test condition
code.
We can have as many else … if sections as we like, or none at
all. We also have the option of having a final else section for an action
to be performed when no other test expression in the statement overall
evaluated as true . The test conditions are evaluated as either true
or false . Such expressions will make use of Java operators . An
operator is just a name for a symbol that performs a specific operation
on one, two or three operands and returns a result. For example, + the
addition symbol is an operator in the sense that 2 + 3 has two operands
and returns the result 5. For the if statement, we will use operators that
return values of true or false. The commonplace ones in this application
are:

Operator Meaning
== Is equal to
!= Is not equal to
> Is greater than
>= Is greater than or equal to
Operator Meaning
< Is less than
<= Is less than or equal to
&& Logical AND
|| Logical OR
Note the use of == as the equality operator . A common mistake
in learning to code is to confuse the assignment operator = with the
== equality operator. The assignment operator sets a variable to a
specific value. The equality operator tests to see whether two values
are the same or not.
The logical operators are used to combine tests together to make
more complex test conditions that depend on two or more pieces of
data. Logical AND only evaluates as true if all sub-conditions evaluate as
true. Logical OR evaluates as true if any of the sub-conditions evaluates
as true.
Here are some example if statements:
Exploring the Variety of Random
Documents with Different Content
care, except thinning out and watering; and Cos lettuces, which are
generally blanched by bending the tips of the leaves over the heart,
and tying them in that position with a bit of bast mat. Endive and
succory are blanched in the same manner, and mustard and cress
only require sowing, as they are cut for salads while in their seed
leaves. In France, lettuces are often cut for salads in their seed
leaves like mustard and cress.
Celery requires a good deal of care in its culture. The seed must be
sown in March or April, in a bed the soil of which is formed of equal
parts of loam and rotten dung. When the young plants come up,
they are transplanted into another bed of very rich soil, and when
they are about a foot high they are removed into trenches for
blanching. These trenches are made four feet apart, eighteen inches
wide, and twelve inches deep, and they are filled nine inches high
with a rich compost of strong fresh soil and rotten dung. The plants
are taken up with as much earth as will adhere to their roots; and,
their side shoots having been removed, they are set in the centre of
the trench nine or ten inches apart. As they grow, the earth is drawn
up to them, a little at a time, taking care never to let the earth rise
above the heart of the plant; and this earthing up is repeated five or
six times, at intervals of about ten days or a fortnight, till the plants
are ready for use.
The potherbs, as they are continually wanted in cookery, are much
better in a garden near the kitchen. One of the most important is
parsley, which is generally sown in a drill in February or March, and
the plants of which do not seed till the second year. Fennel is a
perennial, which, when once introduced, requires no further care,
except to prevent it from spreading too rapidly. Thyme, sage, pot-
marjoram, and winter savory, are all dwarf shrubs, which require no
care after they have been once planted. Mint, winter marjoram, and
the common marjoram, are perennials; but the sweet or knotted
marjoram, summer savory, and basil require sowing every year like
parsley.
I would not advise you to grow cucumbers or melons; but, should
you feel inclined to try your skill, you have only to have a hotbed
made like that for raising flower seeds; but with a two- or three-light
frame, remembering that it will take a cart-load of stable dung for
every light. The plants are raised in pots, and, when they are about
five weeks old, they are planted three together in little ridges of
earth made under each light. When the plants have produced two
rough leaves, the ends of the shoots are generally pinched off, and
this is called stopping the runners. When the plants come into
flower, the pollen of the male flowers should be conveyed to the
female ones, as otherwise the fruit very often drops off as soon as it
is set. Seeds for the first crop of cucumbers are sown in December
or January; but the principal crop is sown in March. The great
difficulty is to grow the cucumbers long and straight, and to keep
them green, and with a beautiful bloom. For the first purpose a brick
may be placed under the fruit, and for the second, abundance of
leaves should be left on the plant; and the ground in which it grows
should be kept quite moist, as it is found that the plant succeeds
best when it has abundance of heat and moisture, and has grown in
the shade. Melons require the same treatment as cucumbers, with
the exception of their beds being about 10° hotter; as, for example,
the seed-bed should not be less than 65°, and the fruiting-bed
should not be less than 75°.
Gourds and tomatoes should be sown in a hotbed in March, and
planted out in May, the latter against a south wall.
Mushrooms are generally grown in the back shed of a vinery or
forcing-house, in beds made of fresh horse-dung, which has lain in a
heap under cover, and been turned over several times for about a
fortnight or three weeks, till every part has thoroughly fermented. A
bed is then marked out about twelve or fourteen feet long, and five
feet broad; and, if it is on the earth, a pit is made of that size by
taking out the soil about six inches deep. The bottom of the bed
should be formed by a layer of long fresh stable manure about four
inches thick. On this several other layers must be placed of the
prepared dung, each being beaten flat with the fork, so as to make
the bed as close and compact as possible, till it is about five feet
high, when the top should be finished off like the ridge of a house.
In this state the bed should remain about a fortnight, and then some
bricks of mushroom spawn having been procured from a
nurseryman, they should be broken into pieces about an inch or an
inch and a half square, and strewed regularly over the bed, each
piece of the spawn being buried by raising up a little of the dung
and inserting it. After this, the surface of the bed must be beaten
flat with the spade, and the whole covered with a loamy soil, and
beaten quite smooth. The bed is then covered about a foot thick
with oat straw, and again with mats, and it will require no further
care for a month or six weeks, by which time the mushrooms will be
ready for the table. Care should be taken in gathering them to twist
them up by the roots, as, if they are cut off, the root, which is left in
the ground, will decay, and be injurious to the young plants.
Mushrooms may be made to grow in lawns, by procuring some
bricks of mushroom spawn, and, after breaking them into pieces
about an inch or two inches square, burying these pieces by raising
a little of the turf wherever the mushrooms are wished to grow, and
placing the spawn under it. This is sometimes done in April or May;
but if the season should be dry, the spawn will not germinate.
Others put the spawn into the ground in August, or in the first week
in September; the lawn is afterwards rolled, and no other care will
be requisite until the mushrooms are ready for gathering, which will
be in a month or six weeks after the spawn is buried.

LETTER XI.

THE MANAGEMENT OF FRUIT TREES.—PLANTING.—PROTECTING THE


BLOSSOMS.—STONE FRUITS.—FIG TREES.—GRAPES.—MANAGEMENT OF
A VINERY.—GROWING PINE-APPLES.—FORCING PEACHES AND
NECTARINES.—STANDARD FRUIT TREES.—KERNEL FRUITS.—FRUIT
SHRUBS.—STRAWBERRIES.—TART-RHUBARB.
The fruit trees in a kitchen-garden should be all trained against the
walls, and those trees which are grown as standards should be in a
separate garden or orchard. The walls are best when about eight
feet high, and they should have strong hooks or holdfasts built into
them at the top, for the convenience of supporting a wooden coping,
or of suspending mats or nets. Some persons recommend the walls
to be built on arches; but this is a bad plan, as it is of importance to
the gardener to confine the roots as much as possible to the border
within the garden. The roots of fruit trees should never go deeply
into the ground, as, if the roots are suffered to get so deep as to be
out of the reach of the air, the trees will produce more leaves and
branches than fruit. On this account care should be taken that the
soil should not be more than eighteen inches deep; and the easiest
and most effectual mode of doing this is, to dig out the border to the
depth of two feet, and put a layer of brick-bats and other rubbish
covered with gravel well rammed down to the depth of six inches,
and to fill up the remaining eighteen inches with a fine rich mould.
When a fruit tree border is in its proper state, the gardener should
always be able to show the fibrous roots of his trees by removing a
little of the earth with his hand. When the trees are planted the
roots should be carefully spread out to their full extent, and care
should be taken always to keep the collar of the plant above the
earth, as when it is buried the tree is very liable to become
cankered. As the blossoms of peaches, apricots, and nectarines
appear early, they are very liable to be injured by spring frosts, and
many plans have been devised for protecting them. All, however, are
liable, more or less, to objection, as it is extremely difficult to put up
mats without knocking off the blossoms. The best way is to have a
deep wooden coping placed on the holdfasts that were let into the
wall, with hooks in front, from which a curtain of bunting may be
suspended, which should be kept up night and day during frosty
weather; as there is quite as much danger from the sun during
frosty weather, as from the frost. In fact, in most cases where plants
are injured by frost, it is in consequence of a warm sunny day
having succeeded a severely cold night.
Peaches and nectarines are the most valuable of our wall fruit trees.
They should be grown in tolerably rich soil, but which has been
enriched with decayed leaves rather than animal manure; as, when
they are manured with dung, they are very apt to produce what are
called water shoots or gourmands, that is, strong vigorous shoots
without any blossom buds. Peach trees are generally kept in the
nursery till they are three or four years old, and they should be
removed about the latter end of October, or the beginning of
November. They are best trained in the fan manner, that is, with the
branches spread out regularly against the wall in the shape of a fan;
and, as they always bear their fruit on shoots of a year old, those
shoots must be left on in pruning, and the old wood cut out. The
pruning should be performed either in November or February; but
the trees should never be cut during a severe frost. When the fruit
has stoned it is thinned out, and never more than two should be left
growing together.
Peaches and nectarines are generally grafted close to the ground, so
as to make dwarf trees, and they are considered best planted about
twenty feet apart, with some kind of plum or cherry, grafted
standard high, placed between them.
Apricots are trained somewhat horizontally, and they bear not only
on the shoots of the last year, but on close spurs formed by the two
years' old wood. Apricot trees are very apt to have large limbs die off
without any apparent cause; but this may be prevented by covering
all the principal limbs in October with hay-bands, and letting them
remain on till all danger is over from frost. Apricot trees should be
five and twenty feet apart on the wall, as they spread rapidly, and do
not bear cutting in. The fruit should be thinned in May, or the
beginning of June.
Plum trees will bear a little manure being laid on the surface in
autumn, and slightly forked in in spring. They are trained
horizontally, and they bear on what are called spurs; that is, short
rugged-looking little branches, jutting out from shoots two or three
years old, and which will continue fruitful for several years. Plum
trees, in consequence, require very little pruning; and, in fact, as
they are apt to gum when they are wounded, they should be very
seldom touched with a knife.
Cherry trees resemble plum trees in their culture, and, when grown
against a wall, most of the kinds are trained horizontally, and their
branches kept six or eight inches apart. The morello cherry is,
however, an exception to this rule, as it requires pruning and
training, like the peach.
Fig trees should never be pruned, except to remove shoots that
cannot be trained, as the fruit is produced on the young wood at the
extremity of the branches. Fig trees should be planted thirty feet
apart, and trained horizontally, their long branches being bent
backwards and forwards, in order to make them throw out side
shoots for bearing fruit, which they will generally do where the bend
is made. Fig trees require to be well supplied with water, though
they will not grow if any stagnant water be suffered to remain about
the roots.
The pomegranate resembles the fig tree in producing its flowers only
on the points of its shoots, and on short twigs projecting from its
trained branches. Pomegranates require a rich soil; and when it is
wished to throw them into fruit, the blossoms should be shaded
during the time of expansion, as otherwise the pollen will dry up
without fertilising the stigma.
Grapes are frequently grown against a wall in the open air; and in
some cases, as, for example, by Mr. Clement Hoare, near
Southampton, with very great success. Grapes have been also
produced of excellent quality against a flued wall; that is, a hollow
wall heated by means of flues in it, as at Erskine, near Greenock;
but as, in both cases, extraordinary care is required, I would advise
you only to have a common sweet-water vine or two in your garden
on the open wall, for the purpose of using its leaves in garnishing,
and to grow vines in a vinery to produce the grapes you require for
the table.
A vinery is a common hothouse or bark stove, heated with hot-water
pipes or flues, and with a pit in the centre, which is generally filled
with tan for pines. This appears a very simple and economical
arrangement, but it has one great disadvantage; namely, that the
pines require heat at a season when the vines should be in perfect
repose, unless very early crops of grapes are desired. In other cases
the centre of the vinery is planted with peach and nectarine trees for
early forcing, the branches of the trees being trained over a curved
trellis, and other peach and nectarine trees or vines, planted in the
house, being trained against a trellis at the back. The vines for the
main crop are, however, planted on the outside of the house, in a
border prepared like that for the fruit trees, but richer; and their
stems are brought into the vinery, through holes left for that purpose
in the front wall. Several compositions have been recommended for
making a compost for a vine border; but that most approved is, two
parts of turfy loam mixed with one part of very rotten dung or
decayed leaves, one part of lime rubbish, and one part of road drift.
On the Continent they frequently bury the parts cut off the vine in
pruning, in the border, and this is said to make excellent manure.
Vines are generally not planted in the border till about a year old,
and they are best struck from cuttings of one bud or eye each, with
about half an inch of stem left above and below the eye; the cutting
is then planted in a small pot (60), and covered with soil half an inch
thick, after which the pot is plunged to the rim in a common hotbed,
or into the tan-pit in the centre of the vinery, covering it in the latter
case with a hand-glass; the object being to keep the young plant
growing in a moist heat of 60°. The young plants should be
afterwards shifted into larger and larger pots, as they require it; and
their stems, which will grow rapidly, should be trained either to a
single stick or to a framework of sticks tied together, according as
the plant is wanted to be spreading or trained to a single stem. If
the eye has been a large and healthy one, and the wood of the stem
from which it was taken firm and well ripened, the cuttings will grow
rapidly. Care must be taken to give the young plant a gentle
sprinkling of water every four or five days, and to let it have plenty
of air, and not too much heat from the bed. The water should be
given at night, and the glasses of the frame should be shut close
immediately, as the steam thus generated is found very beneficial to
the young plant. As when the plant is shifted the first time the stem,
or cane as it is called, is generally six or eight inches long, great care
must be taken not to injure either it or the spongioles of the roots in
shifting; and, as the stem or cane is of course always longer every
time the plants are shifted, additional care is required every time of
performing the operation. While the plant is in the hotbed, the wires
or tendrils, and also the weak lateral shoots, must be pinched off as
fast as they are produced.
If the cutting was made in the first week of March, and has been
properly treated, it will have a strong stem of ten or twelve feet
long, and perhaps more, by the middle of June or the beginning of
July. Many gardeners advise planting the vines out at this season, as
they say they grow more vigorously, and form better wood, with
only their stems in the hothouse, than when they are confined to the
moist close heat of the bed. Other gardeners, however, keep their
young vines in the pots till the following February, when the canes
are generally five feet long, and as thick as the little finger.
When the plants are put into the ground there should be one vine to
each hole; and, as every hole is made opposite a rafter, there is thus
one vine allotted to every sash or light. A shallow pit is made in the
ground for each vine, and, the pot being either broken with the
spade or the plant carefully turned out of it, the ball of earth
containing the roots is placed in the pit, in such a manner as to
leave the cane as nearly as possible in the same position as it
occupied when the plant was in the pot. The ball of earth is then
covered with light rich mould about two inches thick, and the stem
of the vine is brought through the hole in the wall into the house.
This is an operation of some difficulty, particularly if the cane be
long, and it is carefully wrapped up in matting or in hay-bands, to
prevent it from receiving any injury. While the vines are in pots they
are pruned, so as to leave only the main shoot, or at most two
shoots, in case one should be broken off; and in the latter case, as
soon as the main shoot has been safely introduced and attached to
the rafter, the other is removed. The side shoots are also taken off
as they appear till the main shoot has reached nearly to the end of
the rafter, when its point is pinched off, and the strongest of the side
shoots are allowed to develop themselves.
If the vine was planted in May or June the same year the cutting
was struck, and nothing else is in the vinery, it should be allowed to
remain all summer with the glasses off, and without fire heat; in
September, however, the glasses should be put on, and enough heat
applied to keep the temperature of the house at 55° or 60°, but
always giving air in the middle of the day, in order to ripen the
wood. In December, when the leaves begin to fall, the vines should
be pruned, and they should then have a season of rest, till the leaf-
buds begin to swell in spring. When only vines, or vines and
peaches, are grown in a vinery, it is easy to give this season of rest
by leaving off all fire heat, except what is necessary to keep out the
frost, till the middle of February; but, when pines are grown in the
same house, the stems of the vines are generally drawn out of the
house during part of December, January, and February, and kept on
the outside carefully wrapped up in mats and hay-bands, or laid
along the ground and covered thickly with dead leaves and straw.
The vine border should always be covered in the same manner
during frosty weather, as neither stems nor roots should ever be
exposed to a greater degree of cold than 40°. When the vines are
planted out in June, they should not be suffered to bear any fruit
that year; but, when they are not planted out till the February
following, they may be allowed to bear one or two bunches each the
following summer.
In pruning the vine great care should be taken never to cut close to
a bud or eye, but generally to cut through the stem just in the
middle of the internode or space between the buds, or at least half
an inch from the bud left. The sap of the vine rises with great force;
and if the pruning be delayed till spring, or if the cut be made too
near the bud, the sap will flow profusely, and will very seriously
weaken the plant. English gardeners call this overflowing of the sap
bleeding; but on the Continent they call it the tears of the vine.
There are three modes of pruning and training the vine; but the best
for vineries is what is called the spurring-in system. This consists in
training the plant with one long main shoot, which is always suffered
to remain, and shortening the strongest of the side shoots to one or
two eyes every winter, and removing those that are weakly, or that
grow too closely together, as the shoots left, which are called the
spurs, should always be about twelve inches apart.
The time of beginning to force grape vines depends upon the season
at which the grapes are wanted, but the usual season is February.
The cane of the vine is then taken into the house, if it has been
wintered outside, and carefully trained to the rafter, the part next
the ground being still kept wrapped round with hay-bands, and the
hole stopped close round the stem, so as to prevent the vine
receiving any check from the cold of the external air. Want of
attention to this particular is very apt to produce a disease in the
vines, which ends in what is called shanking, that is, a shriveling of
the short stems of the grapes after they have set. The vine border
has then its winter covering removed; and, after being forked over, a
coating is laid on of rotten dung, two or three inches thick; or, what
is better, a coating is laid on of turfy loam chopped up, and old lime
mortar, about two inches deep, and on that a coating of rotten dung,
two inches thick; over these may be replaced the coating of decayed
leaves a foot thick, and straw or reed mat, which was laid on the
bed during the severe frosts of winter. The grand point is, to keep
the roots and part outside the house in the same temperature as
that within, or even warmer.
When fire heat is first applied, the thermometer should be 55° at
night, and 60° or 65° in the day; but the heat should be gradually
increased as the buds begin to swell, keeping the heat at night
about 10° lower than that of the day till the flower-buds appear,
when the spurs are generally stopped about one bud beyond the
flower-bud, and the leaf-shoots, which are opposite the flower-buds,
are each stopped at a single leaf. The bunches must also be thinned,
and not more than nine or ten allowed to each vine, if trained in the
spur manner. The heat of the house should now be about 80° by
day and 70° by night, and a little air should be given for half an hour
every day, whenever it can be done without lowering the
temperature below 74°. The hot-water pipes or flues should be
frequently sprinkled with water when the vines are going out of
flower, and the grapes beginning to swell; and the grapes in each
bunch should be thinned out with a pair of scissors, and the
shoulders of the bunches tied up to allow the grapes to swell. The
house should now be at its greatest heat, viz. 85° by day, and 74° or
75° at night; air should be given freely, whenever it can be done
without lowering the temperature below 77°; and the hot-water
pipes should be sprinkled with water six or eight times during the
twenty-four hours. When the fruit begins to change colour for
ripening, this sprinkling should be left off, and air admitted freely,
even at night, whenever it can be done without lowering the
temperature too much. During the whole of the forcing, the border
should be watered with dung water; and, as soon as all danger from
frost is over, the leaves and straw should be thrown off, and the bed
slightly forked over, to admit the warmth of the sun to penetrate the
earth, and the air to reach the roots of the vines, as unless the air is
allowed to reach the roots the grapes will not set well.
If the forcing was commenced in February, the grapes will be ripe in
July and August; the Sweetwaters ripening first, the Hamburgs next,
and the West's St. Peter's and Muscat of Alexandria last. When
grapes are wished to be ripe in May or June, the forcing must begin
the first of December, and pines may be grown with the same heat
as will be required for the vines; but, when this is the case, the vines
must have an artificial winter given to them, by ceasing all fire heat
as soon as the fruit is cut, and taking off the sashes; the stems are
afterwards kept in the shade, and as cool as possible through
September and October, and they are pruned in November. When,
on the contrary, grapes are not required before September, very little
forcing is requisite; but the bunches of grapes must be carefully
thinned, and not more than ten or twelve bunches should be allowed
on each vine. When the vines are in flower and the fruit setting, the
house should be kept close, and the pipes or flues frequently
sprinkled with water; as a hot dry air makes the calyx shrivel up
before the pollen has reached the ovary, and, when this is the case,
the grapes will be small and frequently without stones.
It would take too much space to explain to you the other methods of
training and pruning, and I need only say that the long method,
which is the only one except the spur system in general use, consists
in cutting out the old wood every second year, and supplying its
place with wood of the previous season's growth.
You will thus see that the principal points to be attended to in the
culture of the vine are:—1. To prune the plants so as to prevent
them from forming too much wood, but not to cut too near the
buds; 2. To keep the roots and collar of the plants, when forcing
begins, at the same temperature, or nearly so, as the upper part of
the stems; 3. To admit air to the roots as soon as all danger is over
from frost; 4. To thin both the branches and grapes properly and in
due time; 5. To keep the air of the house moist when the fruit is
setting and swelling; and 6. To give the plants a proper season of
rest.
Pines are propagated by crowns, that is, the bunch of leaves on the
upper part of the fruit; or suckers which form by the side of the old
plant. These are potted in small pots in proportion to their size, in a
soil composed of seven eighths of pure loam and one of silver sand;
and plunged about two thirds of their depth into a bed of tan, at the
heat of about 95° in the bed, and the usual heat of a forcing-house
in the atmosphere, if grown in the vinery. Young plants are
sometimes grown without pots in propagating-pits; from which they
are transferred, after being repotted, to what are called succession
pits; and, after remaining there a long time, they are either removed
to the tan-pit in the vinery to fruit, or to fruiting-pits. I shall not
attempt to give you directions for their culture during all these
changes, which take up a great deal of time; Jamaica pines being
two years before they are ready to cut, Providence pines about
twenty or two and twenty months, and Queen pines sixteen or
eighteen months. Your only chance of growing pines is, therefore,
not to have them till they are put into fruiting-pots; these are
plunged into the tan-pit in the vinery in February or March, when the
forcing of the vines begins; and afterwards they will require no other
care than watering them frequently, and keeping the atmosphere
moist, to make the fruit swell. Pine-apples are sometimes grown
without pots, in peat soil, through which pipes of hot water are
carried so as to heat the earth to 95°, while the atmosphere is kept
moist, and decayed leaves are laid on the surface and drawn up
round the plants. In this way, Queen pines have been grown to the
size of five or six pounds, and New Providence pines from twelve
pounds to fifteen pounds.
When peaches are forced in a vinery, the trees should be three or
four years old before they are put into the house. The best kinds
are, the Grosse Mignonne, the Royal George, the Bellegarde, and the
Late Admirable; and, where only one kind is wanted, the Bellegarde
is preferred, as it is not so liable to the mildew as the others. The
best kinds of nectarine for forcing are the Elruge and the Violette
hâtive. If the forcing begins in December, the fruit will be ready in
May. The leaves should be frequently syringed with water at the
temperature of the house; and, in other respects, the culture is the
same as for peaches in the open air, and the forcing the same as for
vines. The greatest objection to growing peaches in a vinery is, that
the shade thrown by the leaves of the vines prevents the proper
colouring and flavouring of the fruit.
Standard fruit trees should never be planted in a kitchen-garden, as
from their drip and shade it is impossible to grow good culinary
vegetables under them; while, on the other hand, the constant
digging and movement of the soil required for culinary vegetables,
make the roots of the trees descend so far that they get beyond the
reach of the air, and can never produce good fruit. Dwarf standards
are fruit trees grafted near the collar of the plants, and trained in
various ways to form bushes rather than trees. Sometimes a hoop is
placed inside, and the branches are trained into a cup-shape; at
others, the branches are formed into a kind of umbrella; and, at
others, they are trained into the shape of a distaff (en quenouille),
or like a pyramid. All these and many other modes of training dwarf
standards may be seen at the London Horticultural Society's Garden
at Chiswick: but only pears, apples, and dwarf cherries are treated in
this manner; and, though they are convenient to gather the fruit
from, they are in so unnatural a state as to be subject to canker and
other diseases, and seldom live long. Espalier trees are subject to
the same objections, as they are in a still more unnatural state than
dwarf standards. The hardy kernel and stone fruits are therefore
best grown in an orchard, and I shall now say a few words on their
treatment.
Apples are the most useful of all fruits, and there are three distinct
kinds, the dessert or eating apples, the kitchen or baking apples
which fall or become soft in cooking, and the cider apples which are
good for nothing but cider. Apple trees are generally grafted on crab
stocks; and, when they are planted, the collar should be raised a
little above the soil, as if it is buried the tree will very probably
become cankered, or affected with the American blight. Canker is
sometimes cured by cutting out the cankered part, and admitting air
to the roots; and the insect called the American blight may be
removed by washing the tree with a brush and soft soap and warm
water, or by plastering it over with a mixture of stiff clay and water.
Pear trees are very apt to send their roots down to a great depth,
and then cease bearing; so that it is desirable to keep the roots near
the surface by mulching with manure or dead leaves. The fruit is
produced on spurs, and when pear trees are grown against a wall
they are trained horizontally, with short projecting branches or spurs.
Pear trees against a wall are very apt to bear their fruit in clusters,
and to leave a great part of the tree barren; and this arises from
their flowers having naturally very little pollen, and, where the
flowers are exposed to great heat, the pollen drying up without
fertilising the stigma. The best remedy is to syringe the branches
occasionally, and to shade them when in blossom.
The quince thrives best near water; as does the medlar. Mulberry
trees are best planted on a lawn, for the convenience of picking up
the fruit clean from the grass; as it falls as soon as it is ripe. Plums
and cherries require no particular care when grown as standards,
except to be sparing in the use of the knife, as both trees, when
wounded, are very apt to produce gum; and this, which is an
unnatural exudation of the sap, similar to the bleeding of the vines,
is very injurious to the trees.
The almond is a kind of peach tree, with a leathery fruit instead of a
juicy one, the almond being the kernel of the stone. The bitter
almond abounds in Prussic acid; but this powerful poison scarcely
exists in the kernel of the sweet variety. Almond trees are generally
grafted on plum stocks; and they should be grown in a dry soil and a
sheltered situation, as the branches are brittle and apt to be broken
off by high winds. When almond seeds are sown, the sharp end
should be pressed downwards; and the young plants should not be
transplanted except when absolutely necessary, as they have very
long tap-roots. When the almond is planted for ornament it should
have a back-ground of evergreens, as its flowers appear before its
leaves.
The walnut, being a spreading tree with large leaves, should only be
planted where no injury will be sustained by a deep shade being cast
upon the ground; but it must be observed that its leaves are disliked
by all cattle, and are injurious to cows. In pruning it the tips of the
branches should be taken off, to make them throw out fruit-bearing
shoots.
Sweet chestnuts are always propagated by seeds, and never grow
well unless the soil contains a portion of sand. The wood is
worthless when old. Both walnuts and chestnuts are generally
planted in the park.
The fruit shrubs grown in gardens may be considered to include the
elder, the berberry, and the filbert, though these are frequently
called trees. The elder and the berberry will grow anywhere, and
require no particular care in their culture; the filbert is only a variety
of the common hazel, and both are generally grown on the borders
of walks, where they are planted from five to ten feet apart,
according as they are to be trained upright or spreading. As the fruit
is produced on the young shoots, the bush should be kept open and
trained in the cup fashion, in order that the main branches may
throw out short young wood. Filberts are propagated by sowing the
seeds; and hazel trees by suckers, which they throw up in
abundance.
Gooseberries are generally propagated by cuttings, which strike
easily; and they should be grown in soil which is well drained, and
well manured by a coating of rotten dung being laid upon it every
third year. The bushes should be planted in rows eight or ten feet
apart, the plants being about six feet from each other. They should
be pruned twice a year; in the winter to remove the branches not
likely to produce fruit, and early in summer to remove those shoots
that are not likely to ripen. The fruit is produced partly on the old
and partly on the young wood, and it should be thinned when
gathered green for pies and puddings, by taking only a few from
each bush, instead of gathering all that may be wanted from one.
Currants are raised from cuttings generally about a foot long, all the
buds from which are taken off, except five or six at the top; and the
cutting is then firmly fixed in the soil about six inches deep. The
currant bears chiefly on spurs of the old wood, so that these only
are generally left in the winter pruning. The currant is very hardy,
and will grow in any soil or situation, even under the drip of trees.
Raspberries always bear on the young shoots, so that the art of
pruning them consists in cutting out the old wood. They are
propagated by suckers, and thrive best in a light rich soil, and an
open situation.
The cranberry is generally grown in moist soil or peat earth; but it
may be grown in beds in the common garden like the strawberry.
When cranberries are once planted they require no after care,
except removing the runners when they extend too far.
Having now, I believe, told you a little, though I confess not much,
of all the kinds of trees and shrubs usually grown in this country for
their fruit, I have only to say a few words of strawberries and tart-
rhubarb, and then I think I shall have given you all the information
you will require for so small a garden as yours.
Strawberries are rather difficult plants to give directions for, as they
succeed apparently equally well with different kinds of treatment. It
is certain, however, that they like a deep rich soil, well manured; and
that, when a new strawberry bed is planted, the ground should be
trenched at least two feet deep, and a good deal of rotten dung (the
dung from an old hotbed is best) should be mixed with the soil.
Some persons make fresh strawberry beds every year, and some
every third year; but strawberry beds will continue to produce for
ten or twelve years, if a thick coating of decayed leaves be put on
the bed every winter, and their remains forked into the bed in spring.
When a new bed is to be formed, the strongest runners should be
selected from the old plants; and they may be planted in beds
containing three rows each, eighteen inches apart, the plants being
about twelve inches apart in the line. Alpine strawberries may be
raised from seed, and will fruit the first year. The Pine is an excellent
strawberry for flavour, but Keen's seedling is the best for general
use. The Hautbois requires a great deal of manure, and, as the male
and female flowers are on different plants, nearly one half the plants
in a bed are unproductive. Strawberries grow very well on banks
facing the south or south-east, or on little terraces supported by
walls, but in these situations they must be regularly watered twice a
day. Strawberry plants never produce good fruit unless they have
abundance of leaves, as shade is essential to the fruit being juicy
and of a good flavour. Most gardeners take off the runners in August
or September, and plant them in nursing beds for the winter,
transplanting them to their proper beds in March.
Tart-rhubarb is propagated by seed or by division of the root, but the
former method is generally considered the better. When beds of
rhubarb are to be formed, the soil should be deeply trenched and
richly manured, and the seed then sown in drills two feet apart for
the scarlet rhubarb, and three feet apart for the larger kinds. When
the plants come up they should be thinned out so as to leave the
plants about the same distance apart as the rows are asunder. A few
leaves may be gathered from each plant the second year, but it is
generally considered to strengthen the plants if no leaves are
gathered from them till the third year. Rhubarb may be forced in the
open garden by putting pots over it, in the same manner as is done
for sea-kale; or the plants may be taken up and potted, after which
they may be placed in the kitchen near the fire and covered with
matting or old carpet, being watered every day with warm water.

LETTER XII.

OPERATIONS OF GARDENING.—DIGGING, FORKING, AND HOEING.—


SOWING SEEDS.—TAKING OFF SUCKERS.—MAKING LAYERS AND
CUTTINGS.—BUDDING, GRAFTING, AND INARCHING.—PRUNING AND
TRAINING.—DISBUDDING.—MANURING.—KEEPING FRUIT IN A FRUIT-
ROOM.

Digging is the first operation necessary in gardening, as nothing can


be done in the way of cultivating the soil till it has been first
pulverised, so as to allow the fine delicate roots of the plants to
penetrate among its particles. It is also necessary that the air should
have access to the roots of plants, as they depend for their
nourishment almost as much on the carbon and other elements
which they absorb from the air, as on those which they obtain from
the soil. On this account it is necessary, not only to dig the soil well
before any thing is planted in it, but also to fork it over occasionally
whenever its surface becomes hardened and impervious to the air
and rain. When manure is applied also, it is customary to dig it into
the soil; and ground is occasionally trenched in order to bring up
fresh soil to the surface, whenever the surface soil appears to be
exhausted and to want renewing. The operation of digging requires
considerable strength, as it requires first to be able to force the
spade into the ground, and then to raise as much earth as will lie
upon the blade and turn it over. It is, however, a fine healthy
occupation, not only from its calling the muscles into vigorous
action, but from the smell of the new earth being particularly
invigorating; and you might have a lady's spade, with a smooth
willow handle, that will enable you to dig a small bed without much
difficulty. You will be surprised, however, to find, if you try the
experiment, that there is an art in digging as well as in every thing
else; and that it is extremely difficult, both to dig in a straight line,
and to make the ground look even tolerably level after it has been
dug over. Raking, though it appears so simple, also requires
considerable skill to make the ground look smooth and perfectly
level. Forking is not so difficult, as it merely requires to have the fork
pressed into the ground, and then pulled backwards and forwards,
so as to loosen a portion of the soil without turning it over.
There are two sorts of hoes: the draw-hoe, which is used for
drawing up the earth to any plant that is to be earthed up; and the
thrust-hoe, which is principally used for destroying weeds. There are
many varieties of both these forms, but the common kinds, I think,
you will find the best. The most useful instrument, however, for you
will be a trowel, and this you will find indispensable, as, without it,
you will not be able either to transplant or pot a single plant. Some
persons use what is called a transplanter, to enable them when they
take up a plant, to remove it without disturbing the roots; but, as far
as my own experience goes, I think these instruments are more
troublesome than advantageous, and I prefer using a trowel. You
will also want a budding-knife, and a sharp knife for making
cuttings; and you will find a pair of pruning-shears with a sliding-
joint extremely useful for cutting off dead wood, or removing any
badly-placed branches.
Plants are propagated either by seed, or by division. When they are
to be propagated by seeds, the ground must be either dug or forked
over and made level. It is then firmed by beating it with the flat part
of the spade, rolling it, or in any other manner; and the seeds are
scattered over it, if they are to be sown broad-cast, and covered
with earth the same thickness as themselves. When seeds are to be
sown in drills, a narrow furrow must be made, by drawing a stick
along the ground in a straight line, or in any other way so as to
make the bottom of the furrow firm, and the seeds must be dropped
into it at regular distances. The furrow is then filled in, so that the
seeds may be covered to the same depth as their own thickness;
and the earth is slightly pressed down, and afterwards raked over.
Larger seeds are sown in separate holes made by a dibber, as are
the sets of potatoes; but the after processes are the same in all.
Bulbs and tubers are also planted in the same manner; taking care
that the eyes of the tubers are uppermost, and the flat part of the
bulbs downwards. In planting Ranunculus tubers the claws should
be downwards, and if any are broken they should be cut off smooth
with a sharp knife.
There are several ways of propagating plants by division, viz. taking
off suckers, making layers and cuttings, and budding, grafting, and
inarching.
Propagation by suckers is very simple. Many plants have a portion of
their stems under ground, from the buds in which new upright stems
rise into the air and fibrous roots descend into the ground. It is thus
only necessary to divide the horizontal underground stem by the
spade, or by opening the ground till the stem is found, and then
cutting it through with a knife, and to take up the young plant which
has sprung from it carefully and without injuring its roots, cutting off
the remains of the old plant before the new one is replanted.
Suckers sometimes spring from the collar of the old plant, and when
this is the case they require more care in removing them, to avoid
injuring the plant from which they spring.
Runners are suckers proceeding from horizontal stems above
ground, and offsets are the suckers of bulbs, as they proceed either
from the root-plate, which is the compressed stem of the hyacinth,
or from the main body of the corm, which is, in fact, the stem, as in
the crocus.
Layers are produced by imitating the process of nature in making
suckers; as, in making layers, a joint of the upper stem is buried in
the ground, and kept moist to induce it to throw out roots; the
buried stem being generally slit or twisted at the joint, so as to
prevent the return of the sap, and to occasion it to expend itself in
roots instead of circulating in its ordinary way through the branch.
As soon as a layer has produced roots it becomes the same as a
sucker, and may be treated in exactly the same manner.
Cuttings are portions of a plant cut off just below a bud, and buried
in the earth to induce them to throw out roots; which is done most
effectually by exposing them to warmth and moisture, and shading
them from the light, as that has a tendency to draw the sap towards
the leaves, whilst warmth and bottom heat dispose the cuttings to
throw out roots. On this account cuttings always strike most readily
when the pots, in which they are planted, are plunged into a hotbed,
and covered closely with a hand-glass. It must be observed in
making cuttings, that they ought in most cases to consist of two
buds; from the lower one of which the new roots are to spring, while
the upper one is to produce the stem of the new plant. Cuttings
must always be made quite firm at the base; and they generally
strike most readily when the bottom of the cutting, which is cut
through a joint and quite flat, rests against a piece of the drainage,
or even the bottom of the pot, being in both cases pressed so
closely against its earthenware support as to exclude the air. When a
cutting is made, most of the leaves are removed, as the evaporation
from them is greater than the plant can support while it is without
roots. Cuttings of succulent plants are generally laid upon a shelf to
dry before they are put into the ground, as if this is not done the
wounded part is apt to become rotten, and to decay. Cuttings are
generally struck either in sand or very light earth, in order that the
young roots may meet with as little obstruction as possible.
Pipings are portions of pinks and carnations pulled asunder at a joint
instead of being divided with a knife, and afterwards planted, and
treated exactly like cuttings.
Budding is taking off a single bud or eye, called a scion, from one
plant, and inserting it in another plant called the stock. This
operation is generally performed in July or August. In the first place,
a slit is made on each side and above and below a leaf which has a
healthy bud in its axil, that is, just between the foot-stalk of the leaf
and the branch on which it grows. The bark of the branch containing
the bud and the leaf is then detached from the branch, by passing
under it the bone handle of the budding-knife, which is made flat
and thin on purpose, and raising it gradually up. If the bark has
been raised carefully and properly, there will generally be a little bit
of wood just under the bud, which must be carefully taken out, so
that not the smallest particle of wood is left on the under side of the
bark. A long slit is then made in the bark of the stock, with a cross
slit at the top, and, the bark being gently raised at each of the
corners made by the intersection of the long slit and the horizontal
slit, the piece of bark with the bud attached is carefully introduced
under the bark of the stock, which is closed over it, and bound
tightly with a bit of bast mat, in order that the bark containing the
new bud may be pressed as closely to the wood of the stock as
possible. If the operation has been properly performed and the bud
was a healthy one, it will soon begin to swell; and, when it does so,
it will push off the foot-stalk of the old leaf that was taken off with it,
so that when this foot-stalk falls it is a sign the bud has taken. When
the bud has developed itself into leaves, the ligature should be
loosened to allow the branch of the stalk to expand. The operation
of budding requires a good deal of nicety: first, to avoid wounding
the wood of the stock in slitting the bark; and, secondly, to make the
bark of the scion fit quite closely to the wood of the stock, as, if the
least vacuity is left between them, the bud will wither instead of
beginning to grow.
Grafting differs from budding, in the scion consisting of several buds
instead of one. It is also performed at a different time of the year;
as March and April are the proper seasons for grafting, whereas
budding is never performed till after Midsummer. In grafting,
sometimes the head of the stock is cut off, and sometimes only the
branch, and the scion is selected according to the size of the part to
which it is to be attached. When the scion and the stock have been
both chosen, they are cut slantingly, so that one may fit into the
other; and care being taken that the bark and soft wood of the two
unite, at least on one side, the two pieces are bound together, and
the ligature is covered with what is called grafting clay, that is, a
mixture of stiff clay, with a fourth part of fresh horse-dung, and a
small quantity of cut hay. Another kind of grafting clay is composed
of equal parts of stiff clay and cow-dung. It is of very little
consequence whether the scion and the stock are of the same
diameter, provided they are so cut and fitted, as to leave no vacuity
between them, in those parts where the union is to be effected; and,
to keep them quite closely attached to each other, it is customary to
form a tongue, or little projecting part, by making a slanting cut in
the scion, and to make a corresponding slit in the stock to receive it.
There are several kinds of grafting; but that which I have described,
and which is called whip or tongue grafting, is the most common,
and it is always performed with the firm or ripened wood. There is,
however, another kind of grafting, now becoming common in the
nurseries, which is performed with the young, or unripened wood,
and this is called herbaceous grafting, because the parts of the stem
with which it is performed are as succulent as the stems of
herbaceous plants. In this kind of grafting, the shoot of the stock is
broken off about two inches below the point, and all the leaves are
taken off except two, one on each side, which are left to draw up
the sap. The stock is then split with a very sharp knife between the
leaves left on it; and, the base of the scion having been cut into a
wedge-shape, it is fixed into the cleft made in the stock, which is
bound tightly up with strips of cerecloth, or coarse cotton cloth
covered with grafting wax, made of equal parts of turpentine, bees'
wax and rosin, with a little tallow, melted together. Sometimes
plants, especially camellias in pots, are grafted in this manner, and
placed in a hothouse under hand-glasses, and the pot surrounded
with moss, to keep the cutting as close as possible. This mode of
grafting is of French origin, and it is called la greffe etouffée.
Inarching bears considerable resemblance to layering, as it is
performed without separating the part which is to form the new
plant. A branch is bent from a living plant, and partly cut through,
and, the tongue thus formed being introduced into a slit made in
another plant, the two are bound closely together. It is obvious that
this mode of grafting, which is called inarching, can only be
practised with plants in pots, as it requires the two plants that are to
be united to be brought close together, and to remain so till the graft
has taken effect.
You must observe that, in all kinds of grafting and budding, there
must be a considerable degree of resemblance between the scion
and the stock, for the graft to take effect. Thus, though one stoned
fruit may be grafted on another, such as the almond or peach on the
plum, a stoned fruit cannot be grafted on a kerneled fruit, such as a
plum on an apple or a pear. In the like manner, an apple cannot be
grafted on an orange, which was formerly supposed to be done, to
produce a pomegranate; nor a rose on a black currant, which it was
formerly believed would produce a black rose. It is true that plants
are sometimes sold in Italy which appear to have been unnaturally
grafted, such as a rose upon an orange; but it will be found, when
closely examined, that the pith of the orange has been artfully
scooped out, and the stem of the rose tree introduced into the
hollow space thus formed, through a hole made in the stem close to
the root. In this way the two plants may appear to be one for some
time; as the stem of the orange tree will live and produce leaves two
or three years after the pith is removed, provided the operation has
been performed carefully.
The other operations of gardening are pruning and training, and, as
I have already spoken of these when treating of the different trees, I
have only to add here that the great art in pruning is to give a clean
sloping cut without bruising the bark, as nature will make an effort
to cover the wound if the edges of the bark are left in a healthy
state. The use of a sloping cut is, to prevent the water from lodging
on a wounded part. Trees should never be cut in a hard frost; and as
little as possible in summer, as every branch taken off while the plant
is in a growing state excites it to make fresh efforts to throw out
new shoots. Many persons look over their trees in summer, and rub
off all the buds which they think likely to produce useless shoots;
and this practice, which is called disbudding, is a very good one, as
it prevents the tree from wasting its strength unnecessarily. The
principal object to be attained in training a fruit tree is, to make the
plant produce as much fruit as possible; and for this purpose the
branches are bent backwards and forwards to cause obstructions in
the sap, as it is only from places where there is an accumulation of
sap that flowers and fruit are produced. Another object in training
standard trees is to let the air into the centre of the tree, so that it
may ripen the wood; and a secondary object in training trees against
a wall is, that every part of the wall may be covered.
I cannot quit the subject of gardening without saying a few words
on manures. The object of manuring ground is, to supply the soil
with certain properties which are necessary for the nutrition of the
plants, and this is done partly by mixing with it some kind of animal
or of vegetable manure, and partly by adding some earth, in which
the soil of the garden may be deficient. The new manures which
have lately been so fashionable are of both kinds: guano is the dung
of sea birds, which has been accumulating for ages on islands off
the western coasts of Africa and South America; and nitrate of soda
and Humphrey's compound are mineral substances which are very
efficacious in promoting vegetation. The best vegetable manure is
formed from decayed leaves, and this is a manure which may always
be used with perfect safety; whereas the others are very injurious if
used in too huge a quantity.
No kind of animal manure should be used in a garden (except for
making hotbeds) till it is thoroughly decayed and all fermentation is
gone off; as while it is in process of decay the gases it evolves are
decidedly hurtful to plants. Those manures which abound in
nitrogen, such as stable manure and the dung of birds, are the
strongest and most dangerous; as if used incautiously they will
blacken and shrivel up the leaves of the plants to which they are
applied. Guano and pigeon's dung are very much alike in their
properties, and both are of an extremely caustic nature; so that they
should only be used in very small quantities, or be very much
diluted. One ounce of guano to a gallon of water is a common
proportion; or the guano may be mixed with six or seven times its
own bulk of loam, peat, or charcoal, and dug into the ground before
the crops are sown: if applied afterwards as a top dressing, it should
be either in wet weather, or the soil should be well watered.
Charcoal is very efficacious in some cases, but it appears variable in
its action; as sometimes it produces scarcely any effect. Nitrate of
soda and saltpetre act principally by supplying a particular kind of
earth to plants that are in want of it, and of course will not suit all
plants; but they are also of service in keeping the earth moist, and
this, when not carried to an excess, is always useful.
When it is wished to keep plants constantly in a growing state, the
soil should be rendered rich, and the plants should also be watered
frequently, so as never to suffer the soil to become quite dry; equal
care being taken to keep it free from stagnant water, which would
rot the roots. When, however, the plant is to be hardened, to stay
out the winter, it should be kept as dry as possible, and no manure
should be applied for some time previously to the cold weather
setting in. Nothing is less generally understood than the use of
manures. They are in fact food; and should not be given to plants in
excess, any more than children should be crammed with food.
Starving and repletion should both be carefully avoided; and the
great art of the cultivator is shown in supplying plants with food only
when they need it. Too much water will sometimes produce leaves
and stems instead of fruit and flowers; and shoots of great
luxuriance very frequently do not ripen, and are killed by the first
frost.
After telling you how to grow fruit, I must next tell you how to keep
it. A proper fruit-room should be fitted up with broad shelves, or
wooden trays with rims in front to prevent the fruit from falling off,
and divided into compartments for the different kinds. There is
generally a large table in the centre for sorting the fruits, and a
thermometer should be hung on one side to regulate the
temperature. According to Dr. Lindley, the essential points for a fruit-
room are, "a low and steady temperature; dryness to a certain point,
for apples are found to keep best in a rather damp atmosphere; and
exclusion of the external air:" to this he adds, that it is necessary to
keep the fruit in comparative darkness, to prevent it from becoming
shriveled and ripe prematurely; that the temperature of the room
should not be much above 40°; and that the shelves should be of
white deal, as that wood does not give an unpleasant taste to the
fruit.
Fruits keep best when laid separately, so as not to touch each other;
and sometimes pears may be kept by packing them in fern, and
grapes by packing them in jars in sawdust. Walnuts and chestnuts
should be kept in rather a moist place, and covered with fern to
exclude the air as much as possible, as they are much injured if they
are kept too dry.
I may here mention that when sweet chestnuts are sent to the table,
they ought always to be boiled first, and roasted afterwards; as, if
roasted without previously boiling, it is scarcely possible to cook
them sufficiently to make them wholesome, without burning them.
After they have been boiled, before they are put down to roast, care
must be taken to prick the skins; as, if this is neglected, the
chestnuts will fly about in all directions as soon as the outer skin
becomes parched.

BOOK III. DOMESTIC ANIMALS.

LETTER XIII.

QUADRUPEDS KEPT FOR AMUSEMENT.—HORSES FOR RIDING AND


DRIVING IN PONY CARRIAGES.—MULES, ZEBRAS, QUAGGAS, AND
DONKEYS.—DOGS AND CATS.
I am delighted, my dear Annie, to find that you are fond of riding.
There is something noble and invigorating in the exercise. If your
horse is tractable and docile, you will soon begin to consider him as
your friend; and if he is refractory, you will feel a pride in being able,
by skill, to conquer a powerful being possessing strength so superior
to your own. I like to see a lady ride well and fearlessly; and, in
short, the only drawback I can find to the pleasure your letter gave
me is, the somewhat mysterious malady of your horse, on which you
consult me. You say that, though a fine spirited creature when you
are on its back, it appears dull and stupid when first brought out,
and that it shuffles against things as if it were half-blind. You say
you have consulted a veterinary surgeon, who says that there is no
disease in the eyes, so that I suspect the evil lies where you have
probably never thought of looking for it, viz. in the stable. If your
stable is dark, the mystery is explained at once; and I think it is very
probable that this may be the case, as you tell me that your horse is
kept in a stable apart from the rest, that it may be taken more care
of.
I believe, indeed, that more of the diseases of horses depend on the
stable than is generally imagined. If the stable be dark the eyes are
affected; and if it be damp the horse is liable to catch cold; and
coughs, inflammation of the lungs, and finally broken wind, are the
results. Another evil in many cases arises from the stable that you
would not readily think of, and that is, if the doorway is too small
and the posts on each side of it sharp-edged, the hair of the horses
is frequently injured in going in and out. Horses are, in fact, much
more delicate than is generally imagined, and many of the diseases
with which they are afflicted arise from a want of proper attention to
their comforts. On this account, the first thing in the management of
a horse is, to see that its stable is spacious, light, well aired, and dry.
In attending to the latter point, however, care should be taken that it
is kept dry by a drain in the centre and at the back of the stall, and
that the paving is as nearly level as possible. It has for some years
past been the fashion to make the pavement of stables slope so
considerably towards the door that the horse's fore-feet stand much
higher than his hind feet; and this is not only a most uncomfortable
position for a tired horse, but it is very apt to bring on diseases in
the fore-feet and legs. It is also of great importance that the stalls
should be large enough to allow each horse room to turn himself,
and to lie down comfortably in any position he may fancy. We all
know what a comfort it is when we are tired, to stretch ourselves out
how we like; and a hunter turned into a loose box, after a hard day's
work, will often be found lying with his legs stretched out like a dog,
instead of having them doubled under him as horses are obliged to
sleep when confined in narrow stalls.
It is a great advantage when there is a wide space between the
stalls and the door, as it prevents the wind from blowing directly
upon the horses every time the door is opened. It is also best not to
have the stable in an exposed situation, but to have it so placed that
it may be sheltered by some other building from the north and east
winds. The loftiness of the stable is another very important point. It
is the custom in many places to have the hay-loft over it; but this is
bad in every point of view, as it not only makes the ceiling of the
stable low, and by confining the air renders the horses liable to take
cold every time the door is opened, but the dust and seeds from the
hay are apt to fall from the loft whenever the horse is supplied with
hay, and to injure him by getting into his eyes. I am fully aware
when I am saying this, that you can neither alter the position of your
stables nor make them larger, without more expense being incurred
than your husband would perhaps approve of. I do not, however,
think that he would object to having an additional window made, or
to adding to the height of the stable by removing the floor of the
loft, particularly if there be any small room adjoining the stable in
which the hay can conveniently be kept.
A great deal, also, may be done by cleanliness. Whenever the horse
is out, the stable should be thoroughly cleaned and the windows
opened, and whenever there is an opportunity the rack and manger
should be well cleaned and scoured with a brush. It is, however,
important that the stable should be dry when the horse returns to it.
In some places stables are warmed by flues or hot-water pipes, or

You might also like