0% found this document useful (0 votes)
21 views83 pages

Beginning C Object Oriented Programming 2nd Edition Dan Clark - Discover The Ebook With All Chapters in Just A Few Seconds

The document provides information about the book 'Beginning C# Object-Oriented Programming, 2nd Edition' by Dan Clark, including details for downloading the ebook and its contents. It covers various topics related to object-oriented programming, including class structures, the .NET framework, and application development. Additional suggested ebooks on related subjects are also mentioned with download links.

Uploaded by

koskustennet
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
0% found this document useful (0 votes)
21 views83 pages

Beginning C Object Oriented Programming 2nd Edition Dan Clark - Discover The Ebook With All Chapters in Just A Few Seconds

The document provides information about the book 'Beginning C# Object-Oriented Programming, 2nd Edition' by Dan Clark, including details for downloading the ebook and its contents. It covers various topics related to object-oriented programming, including class structures, the .NET framework, and application development. Additional suggested ebooks on related subjects are also mentioned with download links.

Uploaded by

koskustennet
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/ 83

Visit https://ebookultra.

com to download the full version and


explore more ebooks

Beginning C Object Oriented Programming 2nd


Edition Dan Clark

_____ Click the link below to download _____


https://ebookultra.com/download/beginning-c-object-
oriented-programming-2nd-edition-dan-clark/

Explore and download more ebooks at ebookultra.com


Here are some suggested products you might be interested in.
Click the link to download

An Introduction to Object Oriented Programming with Visual


Basic NET 1st Edition Dan Clark

https://ebookultra.com/download/an-introduction-to-object-oriented-
programming-with-visual-basic-net-1st-edition-dan-clark/

Object Oriented Programming in C 4th Edition E.


Balagurusamy

https://ebookultra.com/download/object-oriented-programming-in-c-4th-
edition-e-balagurusamy/

Beginning C Game Programming 2nd ed. Edition John Horton

https://ebookultra.com/download/beginning-c-game-programming-2nd-ed-
edition-john-horton/

Java the UML way integrating object oriented design and


programming Else Lervik

https://ebookultra.com/download/java-the-uml-way-integrating-object-
oriented-design-and-programming-else-lervik/
Scala Cookbook Recipes for Object Oriented and Functional
Programming 1st Edition Alvin Alexander

https://ebookultra.com/download/scala-cookbook-recipes-for-object-
oriented-and-functional-programming-1st-edition-alvin-alexander/

Applying UML and Patterns An Introduction To Object


Oriented Programming 2Ed Edition Larmen

https://ebookultra.com/download/applying-uml-and-patterns-an-
introduction-to-object-oriented-programming-2ed-edition-larmen/

Introduction to Programming with Greenfoot Object Oriented


Programming in Java with Games and Simulations 1st Edition
Michael Kolling
https://ebookultra.com/download/introduction-to-programming-with-
greenfoot-object-oriented-programming-in-java-with-games-and-
simulations-1st-edition-michael-kolling/

Java Methods Object Oriented Programming and Data


Structures Third AP 3rd AP Edition Maria Litvin

https://ebookultra.com/download/java-methods-object-oriented-
programming-and-data-structures-third-ap-3rd-ap-edition-maria-litvin/

Foundations of Object Oriented Programming Using NET 2 0


Patterns 1st Edition Christian Gross (Auth.)

https://ebookultra.com/download/foundations-of-object-oriented-
programming-using-net-2-0-patterns-1st-edition-christian-gross-auth/
Beginning C Object Oriented Programming 2nd Edition
Dan Clark Digital Instant Download
Author(s): Dan Clark
ISBN(s): 9781430249368, 1430249366
Edition: 2
File Details: PDF, 3.78 MB
Year: 2013
Language: english
Beginning C#
Object-Oriented
Programming
Second Edition

Dan Clark

Apress
Beginning C# Object-Oriented Programming
Copyright © 2013 by Dan Clark
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.
Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material
supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the
purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the
Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from
Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are
liable to prosecution under the respective Copyright Law.
ISBN 978-1-4302-4935-1
ISBN 978-1-4302-4936-8 (eBook)
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, logo, or image, we use the names, logos, and images only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified
as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither
the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may
be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
President and Publisher: Paul Manning
Lead Editor: Gwenan Spearing
Technical Reviewer: Todd Meister
Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Louise Corrigan, Morgan Ertel,
Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, James Markham,
Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft,
Gwenan Spearing, Matt Wade, Tom Welsh
Coordinating Editor: Kevin Shea
Copy Editor: Larissa Shmailo
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit
www.springeronline.com.
For information on translations, please e-mail [email protected], or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Special Bulk
Sales–eBook Licensing web page at www.apress.com/bulk-sales.
Any source code or other supplementary materials referenced by the author in this text is available to readers
at www.apress.com. For detailed information about how to locate your book’s source code, go to
www.apress.com/source-code.
This edition is dedicated to my father, whose technical
prowess is an inspiration to me every day!

—Your Loving Son, Dan


Contents at a Glance

About the Author .............................................................................................................. xvii


About the Technical Reviewer ........................................................................................... xix
Acknowledgments ............................................................................................................. xxi
Introduction ..................................................................................................................... xxiii

N Chapter 1: Overview of Object-Oriented Programming .....................................................1


N Chapter 2: Designing OOP Solutions: Identifying the Class Structure ...............................7
N Chapter 3: Designing OOP Solutions: Modeling the Object Interaction ............................. 25
N Chapter 4: Designing OOP Solutions: A Case Study .........................................................43
N Chapter 5: Introducing the .NET Framework and Visual Studio ......................................59
N Chapter 6: Creating Classes ............................................................................................83
N Chapter 7: Creating Class Hierarchies .............................................................................97
N Chapter 8: Implementing Object Collaboration..............................................................119
N Chapter 9: Working with Collections .............................................................................143
N Chapter 10: Implementing the Data Access Layer.........................................................161
N Chapter 11: Developing WPF Applications ....................................................................193
N Chapter 12: Developing Web Applications .....................................................................221
N Chapter 13: Developing Windows Store Applications ...................................................251
N Chapter 14: Developing and Consuming Web Services .................................................273
N Chapter 15: Developing the Office Supply Ordering Application ...................................295
N Chapter 16: Wrapping Up...............................................................................................321

v
N CONTENTS AT A GLANCE

N Appendix A: Fundamental Programming Concepts .......................................................325


N Appendix B: Exception Handling in C#...........................................................................341
N Appendix C: Installing the Required Software ...............................................................347

Index .................................................................................................................................353

vi
Contents

About the Author .............................................................................................................. xvii


About the Technical Reviewer ........................................................................................... xix
Acknowledgments ............................................................................................................. xxi
Introduction ..................................................................................................................... xxiii

N Chapter 1: Overview of Object-Oriented Programming .....................................................1


What is OOP? .................................................................................................................................1
The History of OOP ........................................................................................................................2
Why Use OOP? ...............................................................................................................................2
The Characteristics of OOP............................................................................................................3
Objects................................................................................................................................................................... 3
Abstraction ............................................................................................................................................................ 3
Encapsulation ........................................................................................................................................................ 4
Polymorphism ........................................................................................................................................................ 4
Inheritance............................................................................................................................................................. 4
Aggregation ........................................................................................................................................................... 5

The History of C# ...........................................................................................................................5


Summary .......................................................................................................................................6
N Chapter 2: Designing OOP Solutions: Identifying the Class Structure ...............................7
Goals of Software Design ..............................................................................................................7
Understanding the Unified Modeling Language ............................................................................8
Developing a SRS ..........................................................................................................................9
Introducing Use Cases.................................................................................................................10

vii
N CONTENTS

Understanding Class Diagrams ...................................................................................................16


Modeling Object Relationships ....................................................................................................17
Association .......................................................................................................................................................... 17
Inheritance........................................................................................................................................................... 18
Aggregation ......................................................................................................................................................... 18
Association Classes ............................................................................................................................................. 19

Summary .....................................................................................................................................24
N Chapter 3: Designing OOP Solutions: Modeling the Object Interaction ............................. 25
Understanding Scenarios ............................................................................................................25
Introducing Sequence Diagrams .................................................................................................26
Message Types ............................................................................................................................27
Recursive Messages ...................................................................................................................28
Message Iteration........................................................................................................................28
Message Constraints ...................................................................................................................29
Message Branching .....................................................................................................................29
Understanding Activity Diagrams ................................................................................................34
Decision Points and Guard Conditions ................................................................................................................. 34
Parallel Processing .............................................................................................................................................. 35
Activity Ownership ............................................................................................................................................... 35

Exploring GUI Design ...................................................................................................................39


GUI Activity Diagrams .......................................................................................................................................... 39
Interface Prototyping ........................................................................................................................................... 40
Interface Flow Diagrams ..................................................................................................................................... 41
Application Prototyping ....................................................................................................................................... 41

Summary .....................................................................................................................................42
N Chapter 4: Designing OOP Solutions: A Case Study .........................................................43
Developing an OOP Solution ........................................................................................................43
Creating the System Requirement Specification ................................................................................................. 43
Developing the Use Cases ................................................................................................................................... 45
Diagramming the Use Cases ............................................................................................................................... 46

viii
N CONTENTS

Developing the Class Model ................................................................................................................................ 48


Avoiding Some Common OOP Design Pitfalls ...................................................................................................... 58

Summary .....................................................................................................................................58
N Chapter 5: Introducing the .NET Framework and Visual Studio ......................................59
Introducing the .NET Framework.................................................................................................59
Goals of the .NET Framework .............................................................................................................................. 59
Components of the .NET Framework ................................................................................................................... 61
Working with the .NET Framework ...................................................................................................................... 64

Using the Visual Studio Integrated Development Environment ...................................................65


Summary .....................................................................................................................................81
N Chapter 6: Creating Classes ............................................................................................83
Introducing Objects and Classes .................................................................................................83
Defining Classes ..........................................................................................................................84
Creating Class Properties .................................................................................................................................... 84
Creating Class Methods ....................................................................................................................................... 85

Using Constructors ......................................................................................................................89


Overloading Methods ..................................................................................................................90
Summary .....................................................................................................................................96
N Chapter 7: Creating Class Hierarchies .............................................................................97
Understanding Inheritance ..........................................................................................................97
Creating Base and Derived Classes ..................................................................................................................... 97
Creating a Sealed Class ....................................................................................................................................... 99
Creating an Abstract Class .................................................................................................................................. 99
Using Access Modifiers in Base Classes ............................................................................................................. 99

Overriding the Methods of a Base Class ...................................................................................104


Calling a Derived Class Method from a Base Class ........................................................................................... 105
Calling a Base Class Method from a Derived Class ........................................................................................... 106

Overloading Methods of a Base Class .......................................................................................106


Hiding Base Class Methods .......................................................................................................107

ix
N CONTENTS

Implementing Interfaces ...........................................................................................................111


Understanding Polymorphism ...................................................................................................111
Summary ...................................................................................................................................117
N Chapter 8: Implementing Object Collaboration..............................................................119
Communicating Through Messaging .........................................................................................119
Defining Method Signatures ......................................................................................................119
Passing Parameters ..................................................................................................................120
Understanding Event-Driven Programming ...............................................................................121
Understanding Delegation .........................................................................................................121
Implementing Events.................................................................................................................122
Responding To Events ...............................................................................................................123
Windows Control Event Handling ..............................................................................................123
Handling Exceptions in the .NET Framework ............................................................................128
Using the Try-Catch Block ................................................................................................................................. 128
Adding a Finally Block ....................................................................................................................................... 129
Throwing Exceptions ......................................................................................................................................... 130
Nesting Exception Handling............................................................................................................................... 130

Static Properties and Methods ..................................................................................................131


Using Asynchronous Messaging................................................................................................136
Summary ...................................................................................................................................141
N Chapter 9: Working with Collections .............................................................................143
Introducing the .NET Framework Collection Types ....................................................................143
Working with Arrays and Array Lists .........................................................................................144
Using Generic Collections..........................................................................................................153
Programming with Stacks and Queues .....................................................................................157
Summary ...................................................................................................................................160
N Chapter 10: Implementing the Data Access Layer.........................................................161
Introducing ADO.NET .................................................................................................................161
Working with Data Providers .....................................................................................................162
x
N CONTENTS

Establishing a Connection .........................................................................................................162


Executing a Command ..............................................................................................................164
Using Stored Procedures ................................................................................................................................... 165

Using the DataReader Object to Retrieve Data ..........................................................................166


Using the DataAdapter to Retrieve Data ....................................................................................167
Working with DataTables and DataSets ....................................................................................172
Populating a DataTable from a SQL Server Database ........................................................................................ 173
Populating a DataSet from a SQL Server Database ........................................................................................... 174
Establishing Relationships between Tables in a DataSet .................................................................................. 174

Working with the Entity Framework ..........................................................................................181


Querying Entities with LINQ to EF..............................................................................................184
Updating Entities with the Entity Framework ............................................................................186
Summary ...................................................................................................................................191
N Chapter 11: Developing WPF Applications ....................................................................193
Windows Fundamentals ............................................................................................................193
Introducing XAML ......................................................................................................................194
Using Layout Controls ...............................................................................................................195
Adding Display Controls ............................................................................................................196
Using the Visual Studio Designer ..............................................................................................197
Handling Control Events ............................................................................................................198
Creating and Using Dialog Boxes ..............................................................................................204
Presenting a MessageBox to the User ......................................................................................205
Creating a Custom Dialog Box ...................................................................................................206
Data Binding in Windows-Based GUIs .......................................................................................207
Binding Controls Using a DataContext.......................................................................................207
Creating and Using Control and Data Templates .......................................................................214
Summary ...................................................................................................................................219

xi
N CONTENTS

N Chapter 12: Developing Web Applications .....................................................................221


Web Pages and Web Forms .......................................................................................................221
Web Server Control Fundamentals ............................................................................................223
Understanding Web Page and Web Server Control Inheritance Hierarchy ................................223
Using the Visual Studio Web Page Designer ..............................................................................226
The Web Page Life Cycle ...........................................................................................................227
Control Events ...........................................................................................................................228
Understanding Application and Session Events ........................................................................229
Creating Server-Side Control Event Handlers .................................................................................................... 235

Storing and Sharing State in a Web Application ........................................................................237


Maintaining View State ...................................................................................................................................... 237
Using Query Strings ........................................................................................................................................... 238
Using Cookies .................................................................................................................................................... 238
Maintaining Session and Application State ....................................................................................................... 239

Data-Bound Web Controls .........................................................................................................243


Model Binding.................................................................................................................................................... 244

Summary ...................................................................................................................................250
N Chapter 13: Developing Windows Store Applications ...................................................251
Building the User Interface ........................................................................................................251
Using Style Sheets ....................................................................................................................254
Handling Control Events ............................................................................................................254
Data Binding Controls................................................................................................................260
Page Navigation ........................................................................................................................269
Summary ...................................................................................................................................272
N Chapter 14: Developing and Consuming Web Services .................................................273
What Are Services? ...................................................................................................................273
WCF Web Services.....................................................................................................................274
Creating a WCF Web Service ............................................................................................................................. 274

xii
N CONTENTS

Consuming a WCF Web Service ......................................................................................................................... 278


Using Data Contracts ......................................................................................................................................... 279

RESTful Data Services ...............................................................................................................285


Creating an ASP.NET Web API Service ............................................................................................................... 285
Consuming ASP.NET Web API Services .............................................................................................................. 290

Summary ...................................................................................................................................294
N Chapter 15: Developing the Office Supply Ordering Application ...................................295
Revisiting Application Design ....................................................................................................295
Building the OSO Application’s Data Access Layer ....................................................................297
Building the OSO Application’s Business Logic Layer ...............................................................304
Creating the OSO Application UI ................................................................................................308
Summary ...................................................................................................................................320
N Chapter 16: Wrapping Up...............................................................................................321
Improve Your Object-Oriented Design Skills..............................................................................322
Investigate the .NET Framework Namespaces..........................................................................322
Become Familiar with ADO.NET and the Entity Framework ......................................................322
Learn More about Creating Great User Interfaces (UI)...............................................................322
Move toward Component-Based Development .........................................................................323
Find Help ...................................................................................................................................323
Join a User Group ......................................................................................................................323
Please Provide Feedback ..........................................................................................................323
Thank You, and Good Luck! .......................................................................................................324
N Appendix A: Fundamental Programming Concepts .......................................................325
Working with Variables and Data Types ....................................................................................325
Understanding Elementary Data Types......................................................................................325
Integral Data Types ............................................................................................................................................ 326
Non-Integral Data Types .................................................................................................................................... 326
Character Data Types ......................................................................................................................................... 326
Boolean Data Type ............................................................................................................................................. 327

xiii
N CONTENTS

Date Data Type ................................................................................................................................................... 327


Object Data Type ................................................................................................................................................ 327
Nullable Types.................................................................................................................................................... 327

Introducing Composite Data Types ............................................................................................327


Structures .......................................................................................................................................................... 327
Arrays ................................................................................................................................................................ 328
Classes .............................................................................................................................................................. 329
Looking at Literals, Constants, and Enumerations ....................................................................329
Literals ............................................................................................................................................................... 329
Constants........................................................................................................................................................... 329
Enumerations..................................................................................................................................................... 330

Exploring Variable Scope ...........................................................................................................330


Block-Level Scope ............................................................................................................................................. 330
Procedure Scope ............................................................................................................................................... 331
Module Scope .................................................................................................................................................... 331

Understanding Data Type Conversion ........................................................................................332


Implicit Conversion ............................................................................................................................................ 332
Explicit Conversion ............................................................................................................................................ 332
Widening and Narrowing Conversions............................................................................................................... 332

Working with Operators.............................................................................................................332


Arithmetic Operators ......................................................................................................................................... 332
Comparison Operators ....................................................................................................................................... 333
Logical Operators .............................................................................................................................................. 334
Ternary Operator ................................................................................................................................................ 334

Introducing Decision Structures ................................................................................................334


If Statements ..................................................................................................................................................... 335
Switch Statements ............................................................................................................................................ 336

Using Loop Structures ...............................................................................................................337


While Statement ................................................................................................................................................ 337
Do-While Statement .......................................................................................................................................... 337

xiv
N CONTENTS

For Statement .................................................................................................................................................... 337


For Each Statement ........................................................................................................................................... 337

Introducing Methods .................................................................................................................338


N Appendix B: Exception Handling in C#...........................................................................341
Managing Exceptions ................................................................................................................341
Using the .NET Framework Exception Classes ..........................................................................343
The Importance of Using ...........................................................................................................344
N Appendix C: Installing the Required Software ...............................................................347
Installing the Sample Databases ...............................................................................................347
Verifying the Database Installs .................................................................................................348

Index .................................................................................................................................353

xv
About the Author

Dan Clark is a senior IT consultant specializing in .NET and SQL Server technology.
He is particularly interested in C# programming and SQL Server Business
Intelligence development. For over a decade, he has been developing applications
and training others to develop applications using Microsoft technologies. Dan has
published several books and numerous articles on .NET programming. He is a
regular speaker at various developer conferences and user group meetings, and he
conducts workshops in object-oriented programming and database development.
He finds particular satisfaction in turning new developers on to the thrill of
developing and designing object-oriented applications. In a previous life, he was
a physics teacher and still loves the wonders and awe inspired by the study of the
Universe and why things behave the way they do. You can reach Dan at
[email protected].

xvii
About the Technical Reviewer

Todd Meister has been working in the IT industry for over fifteen years. He has been
the technical editor of over 75 titles on topics ranging from SQL Server to the .NET
Framework. He is the senior IT architect at Ball State University in Muncie, Indiana.
He lives in central Indiana with his wife, Kimberly, and their five entertaining
children.

xix
Acknowledgments

Thanks to the team at Apress for once again making the writing of this book as painless as possible while still keeping
me on task. A special shout out goes to Gwenan and Kevin for their perseverance and considerable help with this
project. And last but not least, to my technical reviewer Todd, thank you for your attention to detail and excellent
suggestions while reviewing this book.

—Dan Clark

xxi
Introduction

It has been my experience as a .NET trainer and lead programmer that most people do not have trouble picking up the
syntax of the C# language. What perplexes and frustrates many people are the higher-level concepts of object-oriented
programming methodology and design. To compound the problem, most introductory programming books and
training classes skim over these concepts or, worse, don’t cover them at all. It is my hope that this book fills this void.
My goals in writing this book are twofold. My first goal is to provide you with the information you need to understand
the fundamentals of programming in C#. More importantly, my second goal is to present you with the information
required to master the higher-level concepts of object-oriented programming methodology and design.
This book provides the knowledge you need to architect an object-oriented programming solution aimed at
solving a business problem. As you work your way through the book, you will learn first how to analyze the business
requirements of an application. Next, you will model the objects and relationships involved in the solution design.
Finally, you will implement the solution using C#. Along the way, you will learn about the fundamentals of software
design, the Unified Modeling Language (UML), object-oriented programming, C#, and the .NET Framework.
Because this is an introductory book, it’s meant to be a starting point for your study of the topics it presents.
As such, this book is not designed to make you an expert in object-oriented programming and UML; nor is it an
exhaustive discussion of C# and the .NET Framework; nor is it an in-depth study of Visual Studio. It takes considerable
time and effort to become proficient in any one of these areas. It is my hope that by reading this book, your first
experiences in object-oriented programming will be enjoyable and comprehensible—and that these experiences will
instill a desire for further study.

Target Audience
The target audience for this book is the beginning C# programmer who wants to gain a foundation in object-oriented
programming along with C# language basics. Programmers transitioning from a procedure-oriented programming
model to an object-oriented model will also benefit from this book. In addition, there are many Visual Basic (VB)
programmers who want to transition to C#. Before transitioning to C#, it is imperative that you understand the
fundamentals of object-oriented programming.
Because the experience level of a “beginner” can vary immensely, I have included a primer in Appendix A that
discusses some basic programming concepts and how they are implemented in C#. I would suggest you review these
concepts if you are new to programming.

Activities and Software Requirements


One of the most important aspects of learning is doing. You can’t learn to ride a bike without jumping on a bike, and
you can’t learn to program without cranking out code. Any successful training program needs to include both a theory
component and a hands-on component.
I have included both components throughout this book. It is my hope that you will take seriously the activities
I have added to each chapter and work through them thoroughly—even repeatedly. Contrary to some students’
perception that these activities are “exercises in typing,” the activities are where you get a chance to make the theory

xxiii
N INTRODUCTION

concrete and where true simulation of the concepts occurs. I also encourage you to play as you work through an
activity. Don’t be afraid to alter some of the code just to see what happens. Some of the best learning experiences
occur when students “color outside the lines.”
The UML modeling activities in early chapters are designed for someone using UMLet. I chose this program
because it’s a good diagramming tool to learn with. It lets you create UML diagrams without adding a lot of advanced
features associated with the high-end CASE tools. UMLet is a free open-source tool and can be downloaded from
www.umlet.com. You can also use another tool such as Visio to complete the activities. However, you don’t need a tool
to complete these activities; paper and pencil will work just fine.
Once you begin coding, you will need Visual Studio 2012 with C# installed. I encourage you to install the help
files and make ample use of them while completing the activities. Chapter 13 deals with creating Windows Store Apps
and requires Visual Studio installed on the Windows 8 operating system. Later chapters require Microsoft SQL Server
2008 or higher with the Pubs and Northwind databases installed. Appendix C includes instructions on downloading
and installing the sample databases. You can find free Express and trial editions of both Visual Studio and SQL Server
along with trial editions of Windows 8 at www.msdn.microsoft.com.

xxiv
CHAPTER 1

Overview of Object-Oriented
Programming

To set the stage for your study of object-oriented programming (OOP) and C#, this chapter will look briefly at the
history of object-oriented programming and the characteristics of an object-oriented programming language.
You will look at why object-oriented programming has become so important in the development of industrial-
strength distributed-software systems. You will also examine how C# has evolved into one of the leading application
programming languages.
After reading this chapter, you will be familiar with the following:
u what object-oriented programming is
u why object-oriented programming has become so important in the development of industrial-
strength applications
u the characteristics that make a programming language object-oriented
u the history and evolution of C#

What is OOP?
Object-oriented programming is an approach to software development in which the structure of the software is based
on objects interacting with each other to accomplish a task. This interaction takes the form of messages passing back
and forth between the objects. In response to a message, an object can perform an action.
If you look at how you accomplish tasks in the world around you, you can see that you interact in an object-
oriented world. If you want to go to the store, for example, you interact with a car object. A car object consists of other
objects that interact with each other to accomplish the task of getting you to the store. You put the key object in the
ignition object and turn it. This in turn sends a message (through an electrical signal) to the starter object, which
interacts with the engine object to start the car. As a driver, you are isolated from the logic of how the objects of the
system work together to start the car. You just initiate the sequence of events by executing the start method of the
ignition object with the key. You then wait for a response (message) of success or failure.
Similarly, users of software programs are isolated from the logic needed to accomplish a task. For example, when
you print a page in your word processor, you initiate the action by clicking a print button. You are isolated from the
internal processing that needs to occur; you just wait for a response telling you if it printed. In the software program,
the button object interacts with a printer object, which interacts with the actual printer to accomplish the task of
printing the page.

1
CHAPTER 1 N OVERVIEW OF OBJECT-ORIENTED PROGRAMMING

The History of OOP


OOP concepts started surfacing in the mid-1960s with a programming language called Simula and further evolved
in the 1970s with advent of Smalltalk. Although software developers did not overwhelmingly embrace these early
advances in OOP languages, object-oriented methodologies continued to evolve. In the mid-1980s there was a
resurgence of interest in object-oriented methodologies. Specifically, OOP languages such as C++ and Eiffel became
popular with mainstream computer programmers. OOP continued to grow in popularity in the 1990s, most notably
with the advent of Java and the huge following it attracted. And in 2002, in conjunction with the release of the .NET
Framework, Microsoft introduced a new OOP language, C# (pronounced C-sharp) and revamped their widely popular
existing language, Visual Basic, so that it is now truly object-oriented. Today OOP languages continue to flourish and
are a mainstay of modern programming.

Why Use OOP?


Why has OOP developed into such a widely used paradigm for solving business problems today? During the 1970s
and 1980s, procedure-oriented programming languages such as C, Pascal, and Fortran were widely used to develop
business-oriented software systems. Procedural languages organize the program in a linear fashion—they run from
top to bottom. In other words, the program is a series of steps that run one after another. This type of programming
worked fine for small programs that consisted of a few hundred code lines, but as programs became larger they
became hard to manage and debug.
In an attempt to manage the ever-increasing size of the programs, structured programming was introduced
to break down the code into manageable segments called functions or procedures. This was an improvement, but
as programs performed more complex business functionality and interacted with other systems, the following
shortcomings of structural programming began to surface:
u Programs became harder to maintain.
u Existing functionality was hard to alter without adversely affecting all of the system’s
functionality.
u New programs were essentially built from scratch. Consequently, there was little return on the
investment of previous efforts.
u Programming was not conducive to team development. Programmers had to know every
aspect of how a program worked and could not isolate their efforts on one aspect of a system.
u It was hard to translate business models into programming models.
u Structural programming worked well in isolation but did not integrate well with other systems.
In addition to these shortcomings, some evolutions of computing systems caused further strain on the structural
program approach, such as:
u Nonprogrammers demanded and got direct access to programs through the incorporation of
graphical user interfaces and their desktop computers.
u Users demanded a more intuitive, less structured approach to interacting with programs.
u Computer systems evolved into a distributed model where the business logic, user interface,
and backend database were loosely coupled and accessed over the Internet and intranets.

2
CHAPTER 1 N OVERVIEW OF OBJECT-ORIENTED PROGRAMMING

As a result, many business software developers turned to object-oriented methods and programming languages.
The benefits included the following:
u a more intuitive transition from business-analysis models to software-implementation models
u the ability to maintain and implement changes in the programs more efficiently and rapidly
u the ability to create software systems more effectively using a team process, allowing
specialists to work on parts of the system
u the ability to reuse code components in other programs and purchase components written by
third-party developers to increase the functionality of existing programs with little effort
u better integration with loosely coupled distributed-computing systems
u improved integration with modern operating systems
u the ability to create a more intuitive graphical-user interface for the users

The Characteristics of OOP


In this section you are going to examine some fundamental concepts and terms common to all OOP languages. Don’t
worry about how these concepts get implemented in any particular programming language; that will come later. My
goal is to familiarize you with the concepts and relate them to your everyday experiences so that they make more
sense later when you look at OOP design and implementation.

Objects
As I noted earlier, we live in an object-oriented world. You are an object. You interact with other objects. In fact,
you are an object with data such as your height and hair color. You also have methods that you perform or that are
performed on you, such as eating and walking.
So what are objects? In OOP terms, an object is a structure for incorporating data and the procedures for working
with that data. For example, if you were interested in tracking data associated with product inventory, you would
create a product object that is responsible for maintaining and using the data pertaining to the products. If you
wanted to have printing capabilities in your application, you would work with a printer object that is responsible for
the data and methods used to interact with your printers.

Abstraction
When you interact with objects in the world, you are often only concerned with a subset of their properties. Without
this ability to abstract or filter out the extraneous properties of objects, you would find it hard to process the plethora
of information bombarding you and concentrate on the task at hand.
As a result of abstraction, when two different people interact with the same object, they often deal with a different
subset of attributes. When I drive my car, for example, I need to know the speed of the car and the direction it is going.
Because the car is using an automatic transmission, I do not need to know the revolutions per minute (RPMs) of the
engine, so I filter this information out. On the other hand, this information would be critical to a racecar driver, who
would not filter it out.
When constructing objects in OOP applications, it is important to incorporate this concept of abstraction. The
objects include only the information that is relevant in the context of the application. If you were building a shipping
application, you would construct a product object with attributes such as size and weight. The color of the item would
be extraneous information and would be ignored. On the other hand, when constructing an order-entry application,
the color could be important and would be included as an attribute of the product object.

3
CHAPTER 1 N OVERVIEW OF OBJECT-ORIENTED PROGRAMMING

Encapsulation
Another important feature of OOP is encapsulation. Encapsulation is the process in which no direct access is granted
to the data; instead, it is hidden. If you want to gain access to the data, you have to interact with the object responsible
for the data. In the previous inventory example, if you wanted to view or update information on the products, you
would have to work through the product object. To read the data, you would send the product object a message. The
product object would then read the value and send back a message telling you what the value is. The product object
defines which operations can be performed on the product data. If you send a message to modify the data and the
product object determines it is a valid request, it will perform the operation for you and send a message back with
the result.
You experience encapsulation in your daily life all the time. Think about a human resources department. They
encapsulate (hide) the information about employees. They determine how this data can be used and manipulated.
Any request for the employee data or request to update the data has to be routed through them. Another example
is network security. Any request for security information or a change to a security policy must be made through a
network security administrator. The security data is encapsulated from the users of the network.
By encapsulating data, you make the data of your system more secure and reliable. You know how the data is
being accessed and what operations are being performed on the data. This makes program maintenance much easier
and also greatly simplifies the debugging process. You can also modify the methods used to work on the data, and, if
you do not alter how the method is requested and the type of response sent back, you do not have to alter the other
objects using the method. Think about when you send a letter in the mail. You make a request to the post office to
deliver the letter. How the post office accomplishes this is not exposed to you. If it changes the route it uses to mail
the letter, it does not affect how you initiate the sending of the letter. You do not have to know the post office’s internal
procedures used to deliver the letter.

Polymorphism
Polymorphism is the ability of two different objects to respond to the same request message in their own unique way.
For example, I could train my dog to respond to the command bark and my bird to respond to the command chirp.
On the other hand, I could train them to both respond to the command speak. Through polymorphism I know that the
dog will respond with a bark and the bird will respond with a chirp.
How does this relate to OOP? You can create objects that respond to the same message in their own unique
implementations. For example, you could send a print message to a printer object that would print the text on a
printer, and you could send the same message to a screen object that would print the text to a window on your
computer screen.
Another good example of polymorphism is the use of words in the English language. Words have many different
meanings, but through the context of the sentence you can deduce which meaning is intended. You know that
someone who says “Give me a break!” is not asking you to break his leg!
In OOP you implement this type of polymorphism through a process called overloading. You can implement
different methods of an object that have the same name. The object can then tell which method to implement depending
on the context (in other words, the number and type of arguments passed) of the message. For example, you could create
two methods of an inventory object to look up the price of a product. Both these methods would be named getPrice.
Another object could call this method and pass either the name of the product or the product ID. The inventory object
could tell which getPrice method to run by whether a string value or an integer value was passed with the request.

Inheritance
Most real-life objects can be classified into hierarchies. For example, you can classify all dogs together as having certain
common characteristics such as having four legs and fur. Their breeds further classify them into subgroups with
common attributes such as size and demeanor. You also classify objects according to their function. For example,
there are commercial vehicles and recreational vehicles. There are trucks and passenger cars. You classify cars
according to their make and model. To make sense of the world, you need to use object hierarchies and classifications.

4
CHAPTER 1 N OVERVIEW OF OBJECT-ORIENTED PROGRAMMING

You use inheritance in OOP to classify the objects in your programs according to common characteristics and
function. This makes working with the objects easier and more intuitive. It also makes programming easier because
it enables you to combine general characteristics into a parent object and inherit these characteristics in the child
objects. For example, you can define an employee object that defines all the general characteristics of employees
in your company. You can then define a manager object that inherits the characteristics of the employee object
but also adds characteristics unique to managers in your company. Because of inheritance the manager object will
automatically reflect any changes to the characteristics of the employee object.

Aggregation
Aggregation is when an object consists of a composite of other objects that work together. For example, your lawn
mower object is a composite of the wheel objects, the engine object, the blade object, and so on. In fact, the engine
object is a composite of many other objects. There are many examples of aggregation in the world around us. The
ability to use aggregation in OOP is a powerful feature that enables you to accurately model and implement business
processes in your programs.

The History of C#
In the 1980s, most applications written to run on the Windows operating system were written in C++. Even though
C++ is an OOP language, it’s arguably a difficult language to master and the programmer is responsible for dealing
with housekeeping tasks such as memory management and security. These housekeeping tasks are difficult to
implement and often neglected, which results in bug-filled applications that are difficult to test and maintain.
In the 1990s, the Java programming language became popular. Because it’s a managed-programming language,
it runs on top of a unified set of class libraries that take care of the low-level programming tasks such as type safety
checking, memory management, and destruction of unneeded objects. This allows the programmer to concentrate on
the business logic and frees her from having to worry about the error-prone housekeeping code. As a result, programs
are more compact, reliable, and easier to debug.
Seeing the success of Java and the increased popularity of the Internet, Microsoft developed its own set of
managed-programming languages. Microsoft wanted to make it easier to develop both Windows- and Web-based
applications. These managed languages rely on the .NET Framework to provide much of the functionality to
perform the housekeeping code required in all applications. During the development of the .NET Framework, the
class libraries were written in a new language called C#. The principal designer and lead architect of C# was Anders
Hejlsberg. Hejlsberg was previously involved with the design of Turbo Pascal and Delphi. He leveraged this previous
experience to design an OOP language that built on the successes of these languages and improved upon their
shortcomings. Hejlsberg also incorporated syntax similar to C into the language in order to appeal to the C++ and
Java developers. One of the goals of creating the .NET Framework and the C# language was to introduce modern
concepts such as object orientation, type safety, garbage collection, and structured-exception handling directly into
the platform.
Since releasing C#, Microsoft has continually sought to add additional features and enhancements to the
language. For example, version 2.0 added support for generics (generics are covered in Chapter 9) and version 3.0
LINQ (more about this in Chapter 10) was added to reduce the impedance mismatch between the programming
language and the database language used to retrieve and work with data. Today C# 5.0 includes support to make
parallel and asynchronous programming easier for developers to implement (see Chapter 8). With Microsoft’s
commitment to the continual improvement and evolution of the C#, it will continue to rank as one of the most widely
used programming languages in the world.

5
CHAPTER 1 N OVERVIEW OF OBJECT-ORIENTED PROGRAMMING

Microsoft is also committed to providing .NET developers with the tools necessary to have a highly productive
and intuitive programming experience. Although you can create C# programs using a text editor, most professional
programmers find an integrated development environment (IDE) invaluable in terms of ease of use and increased
productivity. Microsoft has developed an exceptional IDE in Visual Studio (VS). Integrated into VS are many features
that make programming for the .NET Framework more intuitive (These features are covered in Chapter 5). With
the most recent release of Visual Studio 2012, Microsoft has continued to enhance the design-time developing
experience. VS 2012 includes new features such as better debugging support for parallel programming and an
improved code testing experience. As you work your way through this book, I think you will come to appreciate the
power and productivity that Visual Studio and the C# language provide.

Summary
In this chapter, you were introduced to OOP and got a brief history of C#. Now that you have an understanding of what
constitutes an OOP language and why OOP languages are so important to enterprise-level application development,
your next step is to become familiar with how OOP applications are designed.
In order to meet the needs of the users, successful applications must be carefully planned and developed. The
next chapter is the first in a series of three aimed at introducing you to some of the techniques used when designing
object-oriented applications. You will look at the process of deciding which objects need to be included in an
application and which attributes of these objects are important to the functionality of that application.

6
CHAPTER 2

Designing OOP Solutions:


Identifying the Class Structure

Most software projects you will become involved with as a business software developer will be a team effort. As a
programmer on the team, you will be asked to transform the design documents into the actual application code.
Additionally, because the design of object-oriented programs is an iterative process, designers depend on the
feedback of the software developers to refine and modify the program design. As you gain experience in developing
object-oriented software systems, you may even be asked to sit in on the design sessions and contribute to the design
process. Therefore, as a software developer, you should be familiar with the purpose and the structure of the various
design documents, as well as have some knowledge of how these documents are developed.
This chapter introduces you to some of the common documents used to design the static aspects of the system.
(You’ll learn how the dynamic aspects of the system are modeled in the next chapter.) To help you understand these
documents, this chapter includes some hands-on activities based on a limited case study. You’ll find similar activities
corresponding to the topics of discussion in most of the chapters in this book.
After reading this chapter, you will be familiar with the following:
u The goals of software design
u The fundamentals of the Unified Modeling Language
u The purpose of a software requirement specification
u How use case diagrams model the services the system will provide
u How class diagrams model the classes of objects that need to be developed

Goals of Software Design


A well-organized approach to system design is essential when developing modern enterprise-level object-oriented
programs. The design phase is one of the most important in the software development cycle. You can trace many of
the problems associated with failed software projects to poor upfront design and inadequate communication
between the system’s developers and the system’s consumers. Unfortunately, many programmers and program
managers do not like getting involved in the design aspects of the system. They view any time not spent cranking out
code as unproductive.

7
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

To make matters worse, with the advent of “Internet time,” consumers expect increasingly shorter development
cycles. So, to meet unrealistic timelines and project scope, developers tend to forgo or cut short the system design
phase of development. This is counterproductive to the system’s success. Investing time in the design process will
achieve the following:
u Provide an opportunity to review the current business process and fix any inefficiencies or
flaws uncovered
u Educate the customers as to how the software development process occurs and incorporate
them as partners in this process
u Create realistic project scopes and timelines for completion
u Provide a basis for determining the software testing requirements
u Reduce the cost and time required to implement the software solution
A good analogy to software design is the process of building a home. You would not expect a builder to start
working on the house without detailed plans (blueprints) supplied by an architect. You would expect the architect to
discuss the home’s design with you before creating any blueprints. It is the architect’s job to listen to your requests and
convert them into plans that a builder can use to build the home. A good architect will also educate you as to which
features are reasonable for your budget and projected timeline.

Understanding the Unified Modeling Language


To successfully design object-oriented software, you need to follow a proven design methodology. One proven design
methodology used in OOP today is the Unified Modeling Language (UML).UML was developed in the early 1980s
as a response to the need for a standard, systematic way of modeling the design of object-oriented software. This
industry standard was created and is managed by the Object Management Group (OMG). UML has evolved and
matured along with the software industry and the current version 2.4.1 was formally released in 2011.
There are many advantages to using UML during the design process. When properly implemented, UML
allows you to visualize the software system at various levels of detail. You can verify requirements and scope of the
project with the users. It also can be used as the basis for testing the system. UML lends itself well to an incremental
development process. UML modeling is also very beneficial for parallel development of large systems. Using the
model, each team is aware of how their pieces fit into the system and can convey changes that may affect other teams.
UML consists of a series of textual and graphical models of the proposed solution. These models define the
system scope, components of the system, user interaction with the system, and how the system components interact
with each other to implement the system functionality.
Some common models used in UML are the following:
u Software Requirement Specification (SRS): a textual description of the overall responsibilities
and scope of the system.
u Use Case: a textual/graphical description of how the system will behave from the user’s
perspective. Users can be human or other systems.
u Class Diagram: a visual blueprint of the objects that will be used to construct the system.
u Sequence Diagram: a model of the sequence of object interaction as the program executes.
Emphasis is placed on the order of the interactions and how they proceed over time.
u Collaboration Diagram: a view of how objects are organized to work together as the program
executes. Emphasis is placed on the communications that occur between the objects.
u Activity Diagram: a visual representation of the flow of execution of a process or operation.

8
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

In this chapter, you’ll look at the development of the SRS, use cases, and class diagrams. Chapter 3 covers the
sequence, collaboration, and activity diagrams.

Developing a SRS
The purpose of the SRS is to do the following:
u Define the functional requirements of the system.
u Identify the boundaries of the system.
u Identify the users of the system.
u Describe the interactions between the system and the external users.
u Establish a common language between the client and the program team for describing the system.
u Provide the basis for modeling use cases.
To produce the SRS, you interview the business owners and the end users of the system. The goals of these
interviews are to document clearly the business processes involved and establish the system’s scope. The outcome of
this process is a formal document (the SRS) detailing the functional requirements of the system. A formal document
helps to ensure agreement between the customers and the software developers. The SRS also provides a basis for
resolving any disagreements over perceived system scope as development proceeds.
As an example, suppose that the owners of a small commuter airline want customers to be able to view flight
information and reserve tickets for flights using a Web registration system. After interviewing the business managers
and the ticketing agents, the software designers draft an SRS document that lists the system’s functional requirements.
The following are some of these requirements:
u Nonregistered web users can browse to the web site to view flight information, but they can’t
book flights.
u New customers who want to book flights must complete a registration form providing their
name, address, company name, phone number, fax number, and e-mail address.
u A customer is classified as either a corporate customer or a retail customer.
u Customers can search for flights based on destination and departure times.
u Customers can book flights indicating the flight number and the number of seats requested.
u The system sends customers a confirmation via e-mail when the flight is booked.
u Corporate customers receive frequent flier miles when their employees book flights.
u Frequent-flier miles are used to discount future purchases.
u Ticket reservations may be canceled up to one week in advance for an 80 percent refund.
u Ticketing agents can view and update flight information.
In this partial SRS document, you can see that several succinct statements define the system scope. They
describe the functionality of the system as viewed by the system’s users and identify the external entities that will
use it. It is important to note that the SRS does not contain references to the technical requirements of the system.
Once the SRS is developed, the functional requirements it contains are transformed into a series of use
case diagrams.

9
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Introducing Use Cases


Use cases describe how external entities will use a system. These external entities can be human or other systems
(called actors in UML terminology). The description emphasizes the users’ view of the system and the interaction
between the users and the system. Use cases help to further define system scope and boundaries. They are usually
in the form of a diagram, along with a textual description of the interaction taking place. Figure 2-1 shows a generic
diagram that consists of two actors represented by stick figures, the system represented by a rectangle, and use cases
depicted by ovals inside the system boundaries.

System

Use case 1

Actor 1 Use case 2

Use case 3

Actor 2

Figure 2-1. Generic use case diagram with two actors and three use cases

Use cases are developed from the SRS document. The actor is any outside entity that interacts with the system.
An actor could be a human user (for instance, a rental agent), another software system (for instance, a software billing
system), or an interface device (for instance, a temperature probe). Each interaction that occurs between an actor and
the system is modeled as a use case.
The sample use case shown in Figure 2-2 was developed for the flight-booking application introduced in the
previous section. It shows the use case diagram for the requirement “Customers can search for flights based on
destination and departure times.”

View Flight Info

Customer

Figure 2-2. View Flight Info use case

10
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Along with the graphical depiction of the use case, many designers and software developers find it helpful to
provide a textual description of the use case. The textual description should be succinct and focused on what is
happening, not on how it is occurring. Sometimes any preconditions or postconditions associated with the use case
are also identified. The following text further describes the use case diagram shown in Figure 2-2.
u Description: A customer views the flight information page. The customer enters flight search
information. After submitting the search request, the customer views a list of flights matching
the search criteria.
u Preconditions: None.
u Postconditions: The customer has the opportunity to log in and proceed to the flight-booking page.
As another example, take a look at the Reserve Seat use case shown in Figure 2-3.

View Flight Info

«include»

Reserve Seat

Customer

Figure 2-3. Reserve Seat use case diagram

The following text further describes the use case diagram shown in Figure 2-3.
u Description: The customer enters the flight number and indicates the seats being requested.
After the customer submits the request, some confirmation information is displayed.
u Preconditions: The customer has looked up the flight information. The customer has logged in
and is viewing the flight-booking screen.
u Postconditions: The customer is sent a confirmation e-mail outlining the flight details and the
cancellation policy.
As you can see from Figure 2-3, certain relationships can exist between use cases. The Reserve Seat use case
includes the View Flight Info use case. This relationship is useful because you can use the View Flight Info use
case independently of the Reserve Flight use case. This is called inclusion. You cannot use the Reserve Seat use case
independently of the View Flight Info use case, however. This is important information that will affect how you
model the solution.
Another way that use cases relate to each other is through extension. You might have a general use case that
is the base for other use cases. The base use case is extended by other use cases. For example, you might have a
Register Customer use case that describes the core process of registering customers. You could then develop Register
Corporate Customer and Register Retail Customer use cases that extend the base use case. The difference between
extension and inclusion is that, in extension, the base use case being extended is not used on its own. Figure 2-4
demonstrates how you model this in a use case diagram.

11
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Register Corporate
Customer
«extends»

Register
Customer «extends»
Register Retail
Customer
Customer

Figure 2-4. Extending use cases

A common mistake when developing use cases is to include actions initiated by the system itself. The emphasis
of the use case is on the interaction between external entities and the system. Another common mistake is to include a
description of the technical requirements of the system. Remember that use cases do not focus on how the system will
perform the functions, but rather on what functions need to be incorporated in the system from the user’s standpoint.
After you have developed the use cases of the system, you can begin to identify the internal system objects that
will carry out the system’s functional requirements. You do this using a class diagram.

ACTIVITY 2-1. CREATING A USE CASE DIAGRAM

After completing this activity, you should be familiar with the following:
u how to produce a use case diagram to define a system’s scope
u how to use a UML modeling tool to create and document a use case diagram

Examining the SRS

The software user group you belong to has decided to pool its resources and create a lending library. Lending
items include books, movies, and video games. Your task is to develop the application that will keep track of the
loan item inventory and the lending of items to the group members. After interviewing the group’s members and
officers, you have developed a SRS document that includes the following functional requirements:
u Only members of the user group can borrow items.
u Books can be borrowed for four weeks.
u Movies and games can be borrowed for one week.
u Items can be renewed if no one is waiting to borrow them.
u Members can only borrow up to four items at the same time.
u A reminder is e-mailed to members when an item becomes overdue.
u A fine is charged for overdue items.
u Members with outstanding overdue items or fines can’t borrow new items.
u A secretary is in charge of maintaining item inventory and purchasing items to add to the inventory.
u A librarian has been appointed to track lending and send overdue notices.
u The librarian is also responsible for collecting fines and updating fine information.

12
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

The next steps are to analyze the SRS to identify the actors and use cases.
1. By examining the SRS document, identify which of the following will be among the
principal actors interacting with the system:
A. Member
B. Librarian
C. Book
D. Treasurer
E. Inventory
F. E-mail
G. Secretary
2. Once you have identified the principal actors, you need to identify the use cases for the
actors. Identify the actor associated with the following use cases:
A. Request Item
B. Catalog Item
C. Lend Item
D. Process Fine

See the end of the chapter for Activity 2-1 answers.

Creating a Use Case Diagram

Although it is possible to create UML diagrams by hand or on a whiteboard, most programmers will eventually
turn to a diagramming tool or a Computer-Aided Software Engineering (CASE) tool. CASE tools help you construct
professional-quality diagrams and enable team members to easily share and augment the diagrams. There are
many CASE tools on the market, including Microsoft Visio. Before choosing a CASE tool, you should thoroughly
evaluate if it meets your needs and is sufficiently flexible. A lot of the advanced features associated with high-end
CASE tools are difficult to work with, so you spend more time figuring out how the CASE tool works than
documenting your design.
A good diagraming tool to learn on is UMLet. UMLet enables you to create UML diagrams without adding a lot of
advanced features associated with the high-end CASE tools. Best of all, UMLet is a free open-source tool and can
be downloaded from www.umlet.com.

N Note These activities use the UMLet 11.5.1 stand-alone edition. This also requires Java 1.6 available at www.java.com.

13
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

After downloading and installing UMLet, you can complete the following steps (if you do not want to use a tool,
you can create the Use Case diagram by hand):
1. Start UMLet by double clicking the UMLet.jar file. You are presented with three windows.
The main window is the design surface, the upper right window contains the UML object
templates, and the lower right window is where you change or add properties to the objects.
2. Locate the actor template in the upper right window (see Figure 2-5). Double click the
actor template. An actor will appear in the upper left corner of the design surface.

Use case 1
Use case 3
«include»
«extends»
Use case 2

Collaboration

Actor

Figure 2-5. Locating the actor template

3. If not already selected, select the actor shape on the design surface. In the lower right
window, change the name of the actor shape to Member.
4. Repeat the procedures to add a Secretary and a Librarian actor.
5. From the Template window, double click the Use case 1 shape to add it to the design
surface. Change the name of the use case to Request Item.
6. Repeat step 5 for two more use cases. Include a Catalog Item use case that will occur
when the Secretary adds new items to the library inventory database. Add a Lend Item
use case that will occur when the Librarian processes a request for an item.
7. From the Template window, double click the Empty Package shape and change the
name to Library Loan System. Right click on the shape in the design surface and change
the background color to white. Move the use case shapes inside the Library Loan
System shape (see Figure 2-6).

14
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Library Loan System

Catalog Item

Secretary
Member Lend Item

Request Item

Librarian

Figure 2-6. Placing the use cases inside the system boundary

8. From the Template window, double click on the Communications Link shape. It is the
line with no arrow heads (see Figure 2-7). On the design surface, attach one end to the
Member shape and the other end to the Request Item shape.

Use case 1
Use case 3
«include»
«extends»
Use case 2

Collaboration

Actor

Figure 2-7. Locating the Communications Link shape

9. Repeat step 8 two times to create a Communication Link shape between the Librarian
and the Lend Item shapes as well as a Communication Link shape between the
Secretary and the Catalog Item shapes.
10. From the Templates widow, double click the Extends Relationship arrow. Attach the tail
end of the Extends arrow to the Lend Item use case and attach the head of the arrow to
the Request Item use case.
11. Your completed diagram should be similar to the one shown in Figure 2-8. Save the file
as UMLAct2_1 and exit UMLet.

15
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Library Loan System

Catalog Item

Secretary

Lend Item

Librarian «extends»

Request Item

Member

Figure 2-8. Completed use case diagram

Understanding Class Diagrams


The concepts of classes and objects are fundamental to OOP. An object is a structure for incorporating data and the
procedures for working with the data. These objects implement the functionality of an object-oriented program.
Think of a class as a blueprint for an object and an object as an instance of a class. A class defines the structure and
the methods that objects based on the class type will contain.
Designers identify a potential list of classes that they will need to develop from the SRS and the use case
diagrams. One way you identify the classes is by looking at the noun phrases in the SRS document and the use case
descriptions. If you look at the documentation developed thus far for the airline booking application, you can begin
to identify the classes that will make up the system. For example, you can develop a Customer class to work with the
customer data and a Flight class to work with the flight data.
A class is responsible for managing data. When defining the class structure, you must determine what data the
class is responsible for maintaining. The class attributes define this information. For example, the Flight class will
have attributes for identifying the flight number, departure time and date, flight duration, destination, capacity, and
seats available. The class structure must also define any operations that will be performed on the data. An example of
an operation the Flight class is responsible for is updating the seats available when a seat is reserved.
A class diagram can help you visualize the attributes and operations of a class. Figure 2-9 is an example of the
class diagram for the Flight class used in the flight booking system example. A rectangle divided into three sections
represents the class. The top section of the rectangle shows the name of the class, the middle section lists the
attributes of the class, and the bottom section lists the operations performed by the class.

16
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Flight
flightld
date
origin
destination
departureTime
arrivalTime
seatingCapacity
reserveSeat( )
unreserveSeat( )

Figure 2-9. Flight class diagram

Modeling Object Relationships


In OOP, when the program executes, the various objects work together to accomplish the programming tasks. For
example, in the flight booking application, in order to reserve a seat on the flight, a Reservation object must interact
with the Flight object. A relationship exists between the two objects, and this relationship must be modeled in the
class structure of the program. The relationships among the classes that make up the program are modeled in the
class diagram. Analyzing the verb phrases in the SRS often reveals these relationships (this is discussed in more detail
in Chapter 3). The following sections examine some of the common relationships that can occur between classes and
how the class diagram represents them.

Association
When one class refers to or uses another class, the classes form an association. You draw a line between the two
classes to represent the association and add a label to indicate the name of the association. For example, a seat is
associated with a flight in the flight-booking-application, as shown in Figure 2-10.

Flight Contains Seat

Figure 2-10. Class associations

Sometimes a single instance of one class associates with multiple instances of another class. This is indicated
on the line connecting the two classes. For example, when a customer makes a reservation, there is an association
between the Customer class and the Reservation class. A single instance of the Customer class may be associated with
multiple instances of the Reservation class. The n placed near the Reservation class indicates this multiplicity, as
shown in Figure 2-11.

Makes a
Customer Reservation
1 1..n

Figure 2-11. Indicating multiplicity in a class diagram

17
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

A situation may also exist where an instance of a class may be associated with multiple instances of the same
class. For example, an instance of the Pilot class represents the captain while another instance of the Pilot class
represents the co-pilot. The pilot manages the co-pilot. This scenario is referred to as a self-association and is
modeled by drawing the association line from the class back to itself, as shown in Figure 2-12.

Manages

1
Pilot
1 Co-pilot

Figure 2-12. A self-associating class

Inheritance
When multiple classes share some of the same operations and attributes, a base class can encapsulate the
commonality. The child class then inherits from the base class. This is represented in the class diagram by a solid line
with an open arrowhead pointing to the base class. For example, a CorporateCustomer class and a RetailCustomer
class could inherit common attributes and operations from a base Customer class, as shown in Figure 2-13.

Customer

«inherits» «inherits»

Retail Customer Corporate Customer

Figure 2-13. Documenting inheritance

Aggregation
When a class is formed by a composition of other classes, they are classified as an aggregation. This is represented
with a solid line connecting the classes in a hierarchical structure. Placing a diamond on the line next to a class in the
diagram indicates the top level of the hierarchy. For example, an inventory application designed to track plane parts
for the plane maintenance department could contain a Plane class that is a composite of various part classes,
as shown in Figure 2-14.

Fuel Pump

Fuel System
Fuel Filter
Plane

Engine

Figure 2-14. Depicting aggregations

18
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Association Classes
As the classes and the associations for a program are developed, there may be a situation where an attribute can’t
be assigned to any one class, but is a result of an association between classes. For example, the parts inventory
application mentioned previously may have a Part class and a Supplier class. Because a part can have more than
one supplier and the supplier supplies more than one part, where should the price attribute be located? It does not
fit nicely as an attribute for either class, and it should not be duplicated in both classes. The solution is to develop
an association class that manages the data that is a product of the association. In this case, you would develop a
PartPrice class. The relationship is modeled with a dashed line drawn between the association and the association
class, as shown in Figure 2-15.

Supplies a
Supplier Part
1..n 1..n

PartPrice

Figure 2-15. An association class

Figure 2-16 shows the evolving class diagram for the flight booking application. It includes the classes, attributes,
and relationships that have been identified for the system. The operations associated with the classes will be
developed in Chapter 3.

Customer Reservation Seat


customerId makes a reservationNo reserves rowNo
lastName 1 0..n date 1 1..n seatNo
firstName price
street status
city
state
zipCode 1..n
contains
phone
eMail
password 1
Flight
flightld
<<Inherits>> <<Inherits>> date
origin
CorporateCustomer destination
RetailCustomer departureTime
companyName
arrivalTime
creditCardType frequentFlyerPts
seatingCapacity
creditCardNo billingAccountNo

Figure 2-16. Flight booking class diagram

19
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

ACTIVITY 2-2. CREATING A CLASS DIAGRAM

After completing this activity, you should be familiar with the following:
u how to determine the classes that need to be constructed by examining the use case and
the system scope documentation
u how to use a UML modeling tool to create a class diagram

Identifying Classes and Attributes

Examine the following scenario developed for a use case from the user group library application:
After viewing the list of available loan items, members request an item to check out on loan. The librarian enters
the member number and retrieves information about outstanding loans and any unpaid fines. If the member has
fewer than four outstanding loans and does not have any outstanding fines, the loan is processed. The librarian
retrieves information about the loan item to determine if it is currently on loan. If the item is available, it is
checked out to the member.
1. By identifying the nouns and noun phrases in the use case scenario, you can get an
idea of what classes you must include in the system to perform the tasks. Which of the
following items would make good candidate classes for the system?
A. Member
B. Item
C. Librarian
D. Number
E. Fine
F. Checkout

G. Loan
2. At this point, you can start identifying attributes associated with the classes being
developed. A Loan class will be developed to encapsulate data associated with an item
out on loan. Which of the following would be possible attributes for the Loan class?
A. MemberNumber
B. MemberPhone
C. ItemNumber
D. ReturnDate
E. ItemCost
F. ItemType

See the end of the chapter for Activity 2-2 answers.

20
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Creating a Class Diagram

To create a class diagram using UML Modeler, follow these steps (you can also create it by hand):
1. Start UMLet. You are presented with three windows. The main window is the design
surface, the upper right window contains the UML object templates, and the lower right
window is where you change or add properties to the objects.
2. Locate the SimpleClass template in the upper right window (see Figure 2-17). Double
click the SimpleClass template. A SimpleClass will appear in the upper left corner of the
design surface.

Figure 2-17. Adding a class shape

3. In the lower right properties window, change the class name to Member.
4. Repeat the procedure for a Loan, Item, Book, and Movie class.
5. Locate the association template in the upper right window (see Figure 2-18). Double
click the association template. An association will appear in the upper left corner of the
design surface.

Figure 2-18. Adding an association shape

21
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

6. Attach the left end of the association shape to the Member class and the right end to
the Loan class shape. Select the association shape and update the properties in the
properties window so that they match Figure 2-19.

Figure 2-19. Updating association properties

7. Repeat steps 5 and 6 to create a “Contains a” association shape between the Loan class
and the Item class. This should be a one-to-one association.
8. Locate the generalization arrow template in the upper right window (see Figure 2-20).
Double click the generalization shape. A generalization shape will appear in the upper
left corner of the design surface.

Figure 2-20. Adding a generalization arrow

9. Attach the tail end of the generalization arrow to the Book class and the head end to
the Item class shape. Select the generalization arrow and update the properties in the
properties widow so that they match Figure 2-21.

22
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Figure 2-21. Updating generalization properties

10. Repeat steps 8 and 9 to show that the Movie class inherits from the Item class.
11. Click on the Member class in the design window. In the properties window, add the
memberNumber, firstName, lastName, and eMail attributes as shown in Figure 2-22.

Figure 2-22. Adding class attributes

12. Your completed diagram should be similar to Figure 2-23. Save the file as UMLAct2_2.

makes a
Member Loan
0..1 0..4
memberNumber:integer 1
firstName:string
contains a
lastName:string
eMail:string
1
Item

<<inherits>> <<inherits>>

Book Movie

Figure 2-23. Completed class diagram

23
CHAPTER 2 N DESIGNING OOP SOLUTIONS: IDENTIFYING THE CLASS STRUCTURE

Summary
In this chapter, you were introduced to the goals of the object-oriented design process and UML. You learned about
some of the design documents and diagrams produced using UML. These include the SRS, which defines the scope of
the system; use case diagrams, which define the system boundaries and identify the external entities that will use the
system; and class diagrams, which model the structure of the classes that will be developed to implement the system.
You saw how modeling the class structure of your applications includes identifying the necessary classes,
identifying the attributes of these classes, and establishing the structural relationships required among the classes.
In Chapter 3, you will continue your study of object-oriented design. In particular, you will look at modeling how the
objects in your applications will collaborate to carry out the functionality of the application.

ACTIVITY ANSWERS

Activity 2–1 Answers

1. A, B, G. The actors are Member, Librarian, and Secretary.


2. A. Member, B. Secretary, C. Librarian, D. Librarian. The Request Item use case goes with
Member, the Catalog Item use case goes with Secretary, the Lend Item use case goes
with Librarian, and the Process Fine use case goes with Librarian.

Activity 2–2 Answers

1. A, B, C, E, G. The candidate classes are Member, Item, Librarian, Fine, and Loan.
2. A, C, D. The attributes associated with the Loan class are MemberNumber, ItemNumber,
and ReturnDate.

24
CHAPTER 3

Designing OOP Solutions: Modeling


the Object Interaction

The previous chapter focused on modeling the static (organizational) aspects of an OOP solution. It introduced and
discussed the methodologies of the UML. It also looked at the purpose and structure of use case diagrams and class
diagrams. This chapter continues the discussion of UML modeling techniques and focuses on modeling the dynamic
(behavioral) aspects of an OOP solution. The focus in this chapter is on how the objects in the system must interact
with each other and what activities must occur to implement the solution. This is an important aspect of the modeling
processes. These models will serve as the basis for coding the various methods of the classes (identified in Chapter 2)
that will make up the software application.
After reading this chapter, you should be familiar with the following:
u the purpose of scenarios and how they extend the use case models
u how sequence diagrams model the time-dependent interaction of the objects in the system
u how activity diagrams map the flow of activities during application processing
u the importance of graphical user interface design and how it fits into the object-oriented
design process

Understanding Scenarios
Scenarios help determine the dynamic interactions that will take place between the objects (class instances) of
the system. A scenario is a textual description of the internal processing needed to implement the functionality
documented by a use case. Remember that a use case describes the functionality of the system from the viewpoint of
the system’s external users. A scenario details the execution of the use case. In other words, its purpose is to describe
the steps that must be carried out internally by the objects making up the system.
Figure 3-1 shows a Process Movie Rental use case for a video rental application. The following text describes the
use case:
u Preconditions: The customer makes a request to rent a movie from the rental clerk. The
customer has a membership in the video club and supplies the rental clerk with her
membership card and personal identification number (PIN). The customer’s membership is
verified. The customer information is displayed, and the customer’s account is verified to be
in good standing.
u Description: The movie is confirmed to be in stock. Rental information is recorded, and the
customer is informed of the due date.
u Post conditions: None.

25
Another Random Scribd Document
with Unrelated Content
The number of non-combatants was very great, and the total
strength of the companies amounted to eighteen non-commissioned
officers, sixty-four gunners, 140 matrosses, four drummers, and
twenty pioneers.
On the 10th February, 1743, the train left Ghent to join the Allied
Army, which was effected on the 16th May. King George met the
army on the 19th June, and on the 27th was fought the Battle of
Dettingen. The Artillery share in this engagement was small, the
chief points of note in the battle being the gallantry of King George
and of the Duke of Cumberland, and the obstinate bravery of the
infantry, to which—coupled with the blunder of the Duc de
Grammont—the victory was due. The hardships suffered by the
Allies before the battle had been excessive, nor were they removed
by success; so it was considered advisable to fall back on their
supplies instead of following the enemy. The guns present with the
Royal Artillery at the battle were 3-pounders, twenty-four in number.
In the following year, 1744, and also in 1745, considerable
augmentations to the officers with the train had been made, many
having become available by the return of the expedition from the
West Indies. Among others, Colonel Jonathan Lewis was appointed
Second Colonel to the train: and Captains Borgard, Michelson, and
Desaguliers, Lieutenants Charlton, Bennett, and Macbean, and,
somewhat later, Major William Belford, joined it. The last-named
officer was appointed Major to the train, in room of Michelson
deceased.
In 1744, many of the British troops had been recalled, on account of
an expected invasion of England; and so greatly did the French Army
in Flanders outnumber that of the Allies, that no resistance could be
made to its advance, and nothing but a diversion on the part of the
Austrians, which made the French King hasten to the defence of his
own kingdom, prevented the complete subjugation of Holland.
In 1745, the Artillery marched with the army from Ghent, leaving on
the 13th April. The Artillery marched in rear of the Army in the
following order:—First, a sergeant and six miners, two and two; a
tumbril drawn by three horses with miners' tools; two four-horse
waggons, containing Colonel Lewis's baggage; a front guard of
twenty-four gunners and matrosses; a sergeant and two drummers;
Lieutenant Pattison marching in front, and Lieutenant Macbean in
rear; the kettledrum; Colonel Lewis and Captain Michelson on
horseback; the flag-gun, a heavy 6-pounder, on a field-carriage and
limber drawn by nine horses; nine more 6-pounders, drawn as
above, but by seven horses; one spare 6-pounder carriage and
limber, drawn by seven horses; twelve covered tumbrils with stores,
each drawn by three horses; four howitzers with five horses each;
one spare howitzer-carriage and limber, also with five horses; six
covered tumbrils with stores, with three horses each; ten 3-pounders
on "galloping carriages," with four horses each; a travelling forge
cart with three horses; twenty-three powder tumbrils; and three
covered waggons with officers' tents, baggage, &c., with three
horses each. The remaining officers and men marched on the flanks
of the waggons and guns, a gunner marching by every gun, with a
match. A Regiment of infantry formed the escort, the grenadier
company marching in front, the remainder in rear. It should have
been mentioned that in 1744, an increase to the armament of the
train had been made, comprising ten heavy 6-pounders and four 8-
inch howitzers; and in 1745 another company arrived from
Woolwich.
Some of the orders issued by the Duke of Cumberland, who was in
command of the Army at this time, are curious: "It is strictly ordered
by His Royal Highness that none presume to shoot or hunt, whether
officer or private, officers' servants or huntsmen; this to be a
standing order." Again: "Besides the going out of the Provost, there
are fifty Hussars ordered to patrol in the front and rear of the camp,
and to cut to pieces every man that they may find beyond the limits
of the camp."
At Fontenoy, such of the guns as were engaged did good service,
more especially those attached to Ligonier's column, which preceded
its advance, dragged along by ropes, and doing great execution. Had
the Dutch troops fought as well as the British, Fontenoy would have
been a victory for the Allies, instead of a defeat. The loss of the
Royal Artillery was small compared with that of the English infantry.
It comprised Lieutenant Bennett, one sergeant, one gunner, and four
matrosses killed; one conductor, two sergeants, one corporal, six
gunners, and thirteen matrosses wounded; two gunners and four
matrosses missing.
The guns actually present on the field comprehended ten 6-
pounders, twenty-seven 3-pounders, six 1½-pounders,—recently
sent from England—and four 8-inch howitzers.
The officers present at the Battle of Fontenoy were Colonel Pattison,
Lieut.-Colonel Lewis, Major Belford, Captains Michelson, Mace,
Desaguliers, Flight, Captains-Lieutenant Ord, Leith, Brome, and
Johnson, and Lieutenants Pattison, Campbell, Cleaveland, Tovey,
Stranover, T. Smith, McLeod, Macbean, Charlton, Strachey, Northall,
Maitland, Hussey, Pike, B. Smith, Bennett (killed), Mason, Durham,
Knox, Farquharson, Worth, and Lindsay. Many of these had joined
the train just before the battle.
The strength of the Allied Army did not exceed 53,000 men; that of
the French—under Marshal Saxe, and inspirited by the presence of
the King and the Dauphin—approached 80,000. Of the British troops
4000 were killed and wounded, besides 2000 Hanoverians. Fontenoy
was a defeat, but hardly one which can be said to have tarnished in
the slightest the British Arms.
The Duke of Cumberland withdrew his forces in good order. On the
march, an order which is extant shows a novel means of confining
prisoners: "The sergeant of miners is to make a black hole under
ground, and the carpenter to make a door to it with a padlock;
always to be clean straw for the prisoners; and if any sergeant or
corporal suffer anything to go in to them, but bread and water, they
shall be tried for disobedience of orders."
In October, the rebellion in Scotland had created such an alarm that
the whole of the Artillery in Flanders, now amounting to four
companies, was recalled to England.
Prior to their return, however, news had reached the Allied Army,
near Brussels, of the successful result of the Siege of Louisbourg by
the New England troops, and, as a symptom of rejoicing, a review of
the Army was ordered by the Duke of Cumberland, which is
mentioned by General Forbes Macbean in his MS. diary, on account
of a circumstance which can best be described in his own words:
"The Army was drawn up in order of battle, and reviewed by the
Duke: the Park of Artillery was formed in great order on a fine
extensive plain near Vilvorden: the four companies of Artillery under
arms, drawn up, two on the right, and two on the left of the park:
Colonel Pattison, Lieut.-Colonel Lewis, and Major Belford, posted
themselves on horseback in front of the park, when they saluted His
Royal Highness as he passed, by dropping their swords. The other
officers, carrying fusees, only took off their hats as he passed them."
At this time—in 1745—a company was sent to garrison Louisbourg,
and another was sent to Newfoundland, the Regiment at this date
having been increased to ten companies.
The interlude of the Scotch rebellion, which involved the recall of the
companies from Flanders, does not require detailed mention. There
was a good deal of what Albert Borgard would have called useless
marching and counter-marching in England. The Artillery was
successful at Carlisle and Culloden; very unsuccessful at Falkirk. At
Prestonpans, the guns were not served by the Royal Artillery, but by
seamen. At Falkirk, the guns were hard and fast in a bog, and were
not once in action. As soon as the peasant drivers, who had been
engaged with the horses, saw the Royal Army waver, they promptly
fled; and of the eight guns which had accompanied the King's
troops, seven fell into the hands of the enemy. At Culloden, the
victory may be said to have been won by the Artillery. In the words
of Sir Edward Cust, "the guns were so exceedingly well plied that
they made dreadful lanes through some of the clan regiments. It
was with extreme difficulty that the men could be kept in their
places to stand this murderous fire." The Artillery was under the
command of Colonel Belford. Only one company of the Regiment
was at Culloden, the remaining five on home service being at
Woolwich, whence in the preceding winter they had furnished
detachments for service in England at Chester, Carlisle, and
Newcastle. The guns employed during the rebellion were 6-
pounders, 3-pounders, and howitzers.
It is with pleasure that one turns from the story of civil war, always
painful, rarely glorious, to Flanders again, where two companies
were ordered immediately after the suppression of the rebellion. But
before doing so, it is impossible to avoid mentioning a coincidence
which is somewhat singular. As in the Scotch rebellion of 1715, the
disastrous unwieldiness, and the indifferent equipment of the
Artillery trains on the old spasmodic principle, forced upon the
country the idea of a permanent force of Artillery, so in the Scotch
rebellion of 1745, the disaster of Falkirk forced upon the public
attention the folly of a Field Artillery with no assured mobility. In a
contemporary article in the 'Gentleman's Magazine,' quoted by the
author of 'England's Artillerymen,' this feeling found expression; and
as to one Scotch rebellion the Regiment may be said to owe its birth,
so to another it may date the first step in advance made by that
portion of it intended for service in the field. This coincidence
suggests many questions to the student. Is public opinion necessary
to bring about military reform? And is English public opinion on
military questions only awakened when civil or other war thrusts
military blunders in a very prominent and personal way before public
attention? These questions may be answered partly in the
affirmative, and partly in the negative.
It is undoubtedly a consequence of military training, to produce, in a
man's mind, more of an inclination to make the best of what is, than
to suggest change and improvement. And, further, as change for the
better generally implies expense; and as the heads of military, as of
other public departments, have a particular horror of anything
involving increased outlay, it follows that suggestions in that
direction, made by their own subordinates, are received with scant
favour, and the would-be reformers are deterred in every way from
pursuing their inclinations. But the public owes no allegiance to its
officials; and the wildest schemes from an outsider receive an
attention denied to the most practical suggestions from those in the
employment of a department. Although, therefore, the public is
often the father of military advances, it must not hastily be assumed
that this is owing to a want of originality in military men.
Again, although civil war in England demonstrated military defects in
a very special way, it must not be assumed either that these defects
had not been apparent to soldiers before, or that so strong a
measure as civil war was necessary to enlist public opinion. Apart
from the cause above mentioned, which would deter an officer from
recommending change, it must not be inferred that the same
delicacy was shown to the peasantry of other countries, where
transport was required for the Artillery, as to those who were called
upon in England for assistance. Martial law, which would have been
rarely, if ever, enforced upon English peasantry by English
commanders, was freely exercised abroad; and, with this exercise,
the want of mobility was not so frequently allowed to appear. And
with regard to the necessity of an actual, bitter home-experience
being required to awaken public opinion, the recent Franco-German
war proves the contrary. The reports of the value of Artillery in that
campaign were sufficient, without actual and personal observation,
to awaken in the public mind a strong and unanimous resolution to
perfect that arm in England, such as no government could have
dared to thwart. When backed by public opinion in England, a
Government will gladly make changes involving expense, and in fact,
to refuse to do so would be folly; but when that public opinion, even
if foolish and ignorant, is against change or expense, or even
indifferent on the subject, the military reformer within the ranks of
the Army may as well beat the air as urge his suggestions. All these
considerations have to be borne in mind when studying the history
of Army reforms.
The two companies which went to Flanders in 1746, were under the
command of Colonel Lewis; Captain Borgard, Michelson acting as
Major; Lieutenant Brome as Adjutant, and Lieutenant Stranover as
Quartermaster. The number of subaltern officers with the companies
seems excessive, being no less than ten, besides three Captain-
Lieutenants; but a means of employing them was adopted this year,
by distributing the fourteen 3-pounder guns, which were with the
companies, among the seven battalions; two to each battalion under
a Lieutenant. This arrangement was ordered on the 20th July, 1746;
but it is soothing to the student to find on the 23rd of the following
month this pernicious custom suspended, and the battalion guns
ordered to join the reserve.
In 1747, there were five companies in Flanders, three having been
added to the Regiment; and the following was the armament in their
charge: six heavy 12-pounders; six heavy 9-pounders; fourteen
heavy and twelve light 6-pounders: fourteen heavy 3-pounders: two
8-inch howitzers; and six Royal mortars.
In 1748, in addition to the above, thirty-two light 6-pounders were
sent for use with the battalions.
At the battle of Roncoux, the want of Artillery was sorely felt by the
British, the more so, as the enemy was in this arm particularly
strong; and doubtless this led to the great increase made in 1747,
both in men and guns.
The arrival of Colonel Belford to command the Artillery in the winter
of 1746, and during the rest of the campaign, produced a marked
and beneficial effect. Colonel Pattison and Major Lewis were allowed
to retire on full-pay, in January 1748, on account of old age and
infirmities: and their younger successors devoted themselves to
giving a military appearance to the companies under their command.
In this they were greatly assisted, not merely by the improved and
better educated class of officers, now joining from the Academy; but
also by an accidental circumstance which swelled the ranks with
many well-trained soldiers. It is mentioned as follows by old General
Macbean: "About this time, three Regiments of Cavalry being
reduced to Dragoons, and the troopers having it in their option to
remain as Dragoons or be discharged, many of them chose the
latter; and above two hundred of them enlisted into the Artillery.
From this period, the Regiment improved much in appearance, and
in the size of the men, neither of which had been hitherto much
attended to; but receiving at once so many tall men in the corps
may be said to have given rise to the change that has taken place in
regard to the height, strength, and figure of the men which now
compose it." Among other means of training and disciplining the
men under his command during the tedious months when the Army
was in winter quarters, Colonel Belford devoted much time to
practising them in the use of small-arms, and in infantry
manœuvres, never yet practised in the Regiment. So successful was
he, that the Duke of Cumberland reviewed the companies; on which
occasion the gunners of the companies, with their field staffs,
formed upon the right as a company of grenadiers; and the
matrosses, with their muskets, as a battalion. There are not wanting,
in the nineteenth century, men who wish that Colonel Belford's zeal
had taken some other direction; who think the use of Artillerymen,
even on field-days, as infantry, is a misuse; and who would remove
the carbines from the Garrison Artillery, in order that more time
might be allowed for their own special and varied drills. There are
even scoffers, who say that the presence of a body of men in the
garrison under his command, armed and equipped like infantry, is
more than a General Officer can bear; that he is never at rest until
he sees this body swelling his Brigade by another battalion; and that
he inspects it in infantry details more minutely than in those of its
own special arm. Whatever ground there may be for these
complaints, there can be no doubt that Colonel Belford was innocent
of any desire to divert his men from their own work: and merely
availed himself of this, as of other means of disciplining and training
them into habits of smartness and obedience. And among other
things which he borrowed from the infantry, besides their drill, was
that of an Officer's Regimental Guard over the Artillery Park, in
addition to the guard furnished by the Line Regiments, a more
important item than it would at first sight appear to be.
Two Courts-martial, one upon an officer, and one upon a gunner, are
mentioned here, as probably interesting to the reader. Lieutenant
McCulloch, having been tried and found guilty by a General Court-
martial, of disobedience to Colonel Belford's orders, was suspended
for the space of three months, and ordered to make the following
submission: "I am very sorry I am guilty of a neglect of my duty, and
I do particularly ask Colonel Belford's pardon, and will, for the
future, avoid being guilty of a thing of the like nature." Having
complied with the submission, and Colonel Belford having requested
that the remaining part of the sentence might be remitted, the Duke
of Cumberland, being highly pleased with the conduct of the Artillery
at the recent battle of Val, was pleased to accede to the request.
The gunner, who was tried, had been guilty of insubordination
towards a sergeant, and being formally convicted by a Regimental
Court-martial, was sentenced to be "reduced in pay and duty for one
month to matross, ride the gun, ask the sergeant's pardon at the
head of the Regiment, and that the difference of his pay be
employed for the use of the sick."
In reading the accounts of this war between the Allies and the
French, one feels how just was the remark of Louis XV. after Val,
that the "British not only paid all, but fought all." On them fell all the
brunt of every engagement, and the discussion and
misunderstanding which so often prevailed among the Allied
commanders had no effect upon the bravery of the British troops. At
Val, the Artillery had thirty men killed, Major Michelson, Lieutenants
McLeod, Farrington, Dexter, Stephens, Pedley, and nineteen men
wounded; and twenty-five taken prisoners. They received the special
thanks of the Duke for their conduct during this obstinate and
bloody engagement.
The next thing that strikes one is the cool and able generalship of
Marshal Saxe. He had superior numbers under his command; nor did
he suffer from divided counsels, but these advantages do not
conceal his military talent.
Next, to the student's mind, the absurdly luxurious way of making
war then prevalent suggests itself, if the term can be applied to any
contest where loss of life was so great. It was, indeed, a game at
which the leaders played; and in the quiet of their systematic winter-
quarters they devised and matured new moves for the coming
season. How changed is modern warfare! What a different system is
to be read in the stories of the trenches before Sebastopol, or the
winter encampment of the Germans round Paris!
The war gradually filtered itself away into the peace of Aix-la-
Chapelle. After Val came the siege of Bergen-op-Zoom, where
fourteen men of the Royal Artillery were killed; then came winter
quarters at Breda; then came preparations for a new campaign in
1748; although peace was in every one's mind, and the
plenipotentiaries to conclude it had already met; then came the
siege of Maestricht, with its Quixotic ending; and at last came peace
itself. A peace which brought profit neither to England nor to France;
which could not obliterate the long list on the rolls of each nation
which war had entered in the books of death; which, if possible, only
made the folly of the contest more apparent; and which, while it
ceased the actual roll of cannon, and crossing of bayonets, did not
stop the pulsation of hatred in each nation's breast, which was to
throb with increasing vigour, until a new and more bitter war should
gratify the unsmothered longings of each. A peace which—with the
solitary exception of Prussia—seemed to do good, or bring rest to
none but unhappy Flanders, the battleground of Europe, the victim
in every international contest.
But a peace, also, which closed for a time that sterner school of
discipline in which the Royal Artillery had now for years been
studying; in which there had been officers such as Macbean,
Desaguliers, Phillips, and Pattison, learning lessons, which were to
bear fruit in yet grimmer warfare, both in Europe and America; and
on whose black-boards—blank in this respect, when the war
commenced—there had now been indelibly inscribed the words, that
"an Army without Artillery is no Army at all!"
Before closing this chapter, there are one or two points connected
with the Artillery in the field, which deserve mention. First; the
amount of ammunition which was carried in the field with each gun
was as follows:—100 round-shot, and 30 rounds of grape; with the
exception of the long 6-pounder guns, which carried 80 round-shot,
and 40 grape. Second; the stores and ammunition were issued direct
by the Commissaries to the officers commanding Brigades of guns,
i.e. Batteries—on requisition—who had, however, to make their own
cartridges, and fix the wooden bottoms to the round-shot and grape,
after receipt. The wooden bottoms were made by the artificer, called
the turner; and were fastened by the tinman. Another of the
tinman's duties was the manufacture of the tubes—and of boxes to
contain them. Third; luxurious in one sense, as the war was, it had
its hardships, as the following extract will show:—August 27th, 1746.
—"Arrived at camp after a most difficult march, the Artillery
constantly moving for four days and three nights without encamping
—nearly starved; through woods, over mountainous country, with
the bottoms full of rapid little rivers and deep marshes. Almost all
the horses lost their shoes, and men and horses nearly starved. 3rd
September.—Marched from the camp at 3 A.M., and crossed the
Maise, 170 yards broad, over the pontoon bridges, near Maistricht.
The bridges were commenced laying at one o'clock in the morning,
and were completed by seven, when the heads of the column made
their appearance. The French army was in order of battle on the
heights of Hautain, opposite to Visel, where he supposed we were to
pass, with a design to fall upon us when we were partly crossed the
river. 5th September.—The enemy attacked our light troops posted
opposite to Visel, on the Maise, and handled them very roughly;
those that were not killed, being forced into the river, where they
were drowned." Lastly, it is to be noted that, as in all our later wars
before they have lasted any time, the ranks were thinned by disease
and death, and there was a difficulty in replenishing them, even with
recruits. It is to be hoped that the system of reserves recently
organized in the English Army will in future mitigate this evil.
On the return of the Army to England in 1748, three companies of
Artillery were reduced; the officers being gradually brought in, as
vacancies occurred. Among other customs brought by the companies
from Flanders was that of employing fifers as well as drummers:
"the first fifers in the British Army having been established in the
Royal Regiment of Artillery at the end of this war, being taught by
John Ulrich, a Hanoverian fifer, brought from Flanders by Colonel
Belford, when the Allied Army separated."[12]
So much for the school of discipline in Europe. But there had been a
class-room opened in the East, to which the Regiment sent some
pupils. Admiral Boscawen had been ordered to the East Indies, in
command of a mixed naval and military force, including a company
of the Royal Artillery, under Major Goodyear. The force of the enemy,
and the strength of his defences, had been underrated; and it
cannot be said that the expedition was very successful. The
ordnance which accompanied the Artillery consisted of twelve 6-
pounders, six 3-pounders, two 10-inch, three 8-inch, fifteen 5½
inch, and twenty-five 4 ⅖ -inch mortars, all of brass. It was at the
siege of Pondicherry that these guns were used, a siege which lasted
from the 11th of August to the 6th of October, 1748, when Admiral
Boscawen was compelled to raise it after a loss of over 1000 men.
The Royal Artillery lost, out of a total of 148 of all ranks, no less than
forty-three, including Major Goodyear, who fell, mortally wounded,
during the siege, his leg being carried away by a round-shot.
A stop was put to the hostilities by the declaration of peace, but the
presence of Admiral Boscawen enabled him to ratify, in a prompt
manner, that part of the treaty which restored Madras to the English.
Many men of Major Goodyear's company were allowed, in 1749, to
volunteer for the East India Company's service.
But this expedition has an interest to the Artilleryman beyond the
military operations. Before sailing, Admiral Boscawen asserted his
intention, in spite of Major Goodyear's remonstrances, of filling up,
as Commander-in-Chief, any vacancies which might occur in the
company of Artillery.
The Board of Ordnance was appealed to, and most warmly protested
against such an interference with its prerogative,—declaring that
none of the appointments made by the Admiral would be recognized
by the present or any succeeding Master-General. Doubtless, the
Board was right; and Admiral Boscawen, being anxious to retain the
favour of all under his command, let the matter drop. With a
seniority corps, essentially detached when on service, it was
absolutely necessary that promotion should be general, not local. At
the same time, the restraint of the Board was irksome—not the less
so because just; and the feeling could never be agreeable to a
commander, that serving under him were those who owed a special
allegiance to another. As time went on, and the military department
of the Ordnance increased, this irritation would become more
general, and the points of difference between Generals and the
Board would multiply.
The wisdom of the change which put Generals and the Ordnance
Corps under one head might have been proved by à priori, as it has
been by à posteriori reasoning; and this trifling episode between
Admiral Boscawen and the Board is interesting, as showing that,
thirty years after the Regiment had been called into existence, the
Dual Government of the Artillery was already producing natural
consequences. But it is also interesting, as manifesting the affection
which the Board already evinced for the child they had begotten—an
interest sometimes too paternal, but never unlovely.
An excellent letter from the principal officers of the Ordnance is
extant, urging the claims to Army Rank of the officers of the Artillery,
which had been again questioned by some belonging to the other
arms of the service. The difficulty was, in a very few years, settled
by the King, in place of the Master-General, signing the commissions
of Artillery officers; but this letter from the Board is interesting, as
pleading, on grounds of justice and in language far warmer than
could have been expected, the claims of the corps which they had
created. The letter bears date 24th February, 1744, and, after
quoting the decision in favour of Artillery officers arrived at by the
King in 1724, and confirmed in 1735, and mentioning two Courts-
martial held in 1737 and 1742, at which officers of Artillery sat with
those of the other arms, according to date of Commission, goes on
to say that, notwithstanding these facts, there are not wanting those
who deny any military status to Artillery officers in the field. The
writers then state a case, to show the absurdity of the view objected
to:—"If a Captain of Artillery, with a number of guns and Artillery
people, should happen to be escorted by a Lieutenant of a Regiment
on Foot, with a number of men belonging thereto, the Captain
(according to the sentiments of those with whom we differ) must
take his orders from the Lieutenant, which he would, with reason,
think a great hardship; for the Lieutenant would not obey one whom
he deems to be no more than a titular Captain, and who, he is
taught to believe, has no rank in the Army. And if the said Lieutenant
should be killed, and the command devolve to the eldest sergeant,
according to the notion before mentioned, the Captain of Artillery
must take his orders from the said Sergeant of Foot,—the
consequence of which is so obvious, that we need not enlarge upon
it."
"But further, my Lord, should this opinion prevail, it would be a total
discouragement to the officers of Artillery, as well as highly
prejudicial to His Majesty's Service."
"The ordinary duty and discipline of the officers and private men of
the Artillery is, in every respect, the same with that of every other
Regiment of the Army. The qualifications of Artillery officers are not
acquired by practice only, but are the result of long study and
application. They must be proficients in several sciences, and
Masters of several arts, which is not required from other officers.
They are subjected to the Articles of War, and all the penalties of the
Act for Mutiny and Desertion, and are equally a part of His Majesty's
Forces with any other Regiment of the Army. The service of the
Artillery is generally understood to be more dangerous and severe
than any other; and although they are an essential part of one and
the same Army, yet if they bear no rank in it, but at Courts-martial
only, they are in a worse situation and under greater difficulties and
discouragements than any part of the Army; for, let their service
have been ever so long,—their conduct and bravery ever so
conspicuous and meritorious,—they can only rise gradually and
slowly in their own little corps, if they have no rank in the Army, and
can never be promoted in any other, which is the usual and almost
only reward of distinguished merit in other officers."
While sympathizing with the spirit which animated the writers of the
above, one may differ as to the nature of the reward they sought for
meritorious officers of Artillery, in promotion into the other arms. For
more than forty years after this letter was written this reward was
one which was coveted by the senior officers of the corps for the
younger members. Doubtless, the intention was to obtain a
promotion for them which could not be found in the stagnation of a
seniority corps. But, to the modern Artilleryman, the promotion
which involved separation from the Regiment for whose duties he
had been specially trained would be but a doubtful reward.

11. Cust.

12. Macbean's MSS.


CHAPTER XII.
Woolwich in the Olden Time.

L
in the Barracks in the Warren, where the Artillery at Woolwich were stationed, with the exception
ife
of one company, which was detached at Greenwich whenever the Warren was overcrowded, can be
gathered from the Standing Orders which survive in the old MS. order-books in the Royal Artillery
Regimental Library and Royal Artillery Record Office. A few of these orders, extracted from the books
whose contents extend over the period between 1741 and 1757, cannot fail to be interesting.
The establishment of each company at the commencement of that period was as follows:—One Captain,
one Captain-Lieutenant, one First Lieutenant, one Second Lieutenant, three Lieutenant Fireworkers,
three Sergeants, three Corporals, eight Bombardiers, twenty Gunners, sixty-four Matrosses, and two
Drummers—in all, one hundred and seven.
The uniform dress of the officers was a plain blue coat, lined with scarlet, a large scarlet Argyle cuff,
double-breasted, and with yellow buttons to the bottom of the skirts; scarlet waistcoat and breeches—
the waistcoat trimmed with broad gold lace,—and a gold-laced hat. The Sergeants' coats were trimmed,
the lappels, cuffs, and pockets with a broad single gold lace; the Corporals' and Bombardiers' with a
narrow single gold lace; the Gunners' and Matrosses', plain-blue coats; all the non-commissioned
officers and men having scarlet half-lappels, scarlet cuffs, and slashed sleeves with five buttons, and
blue waistcoats and breeches; the Sergeants' hats trimmed with a broad and the other non-
commissioned officers' and men's with a narrow gold lace. White spatterdashes were then worn. The
Regimental clothing was delivered to the non-commissioned officers and men once a year, with the
exception of the Regimental coats, which they only received every second year; receiving in the
intermediate year a coarse blue loose surtout, which served for laboratory work, cooking, fatigue duties,
&c. The arms of the officers were fusees without bayonets, and not uniform. The sergeants, corporals,
and bombardiers were armed with halberds and long brass-hilted swords; "the gunners carried field-
staffs about two feet longer than a halberd, with two lintstock cocks branching out at the head, and a
spear projecting between and beyond them (great care was paid to keeping these very bright); a buff
belt over the left shoulder, slinging a large powder-horn, mounted with brass over the right pocket; and
the same long brass-hilted swords as worn by the non-commissioned officers. The matrosses had only
common muskets and bayonets, with cartouche-boxes."[13]
The variations in the dress of the Regiment which subsequently were made will be noted in their proper
places.
A few of the orders issued by General Borgard are given to show the interior economy of the Regiment
in 1743 and subsequent years:
March 13, 1743. "That the corporals and bombardiers do not drink with any of the private men."
March 29, 1743. "That if any non-commissioned officer or gunner make himself unfit for the King's duty,
either by drinking, whoring, or any other bad practice, he will send them to the Hospital at London for
cure, and discharge them out of the Regiment."
January 30, 1744. "That no man go out a-shooting, on any account whatever."
August 15, 1744. "The Captains to advertise all their deserters in the newspapers."
October 29, 1744. "That none of the people go three miles out of quarters without a passport, in
writing, from the Captain or officer commanding the Company to which they belong."
February 15, 1745. "That neither non-commissioned officers, cadets, nor private men go a-shooting,
either in the Warren or Country, without leave of their officer who commands the company to which
they belong."
April 18, 1746. "That none of the non-commissioned officers strike any of the men, on any pretence
whatsoever; but in case they are guilty of any misbehaviour, confine them prisoners and report them to
the commanding officer. That the Sergeants, Corporals, and Bombardiers enrol in duty all alike."
July 22, 1746. "That the Sergeants and Corporals go round all the Public-houses in Town, and acquaint
them that it is the General's orders that they trust none of the Train people on any account whatever."
October 20, 1746. "That none of the men carry their victuals from the Baker's or any other weight on
their Regimental Hats. That the Orderly Sergeants and Corporals make these orders known to the
same."
November 21, 1746. "That the Captains have all their men provided with a knapsack, two pair of shoes,
three pair of stockings, and three shirts and stocks each."
March 2, 1747. "That none of the men be suffered to go to work in their Regimental coats, but either in
frocks or surtouts."
March 16, 1747. "The men who are taken sick and sent to the Infirmary are to be paid only 3s. 6d. per
week, which money is to be paid the nurse for subsistence; The remainder of their pay to be kept until
they are recovered."
June 16, 1747. "That none of the officers turn any of their horses to graze in the Warren."
January 8, 1749. "That none of the Lieutenants go to London, stay all night out of quarters, change his
guard, or any other duty without the General's or Commanding Officer's leave; that they first apply to
their Captain or Commanding Officer of the Company to which they belong for his consent to be absent,
which if obtained, they may then apply to the commanding officer, and not before; that if any officer
change his guard or other duty without leave, or does not attend the Parade exactly at the Hour of
Mounting, or the proper time when visiting the Barracks, or any other duty is to be done, that the
Adjutant report the same directly to the Commanding Officer in quarters."
February 27, 1749. "The Roll to be called in the Barracks at nine o'clock at night, in presence of the
Officer on Guard, who is to have a Report made to him in writing of those absent. Immediately after the
Roll is called the Orderly Corporals are to go into Town, and each go round their men's quarters (those
in private lodgings as well as those billeted in Public-houses), and make a report to the Officer of the
Guard of those who are absent. The Orderly men are then to go to their Rooms, and the Sergeant of
the Guard to lock both Barrack doors, and bring the keys to his officer, who is to send the Sergeant to
open the doors at Reveillé beating in the morning. The officer shall confine any of those men who are
found absent if they come in during his Guard, and report them to the Commanding Officer at his being
relieved. But, in case they do not come in during his Guard, he is to leave their names with the relieving
officer. If the orderly men find any men absent from quarters over night, they are to go early next
morning to see if they are come home, and, if they find they are, to bring them to the Guard in order to
be examined by the officer and give reasons for being absent the night before. If the orderly men, in
going round, find any man drinking in Public-houses where they are not quartered, they are to order
them home, which if they refuse to comply with, are to bring them directly to the Guard, and confine
them for disobeying orders."
April 1, 1749. "The Orderly Corporals are to report to their respective Captains all non-commissioned
officers and private men who do not parade for church, in order to their being stopped a day's pay,
according to the Articles of War; and if any man is seen to quit his rank after marching from the parade,
and does not go to Church, he shall be punished the same as if he had not paraded, of which the non-
commissioned officers who go to Church are to report at their return to the Orderly Corporals, and they
to the Captains."
There was immense excitement in Woolwich in the spring of 1749. A great firework, made at Woolwich,
was to be exhibited in the Green Park, and the Regiment, for the first time, was to be reviewed by the
King. The Order-books bristle with threats and admonitions, and some of them reveal a power in the
Commanding Officer of which he has long been deprived.
April 16th, 1749. "The officers and men to be under arms to-morrow both morning and afternoon. The
officers to endeavour as much as possible to perfect themselves, both in taking posts and saluting. The
captains to see that their companies march strong, and in as good order as possible, on Tuesday
morning at seven o'clock, in order to their being reviewed on Wednesday by the King. Every man to
parade with his arms and accoutrements as clean as hands can make them; and in case any of their
clothes want mending or buttons, the person so offending shall be severely punished. And the first man
that is seen drunk, or the least in liquor, he shall be immediately brought to ye halberts, and there
receive 300 lashes, and afterwards be drummed out of the Regiment with a rope about his neck. The
guard to mount to-morrow in black spatterdashes, and the officers in boots."
After order. "That all the cadets who desire to see the fireworks be under arms at five o'clock in black
spatterdashes, and their officers in boots, in order to march by Lambeth to the Green Park. They are to
take white spatterdashes in their pockets to appear in."
The discipline among the cadets may be comprehended from the following order:—
October 10, 1840. "Complaints having been made to the Board that the following persons belonging to
the Company of Gentlemen Cadets in the Royal Regiment of Artillery have been very negligent of their
duty, viz., Francis Volloton, Archibald Douglas, &c. &c. And that Francis Volloton has been absent above
twelve months, and not so much as attended the muster, and has otherwise misbehaved himself. It is
the Board's orders that the said Francis Volloton be broke, and the rest suspended from their pay till
they show cause to the contrary."
A previous order to that just quoted shows that boyishness was not confined to the Cadets. An order,
twice issued, appeared on
July 23, 1749. "That none of the men play at long bullet on Plumstead Road, of which they are all to be
acquainted."
August 26, 1749. "When any of the men die or desert, the Captain of the company is to put down the
day in the muster-roll against his name, and the money to be left in the agent's hands from the day
such men died or deserted for recruiting others in their room."
March 14, 1750. "The Captains or commanding officers of companies are to observe that henceforward
no man is to be enlisted under five feet nine inches without shoes."
March 30, 1750. "The Sergeant of the Guard is not to suffer any non-commissioned officer or private
man to go out of the Warren gate unless they are dressed clean, their hair combed and tied up, with
clean stockings, and shoes well blacked, and in every other respect like soldiers. The cooks are
excepted during their cooking hours, but not otherwise."
May 9, 1750. "No subaltern officer is for the future to have a servant out of any of the companies."
July 17, 1750. "The commanding officers of companies are ordered by the general to provide proper
wigs for such of their respective men that do not wear their hair, as soon as possible."
July 25, 1750. "Each company is to be divided into three squads. The officers and non-commissioned
officers to be appointed to them to be answerable that the arms, accoutrements, &c., are kept in
constant good order, and that the men always appear clean."
July 25, 1750. "Joseph Spiers, gunner in Captain Desagulier's company, is by sentence of a Court-
martial broke to a matross, and to receive 100 lashes; but General Borgard has been pleased to forgive
him the punishment."
A General Court-martial was ordered to assemble at the Academy to try a matross for desertion. The
Court, which assembled at 10 A.M. on the 20th October, 1750, was composed of Lieutenant-Colonel
Belford as President, with nine captains and three lieutenants as members.
November 3, 1750. "Sergeant Campbell, in Captain Pattison's company, is by sentence of a Regimental
Court-martial reduced to a Bombardier for one month, from the date hereof, and the difference of his
pay to be stopped."
The death of General Borgard took place in 1751, and he was succeeded by Colonel Belford. This officer
was most energetic in drilling officers and men, and in compelling them to attend Academy and all other
instructions. Even such an opportunity as the daily relief of the Warren guard was turned to account by
him; and the old and new guards were formed into a company for an hour's drill, under the senior
officer present, at guard mounting. From one order issued by him, it would seem as if the authority of
the captains required support, being somewhat weakened perhaps, as is often the case, by the
oversight and interference in small matters by the colonel; for we find it was necessary on March 2,
1751, to order "That when any of the Captains review their companies either with or without arms, all
the officers belonging to them were to be present."
Colonel Belford's weakness for the carbine is apparent in many of his orders.
April 1, 1751. "All the officers' servants who are awkward at the exercise of the small arms to be out
every afternoon with the awkward men, and the rest of them to attend the exercise of the gun."
A most important official must have been expected in the Warren on the 5th August, 1751, for we find
orders issued on the previous evening, as follows:
"The Regiment to be under arms to-morrow morning at nine o'clock. The commanding officers are to
see that their respective men are extremely well-powdered, and as clean as possible in every respect.
The guard to consist to-morrow of one Captain, two Lieutenants, two Sergeants, four Corporals, and
forty men. The forty men are to consist of ten of the handsomest fellows in each of the companies. The
Sergeant of the Guard to-morrow morning is not to suffer anybody into the Warren but such as shall
appear like gentlemen and ladies."
February 7, 1752. "For the future when any man is discharged he is not to take his coat or hat with him,
unless he has worn them a year."
April 6, 1752. "The officer of the Guard is for the future to send a patrol through the town at any time
he pleases between half an hour after ten at night and one in the morning, with orders to the Corporal
to bring prisoners all the men of the Regiment he finds straggling in the streets. The Corporal is likewise
to inspect all the alehouses, where there are lights, and if there are any of the men drinking in such
houses, they are also to be brought to the Guard; but the patrol is by no means to interfere with riot or
anything that may happen among the town-people."
April 20, 1752. "When any man is to be whipped by sentence of a court-martial, the Surgeon, or his
Mate, is to attend the punishment."
February 6, 1753. "The officers are to appear in Regimental hats under arms, and no others."
February 19, 1753. "The officers appointed to inspect the several squads are to review them once every
week for the future; to see that every man has four good shirts, four stocks, four pair of stockings, two
pair of white, and one pair of black spatterdashes, two pair of shoes, &c.; and that their arms,
accoutrements, and clothes are in the best order. What may be required to complete the above number
is to be reported to the commanding officer and the Captains. The officers are likewise to see that the
men of their squads always appear clean and well-dressed like soldiers; and acquaint their Captains
when they intend to review them."
February 20, 1753. "The Captains are to give directions to their Paymasters to see that the initial letters
of every man's name are marked with ink in the collar of their shirts."
April 5, 1753. "The Captains or commanding officers of companies are not to give leave of absence to
any of their recruits or awkward men."
April 29, 1753. "It is Colonel Belford's positive orders that for the future, either the Surgeon or his Mate
always remain in quarters."
May 23, 1753. "No non-commissioned officer or private man to appear with ruffles under arms."
June 15, 1753. "No man to be enlisted for the future who is not full five feet nine inches without shoes,
straight limbed, of a good appearance, and not exceeding twenty-five years of age."
January 2, 1754. "No officer to appear under arms in a bob-wig for the future."
October 19, 1754. "When any of the men are furnished with necessaries, their Paymasters are
immediately to give them account in writing of what each article cost."
October 28, 1754. No Cadet is for the future to take any leave of absence but by Sir John Ligonier, or
the commanding officer in quarters."
November 8, 1754. "In order that the sick may have proper airing, one of the orderly Corporals is every
day, at such an hour as the Surgeon shall think proper, to collect all those in the Infirmary who may
require airing, and when he has sufficiently walked them about the Warren, he is to see them safe into
the Infirmary. If any sick man is seen out at any other time, they will be punished for disobedience of
orders."
March 17, 1755. "All officers promoted, and those who are newly appointed, are to wait on Colonel
Belford with their commissions as soon as they receive them."
July 20, 1755. "If any orderly or other non-commissioned officer shall excuse any man from duty or
exercise without his officer's leave, he will be immediately broke."
August 1, 1755. "As there are bomb and fire-ship stores preparing in the Laboratory, the officers who
are not acquainted with that service, and not on any other duty, will please to attend, when convenient,
for their improvement."
August 8, 1755. "It is ordered that no non-commissioned officer or soldier shall for the future go out of
the Warren gate without their hats being well cocked, their hair well-combed, tied, and dressed in a
regimental manner, their shoes well blacked, and clean in every respect.... And it is recommended to
the officers and non-commissioned officers, that if they at any time should meet any of the men drunk,
or not dressed as before mentioned, to send them to the Guard to be punished."
February 13, 1756. "The Captains are forthwith to provide their respective companies with a knapsack
and haversack each man."
February 16, 1756. "For the future, when any Recruits are brought to the Regiment, they are
immediately to be taken to the Colonel or commanding officer for his approbation; as soon as he has
approved of them, they are directly to be drawn for, and the officers to whose lot they may fall are
forthwith to provide them with good quarters, and they are next day to be put to the exercise."
March 16, 1756. "The Captains are to attend parade morning and afternoon, and to see that the men of
their respective companies are dressed like soldiers before they are detached to the guns."
March 30, 1756. "It is recommended to the officers to confine every man they see dirty out of the
Warren, or with a bad cocked hat."
March 31, 1756. "The officers are desired not to appear on the parade for the future with hats
otherwised cocked than in the Cumberland manner."
April 2, 1756. "It is the Duke of Marlborough's orders that Colonel Belford writes to Captain Pattison to
acquaint General Bland that it is His Royal Highness's commands that the Artillery take the right of all
Foot on all parades, and likewise of dragoons when dismounted."
May 1, 1756. "It is Colonel Belford's orders that no non-commissioned officer, or private man, is to wear
ruffles on their wrists when under arms, or any duty whatsoever for the future."
About this time, a camp was ordered to be formed at Byfleet, where the Master-General of the
Ordnance was present, and as many of the Royal Artillery as could be spared. Most of the Ordnance for
the camp went from the Tower, and the following disposition of the Artillery on the march from London
to Byfleet may be found interesting.

Advanced Guard:—Consisting of 1 non-commissioned officer


and 12 matrosses.

Captain. Lieutenant. Non- Miners. Gunners. Matrosses. Fifer


commissioned
Officers.
Miners' Front 1 3 5 40 .. ..
Guard:
consisting
of
Front Guard 1 2 5 .. .. 45
Eleven 24- 1 2 4 .. 11 11
pounders
Fourteen 12- 1 2 4 .. 14 14
pounders
Twenty 6- 1 3 8 .. 20 20
pounders
Six 3- 1 1 2 .. 6 6
pounders
Six Royal 1 1 8 .. 6 ..
Howitzers
Forty-three 1 2 6 .. .. 86
Ammunition
Waggons
Twenty-two 1 2 4 .. .. 44
Ammunition
Carts
Two spare .. .. 1 .. .. 6
Carriages,
and one
Forge Cart
Four .. .. .. .. .. 8
Waggons,
Intrenching
Tools,
Triangle
Gyn
Twenty-seven .. 1 6 .. .. 54
Baggage-
Waggons
Ten Pontoons, .. .. 5 40 .. ..
and one
spare
Carriage
Rear Guard .. 1 2 .. .. 24
Giving a total of 29 officers, 61 non-commissioned officers, 57 gunners, 330 matrosses, 80 miners, 7
fifers, and 12 drummers.
This train of Artillery left the Tower in July, and remained in Byfleet until October, practising experiments
in mining, and the usual exercises of Ordnance, under the immediate eye of the Master-General himself,
the Duke of Marlborough, who marched at the head of the train, and encamped with it. An interesting
allusion to a custom long extinct appears in the orders relative to the camp. We find certain artificers
detailed for the flag-gun and the flag-waggon. The former was always one of the heaviest in the field;
and the custom is mentioned in 1722, 1747, and in India in 1750. Colonel Miller, in alluding to this
custom in his valuable pamphlet, expresses his opinion that the flag on the gun corresponded to the
Queen's colour, and that on the waggon to the Regimental colour, the latter probably bearing the
Ordnance Arms. The guns had been divided into Brigades, corresponding to the modern Batteries. Four
24-pounders, five 12-pounders, five 6-pounders, and six 3-pounders, respectively, constituted a Brigade.
The howitzers were in Brigades of three. The discipline insisted upon was very strict. Lights were not
allowed even in the sutler's tents after ten o'clock; no man was allowed to go more than a mile from
camp without a pass; officers were not allowed to appear in plain clothes upon any occasion; strong
guards were mounted in every direction, with most voluminous orders to obey,—orders which seem
occasionally unreasonable. The Captain of the Guard had to see the evening gun fired, and was made
"answerable for any accident that might happen"—a somewhat heavy responsibility, as accidents are
not always within the sphere of control, where the executive officer's duties are placed. Whenever the
weather was fine, all the powder was carefully aired, and all articles of equipment requiring repair were
laid out for inspection. The powers of the commanding officers of companies in granting indulgences to
their men were curtailed. No artificer was allowed to be employed at any time on any service but His
Majesty's, without the leave of the Duke of Marlborough himself, or the commandant in the camp; and
should any officer excuse a man from parade he was to be put in arrest for disobedience of orders.
Colonel Belford revelled in the discipline of the camp. It brought back to his mind the old days in
Flanders when he worked so hard to imbue his men with a strict military spirit, and, with the Master-
General by his side, he felt renewed vigour and keenness. The Regiment was attracting greater
attention every year; augmentations were continuous. The year before the Byfleet camp was formed,
six companies had been added: this year there were three more; and in 1757, four additional companies
were to be raised. The King had reviewed the Regiment, and the Duke of Cumberland came to
Woolwich every year to inspect and encourage. Who can tell whether the new organization of 1757,
which divided the Regiment into Battalions and accelerated the stagnant promotion, did not come from
the long days of intercourse at Byfleet between Colonel Belford and the Master-General? The
opportunities offered by such a meeting must have been priceless to a man who was so fond of his
Regiment. Nothing is so infectious as enthusiasm; and we learn from Colonel Belford's orders and letters
that he was an enthusiastic gunner. The early History of the Regiment is marked by the presence in its
ranks of men eminent in their own way, and perfectly distinct in character, yet whose talents all worked
in the same direction, the welfare of their corps. Who could be more unlike than Borgard and his
successor, Colonel Belford? And yet a greater difference is found between the scientific Desaguliers, and
the diplomatic and statesmanlike Pattison, the model of a liberal-minded, high-spirited soldier. These
four men are the milestones along the road of the Regiment's story from 1716 to 1783. They mark the
stages of continuous progress; but there the parallel fails. For they were no stationary emblems. Their
whole life was engrossed in their Regiment. To one, discipline was dear; to another, military science; to
another, gunnery, and the laboratory; and they drew along with them in the pursuits they loved all
those whose privilege it was to serve under them. It was in a small and distinct way a representation of
what the Regiment in its present gigantic proportions would be, if the suggestions quoted in the
commencement of this volume were heartily adopted by all who belong to it. Out of the faded pages
and musty volumes which line the walls of the Regimental Record Office, there seems to come a voice
from these grand old masters, "Be worthy of us!" To them, their corps was everything; to its
advancement every taste or talent they possessed was devoted. With its increased proportions, there
has now come an increased variety of tastes, of learning, and of accomplishments; and the lives of our
great predecessors in the corps read like a prayer over the intervening years, beseeching us all to work
together for the Regiment's good.
If variety of taste is to produce opposition in working, or dissipation of strength and talent, what a cruel
answer the Present gives to the Past! But, if it is to raise the Regiment in the eyes, not merely of
military critics, but of that other world of science, across whose threshold not a few Artillerymen have
passed with honour, then the variety of tastes working together, and yet independently—conducing to
the one great end—is the noblest response that can be made to those who showed us in the Regiment's
earliest days how to forget self in a noble esprit de corps.
13. Macbean's MSS.
CHAPTER XIII.
To 1755.

A
number of interesting events can be compressed into a chapter,
covering the period between the end of the war in Flanders and
the year 1755.
The dress and equipment of the Regiment underwent a change. In
1748, the last year of the war, the field staffs of the gunners, their
powder horns, slings, and swords, and the muskets of the matrosses
were laid aside, and both ranks were armed with carbines and
bayonets—thus paving the way for the step taken in the year 1783,
when the distinction between the two ranks was abolished. The non-
commissioned officers retained their halberds until 1754, when they
were taken from the corporals and bombardiers, who fell into the
ranks with carbines. In 1748, black spatterdashes were introduced
into the Regiment, for the first time into any British corps. In 1750,
the sergeants' coats were laced round the button-holes with gold
looping, the corporals, bombardiers, and the privates having yellow
worsted looping in the same way. The corporals and bombardiers
had gold and worsted shoulder-knots; the surtouts were laid aside,
and complete suits of clothing were issued yearly.[14]
At the end of the war, the Regiment consisted of ten companies, and
for the first time, reliefs of the companies abroad were carried out,
those at Gibraltar and Minorca being relieved by companies at
Woolwich. The strength of the Regiment remained unchanged until
1755, when six new companies were raised, making a total of
sixteen, exclusive of the Cadet company.
The year 1751 was marked by several important Regimental events.
The father of the Regiment, old General Borgard, died; and was
succeeded by Colonel Belford. The vexed question of the Army rank
of Artillery officers was settled by the King issuing a declaration
under his Sign-Manual, retrospective in its effects, deciding "the rank
of the officers of the Royal Regiment of Artillery to be the same as
that of the other officers of his Army of the same rank,
notwithstanding their commissions having been hitherto signed by
the Master-General, the Lieutenant-General, or the principal officers
of the Ordnance, which had been the practice hitherto." From this
date all commissions of Artillery officers were signed by the
sovereign, and countersigned by the Master-General of the
Ordnance.
This year also saw the abolition of an official abuse dating back
before the days of the Regiment's existence. Up to this time, all non-
commissioned officers, gunners, matrosses, and even drummers,
had warrants signed by the Master-General, and countersigned by
his secretary, for which a sergeant paid 3l., a matross or drummer,
1l. 10s., and the intermediate grades in proportion.
This was now abolished, with great propriety, as an old MS. says, "as
no one purpose appears to have been answered by it, but picking of
the men's pockets." Doubtless, there were in the Tower officials who
would not endorse this statement; and who were of opinion that a
very material purpose was answered by it.
In February of this year, also, the officers of the Regiment entered
into an agreement for the establishment of a fund for the benefit of
their widows, no such fund having as yet existed. Each officer
agreed to subscribe three days' pay annually, and three days' pay on
promotion; but this subscription apparently was felt to be too high,
or it was considered proper that some assistance should be rendered
to the fund by the Government, for in 1762 a Royal Warrant was
issued, directing one day's pay to be stopped from each officer for
the Widows' Fund, and that one non-effective matross—in other
words a paper man—should be mustered in each company, the pay
of such to be credited to the fund. By this means it was hoped that
the widow of a Colonel Commandant would obtain 50l. per annum;
of a Lieutenant-Colonel, 40l.; of a Major, 30l.; of a Captain, 25l.; of a
Lieutenant, Chaplain, or Surgeon, 20l.; and of a Lieutenant-
Fireworker, 16l. But, either the officers would not marry, or the
married officers would not die, for in 1772 another warrant was
issued, announcing that the fund was larger than was necessary,
and directing the surplus to be given as a contingent to the Captains
of companies. It is somewhat anticipating matters, but it may here
be said that a few years later the officers of the Regiment again took
the matter into their own hands, and formed a marriage society,
membership of which was nominally voluntary, but virtually
compulsory, until about the year 1850, after which it failed to receive
the support of the corps, its rules not being suited to modern ideas.
On 13th May, 1872, these rules were abrogated at a public meeting
of the officers at Woolwich, and the society, with its accumulated
capital of 50,000l., was thrown open on terms sufficiently modern
and liberal to tempt all who had hitherto refrained from joining it. At
that meeting, the original charter of the society, signed by the
officers serving in the Regiment at the time, was submitted to their
successors, and there was a dumb eloquence in the faded
parchment with its long list of signatures, which it would be
impossible to express in words.
It has already been stated that Colonel Pattison and Major Lewis had
been permitted to retire on full pay, on account of infirmity. The
source from which their income was derived, and the use to which it
was devoted after their death, can best be described in Colonel
Miller's words: "To this purpose there was appropriated the pay
allowed for two tinmen and twenty-four matrosses, the number of
effective matrosses being reduced from forty-four to forty in each
company, whilst forty-four continued to appear as the nominal
strength. At the death of Jonathan Lewis, a warrant dated 25th
September, 1751, approved of the non-effectives being still kept up,
and directed the sum of 273l. 15s. a year (15s. a day) then available
to be applied thus:—173l. 15s. to Colonel Belford (as colonel
commandant), and 100l. to Catherine Borgard, widow of Lieutenant-
General Albert Borgard, towards the support of herself and her two
children, who were left unprovided for. When Colonel Thomas
Pattison died, a warrant dated 27th February, 1753, directed that the
annuity to Mrs. Borgard should in future be paid out of another
source, and applied the balance of the fund derived from the non-
effective tinmen and matrosses to increasing the pay of the
fireworkers from 3s. to 3s. 8d. a day."
"In 1763 the increased pay of the fireworkers was entered in the
estimates, and the pay of colonel commandant was raised to 2l. 4s.
a day."
During the period to which this chapter refers, a review of the
Regiment by the King took place in the Green Park; and as it was
thought worthy of entry in General Macbean's diary, and shows the
way in which the Regiment was formed upon such an occasion, it
may not be deemed out of place in this work. There were five
companies present besides the Cadets, and the numbers were as
follows:—Field officers, three; Captains, five; Captain-Lieutenants,
six; four First, and seven Second Lieutenants; Lieutenant-
Fireworkers, seventeen; one Chaplain, one Adjutant, one
Quartermaster, one Bridge-master, one Surgeon and his Mate, fifteen
Sergeants, fifteen Corporals, one Drum-Major, ten Drummers and six
Fifers, forty Bombardiers, forty-eight Cadets, ninety-eight Gunners,
and 291 Matrosses. The companies were formed up as a Battalion;
three light 6-pounders being on the flanks, and the Cadets formed
up on the right as a Battalion.
Although there was peace for England in Europe up to 1755, there
was no lack of expeditions elsewhere. Besides Jamaica and Virginia,
which demanded guns and stores, Artillery was required for the East
Indies and America. It was for service in the former country that the
augmentation of four companies with an additional Major was made
in March, 1755.
They were raised and equipped in thirty days, and embarked
immediately, the Board giving permission to Major Chalmers, who
was in command, to fill up any vacancies which might occur, by
promoting the senior on the spot. These companies were in the pay
of the East India Company, and formed part of the expedition under
Clive and Admiral Watson. One of the companies was lost on the
passage, only three men being saved. It was Captain Hislop's
company, but that officer had been promoted while serving in the
East Indies, and it was commanded on the voyage by the Captain-
Lieutenant, N. Jones. As soon as the disaster was known in England,
another company was raised, and on its arrival in India Captain
Hislop assumed the command. This officer had gone out with five
officers, sixty men, and twelve cadets, and a small train of Artillery,
attached to the 39th Regiment, under Colonel Aldercon. His new
company was the last of the Royal Artillery which served in Bengal,
until the outbreak of the Indian Mutiny.[15]
The expedition to America was the ill-fated one commanded by
General Braddock. The detachment of Royal Artillery was only fifty
strong; it left England under the command of Captain-Lieutenant
Robert Hind, with two Lieutenants, three Fireworkers, and one
cadet; and on its arrival in America was joined by Captain Ord, who
assumed the command. This officer had been quartered with his
company at Newfoundland; but at the request of the Duke of
Cumberland he was chosen to command the Artillery on this
expedition. The guns which accompanied the train were ten in
number, all light brass guns—four being 12-pounders, and six 6-
pounders. The civil attendants of the train were twenty-one in
number, including conductors and artificers; and there were attached
to the train—attendants not generally found in such lists—"ten
servants, and six necessary women." There were also five Engineers,
and practitioner Engineers.
The melancholy fate of this expedition is well known. The
detachment of Artillery was cut to pieces at Fort du Quesne, on that
ghastly July day in 1755; the whole ten guns were taken; but
Captain Ord himself survived to do good service years after, on the
American continent. It will be remembered by the reader that
George Washington fought on this occasion on the English side, and
displayed the same marvellous coolness and courage, as he did on
every subsequent occasion.
But events were ripening at Woolwich for great Regimental changes.
A small subaltern's detachment left for Dublin, which was to be the
parent of the Royal Irish Artillery, a corps which will form the subject
of the next chapter. In 1756, a company of miners was formed for
service in Minorca, which, on its return to Woolwich, was
incorporated into the Regiment, and two other companies having
been raised in the same year, and four additional in 1757, there was
a total, including the companies of miners and cadets, of twenty-four
companies. The largely increased number of company officers, in
proportion to the limited number of those in the higher grades,
made the prospects of promotion so dismal, that the Regiment was
divided into two Battalions, each of which will receive notice in
subsequent chapters.

14. Cleaveland's MSS. Macbean's MSS.

15. Brown.
CHAPTER XIV.
The Royal Irish Artillery.

T
he Ordnance Department in Ireland was independent of that in
England until the year 1674, when Charles II., availing himself of
the vacancy created by the death of the then Irish Master-
General—Sir Robert Byron—merged the appointment in that of the
Master-General of England; and the combined duties were first
performed by Sir Thomas Chicheley. This officer appointed, as his
deputies in Ireland, Sir James Cuff and Francis Cuff, Esq. The
Masters-General of the Irish Ordnance, whom we find mentioned
after this date, were subordinate to the English Masters-General, in a
way which had never previously been recognized.
Even after the amalgamation, however, the accounts of the Irish and
British Departments of the Ordnance were kept perfectly distinct.
When ships were fitted out for service in the Irish seas, their guns
and stores were furnished from the Irish branch of the Ordnance. All
gunpowder for use in Ireland was issued by the English officials to
the Irish Board on payment; and the lack of funds, which was
chronic at the Tower during the reigns of the Stuarts, was not
unfrequently remedied by calling in the assistance of the Irish Board.
Tenders for the manufacture of gunpowder having been received,
and the orders then given having been complied with, it was no
unusual thing to pay the merchants with Ordnance Debentures, and
to ship the powder to Ireland in exchange for a money payment.
The correspondence between the two Boards throws light upon the
way in which money was found for the English fortifications, and
also gives us the value of gunpowder at various times. For example,
in August, 1684, one thousand barrels were shipped to Ireland; and
the sum received in payment—2500l.—was ordered to be spent on
the fortifications at Portsmouth.
Some of the debentures issued to the creditors of the English
Ordnance, in lieu of money, were on security of the grounds in the
City of London, called the Artillery Grounds, and carried interest at
the rate of two per cent.: others were merely promissory notes
issued by the Board, which bore no very high reputation, nor were
they easily convertible into money. From certain correspondence in
the Tower Library, during the reigns of Charles II. and James II., it
would appear that the Board could not be sued before the Law
Courts for the amount of their debts;—the letter-books of that period
teeming with piteous appeals from the defrauded creditors.
One unhappy man writes that in consequence of the inability of the
Board to meet his claims, he "had undergone extreme hardships,
even to imprisonment, loss of employment, and reputation." Another
in the same year, 1682, writes, that "he is in a very necessitous and
indigent condition, having not wherewithal to supply his want and
necessity; and he doth in all humility tender his miserable condition
to your Honours' consideration."
During periods of actual or expected disturbance in Ireland, stores
for that country were often accumulated in Chester, and on the
Welsh coast, ready for shipment; from which it may be inferred, that
the arrangements in Ireland for their safe keeping were inadequate.
The formation of a battalion of Artillery on the Irish establishment
was not contemplated until the year 1755, when, on the requisition
of the Lord-Lieutenant, a party of twenty-four non-commissioned
officers and men of the Royal Artillery, under the command of a First
Lieutenant, left Woolwich for Dublin, for that purpose. This
detachment, having received considerable augmentation and a
special organization, was in the following year styled "The Artillery
Company in Ireland," the commissions of the officers being dated
the 1st of April, 1756. The company consisted of a Major, a Captain,
one First and one Second Lieutenant, three Lieutenant-Fireworkers,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like