0% found this document useful (0 votes)
17 views55 pages

(Ebook) Re-Engineering Legacy Software by Chris Birchall ISBN 9781617292507, 1617292508

The document provides information about various ebooks available for download on ebooknice.com, including titles related to software engineering and legacy software re-engineering. It features books by authors such as Chris Birchall and Ian Sommerville, with links to access each ebook. Additionally, it includes details about the contents and structure of 'Re-Engineering Legacy Software' by Chris Birchall, emphasizing the importance of maintaining and improving legacy codebases.

Uploaded by

kawashopka2c
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)
17 views55 pages

(Ebook) Re-Engineering Legacy Software by Chris Birchall ISBN 9781617292507, 1617292508

The document provides information about various ebooks available for download on ebooknice.com, including titles related to software engineering and legacy software re-engineering. It features books by authors such as Chris Birchall and Ian Sommerville, with links to access each ebook. Additionally, it includes details about the contents and structure of 'Re-Engineering Legacy Software' by Chris Birchall, emphasizing the importance of maintaining and improving legacy codebases.

Uploaded by

kawashopka2c
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/ 55

Download the Full Ebook and Access More Features - ebooknice.

com

(Ebook) Re-Engineering Legacy Software by Chris


Birchall ISBN 9781617292507, 1617292508

https://ebooknice.com/product/re-engineering-legacy-
software-6770444

OR CLICK HERE

DOWLOAD EBOOK

Download more ebook instantly today at https://ebooknice.com


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

Start reading on any device today!

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James ISBN
9781459699816, 9781743365571, 9781925268492, 1459699815, 1743365578, 1925268497

https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com

(Ebook) Engineering Software Products: An Introduction to Modern Software


Engineering by Ian Sommerville ISBN 9780135210642, 013521064X

https://ebooknice.com/product/engineering-software-products-an-introduction-to-
modern-software-engineering-22694604

ebooknice.com

(Ebook) Engineering Software Products: An Introduction to Modern Software


Engineering by Ian Sommerville ISBN 9781292376349, 1292376341

https://ebooknice.com/product/engineering-software-products-an-introduction-to-
modern-software-engineering-33960916

ebooknice.com

(Ebook) Search-Based Software Engineering: 6th International Symposium, SSBSE 2014,


Fortaleza, Brazil, August 26-29, 2014. Proceedings by Claire Le Goues, Shin Yoo
(eds.) ISBN 9783319099392, 9783319099408, 3319099396, 331909940X

https://ebooknice.com/product/search-based-software-engineering-6th-
international-symposium-ssbse-2014-fortaleza-brazil-
august-26-29-2014-proceedings-4932368

ebooknice.com
(Ebook) Re-Engineering Humanity by Brett Frischmann; Evan Selinger

https://ebooknice.com/product/re-engineering-humanity-7163370

ebooknice.com

(Ebook) Software Engineering for Game Developers (Software Engineering Series) by


Ph.D., John P Flynt, Omar Salem ISBN 9781592001552, 1592001556

https://ebooknice.com/product/software-engineering-for-game-developers-software-
engineering-series-1463414

ebooknice.com

(Ebook) Fundamentals of Software Engineering: Engineering Handbook by Rajat Gupta

https://ebooknice.com/product/fundamentals-of-software-engineering-engineering-
handbook-36522684

ebooknice.com

(Ebook) Agile Processes, in Software Engineering, and Extreme Programming: 16th


International Conference, XP 2015, Helsinki, Finland, May 25-29, 2015, Proceedings
by Casper Lassenius, Torgeir Dingsøyr, Maria Paasivaara (eds.) ISBN 9783319186115,
3319186116
https://ebooknice.com/product/agile-processes-in-software-engineering-and-
extreme-programming-16th-international-conference-xp-2015-helsinki-finland-
may-25-29-2015-proceedings-5141414

ebooknice.com

(Ebook) Business Process Modeling: Software Engineering, Analysis and Applications :


Software Engineering, Analysis and Applications by Jason A. Beckmann ISBN
9781619428003, 1619428008

https://ebooknice.com/product/business-process-modeling-software-engineering-
analysis-and-applications-software-engineering-analysis-and-
applications-51348846

ebooknice.com
Re-Engineering Legacy
Software
Chris Birchall
Copyright

For online information and ordering of this and other Manning books,
please visit www.manning.com. The publisher offers discounts on this
book when ordered in quantity. For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: [email protected]

©2016 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval


system, or transmitted, in any form or by means electronic,
mechanical, photocopying, or otherwise, without prior written
permission of the publisher.

Many of the designations used by manufacturers and sellers to


distinguish their products are claimed as trademarks. Where those
designations appear in the book, and Manning Publications was
aware of a trademark claim, the designations have been printed in
initial caps or all caps.

Recognizing the importance of preserving what has been written,


it is Manning’s policy to have the books we publish printed on acid-
free paper, and we exert our best efforts to that end. Recognizing
also our responsibility to conserve the resources of our planet,
Manning books are printed on paper that is at least 15 percent
recycled and processed without the use of elemental chlorine.
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964

Development editor: Karen Miller


Technical development editor: Robert Wenner
Copyeditor: Andy Carroll
Proofreader: Elizabeth Martin
Technical proofreader: René van den Berg
Typesetter: Dottie Marsico
Cover designer: Marija Tudor

ISBN 9781617292507

Printed in the United States of America

1 2 3 4 5 6 7 8 9 10 – EBM – 21 20 19 18 17 16
Brief Table of Contents
Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About this Book

1. Getting started

Chapter 1. Understanding the challenges of legacy projects


Chapter 2. Finding your starting point

2. Refactoring to improve the codebase


Chapter 3. Preparing to refactor
Chapter 4. Refactoring
Chapter 5. Re-architecting
Chapter 6. The Big Rewrite

3. Beyond refactoring—improving project workflow and infrastructure

Chapter 7. Automating the development environment


Chapter 8. Extending automation to test, staging, and production
environments
Chapter 9. Modernizing the development, building, and
deployment of legacy software
Chapter 10. Stop writing legacy code!

Index
List of Figures

List of Tables

List of Listings
Table of Contents
Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About this Book

1. Getting started

Chapter 1. Understanding the challenges of legacy projects


1.1. Definition of a legacy project
1.1.1. Characteristics of legacy projects
1.1.2. Exceptions to the rule

1.2. Legacy code


1.2.1. Untested, untestable code
1.2.2. Inflexible code
1.2.3. Code encumbered by technical debt

1.3. Legacy infrastructure

1.3.1. Development environment


1.3.2. Outdated dependencies
1.3.3. Heterogeneous environments

1.4. Legacy culture

1.4.1. Fear of change


1.4.2. Knowledge silos

1.5. Summary

Chapter 2. Finding your starting point

2.1. Overcoming feelings of fear and frustration


2.1.1. Fear
2.1.2. Frustration

2.2. Gathering useful data about your software


2.2.1. Bugs and coding standard violations
2.2.2. Performance
2.2.3. Error counts
2.2.4. Timing common tasks
2.2.5. Commonly used files
2.2.6. Measure everything you can

2.3. Inspecting your codebase using FindBugs, PMD, and


Checkstyle

2.3.1. Running FindBugs in your IDE


2.3.2. Handling false positives
2.3.3. PMD and Checkstyle

2.4. Continuous inspection using Jenkins

2.4.1. Continuous integration and continuous inspection


2.4.2. Installing and setting up Jenkins
2.4.3. Using Jenkins to build and inspect code
2.4.4. What else can we use Jenkins for?
2.4.5. SonarQube

2.5. Summary

2. Refactoring to improve the codebase

Chapter 3. Preparing to refactor

3.1. Forming a team consensus

3.1.1. The Traditionalist


3.1.2. The Iconoclast
3.1.3. It’s all about communication

3.2. Gaining approval from the organization

3.2.1. Make it official


3.2.2. Plan B: The Secret 20% Project

3.3. Pick your fights


3.4. Decision time: refactor or rewrite?
3.4.1. The case against a rewrite
3.4.2. Benefits of rewriting from scratch
3.4.3. Necessary conditions for a rewrite
3.4.4. The Third Way: incremental rewrite

3.5. Summary

Chapter 4. Refactoring

4.1. Disciplined refactoring


4.1.1. Avoiding the Macbeth Syndrome
4.1.2. Separate refactoring from other work
4.1.3. Lean on the IDE
4.1.4. Lean on the VCS
4.1.5. The Mikado Method

4.2. Common legacy code traits and refactorings

4.2.1. Stale code


4.2.2. Toxic tests
4.2.3. A glut of nulls
4.2.4. Needlessly mutable state
4.2.5. Byzantine business logic
4.2.6. Complexity in the view layer

4.3. Testing legacy code

4.3.1. Testing untestable code


4.3.2. Regression testing without unit tests
4.3.3. Make the users work for you

4.4. Summary

Chapter 5. Re-architecting
5.1. What is re-architecting?
5.2. Breaking up a monolithic application into modules

5.2.1. Case study—a log management application


5.2.2. Defining modules and interfaces
5.2.3. Build scripts and dependency management
5.2.4. Spinning out the modules
5.2.5. Giving it some Guice
5.2.6. Along comes Gradle
5.2.7. Conclusions

5.3. Distributing a web application into services


5.3.1. Another look at Orinoco.com
5.3.2. Choosing an architecture
5.3.3. Sticking with a monolithic architecture
5.3.4. Separating front end and back end
5.3.5. Service-oriented architecture
5.3.6. Microservices
5.3.7. What should Orinoco.com do?

5.4. Summary

Chapter 6. The Big Rewrite


6.1. Deciding the project scope

6.1.1. What is the project goal?


6.1.2. Documenting the project scope

6.2. Learning from the past


6.3. What to do with the DB

6.3.1. Sharing the existing DB


6.3.2. Creating a new DB
6.3.3. Inter-app communication

6.4. Summary

3. Beyond refactoring—improving project workflow and infrastructure


Chapter 7. Automating the development environment
7.1. First day on the job
7.1.1. Setting up the UAD development environment
7.1.2. What went wrong?

7.2. The value of a good README


7.3. Automating the development environment with Vagrant
and Ansible
7.3.1. Introducing Vagrant
7.3.2. Setting up Vagrant for the UAD project
7.3.3. Automatic provisioning using Ansible
7.3.4. Adding more roles
7.3.5. Removing the dependency on an external database
7.3.6. First day on the job—take two

7.4. Summary

Chapter 8. Extending automation to test, staging, and production


environments

8.1. Benefits of automated infrastructure


8.1.1. Ensures parity across environments
8.1.2. Easy to update software
8.1.3. Easy to spin up new environments
8.1.4. Enables tracking of configuration changes

8.2. Extending automation to other environments


8.2.1. Refactor Ansible scripts to handle multiple
environments
8.2.2. Build a library of Ansible roles and playbooks
8.2.3. Put Jenkins in charge
8.2.4. Frequently asked questions

8.3. To the cloud!


8.3.1. Immutable infrastructure
8.3.2. DevOps

8.4. Summary

Chapter 9. Modernizing the development, building, and


deployment of legacy software

9.1. Difficulties in developing, building, and deploying legacy


software

9.1.1. Lack of automation


9.1.2. Outdated tools

9.2. Updating the toolchain


9.3. Continuous integration and automation with Jenkins
9.4. Automated release and deployment
9.5. Summary

Chapter 10. Stop writing legacy code!

10.1. The source code is not the whole story


10.2. Information doesn’t want to be free

10.2.1. Documentation
10.2.2. Foster communication

10.3. Our work is never done


10.3.1. Periodic code reviews
10.3.2. Fix one window

10.4. Automate everything

10.4.1. Write automated tests

10.5. Small is beautiful

10.5.1. Example: the Guardian Content API

10.6. Summary

Index

List of Figures

List of Tables

List of Listings
Preface

The motivation to write this book has been growing gradually


throughout my career as a software developer. Like many other
developers, I spent the majority of my time working with code
written by other people and dealing with the various problems that
entails. I wanted to learn and share knowledge about how to
maintain software, but I couldn’t find many people who were willing
to discuss it. Legacy almost seemed to be a taboo subject.

I found this quite surprising, because most of us spend the majority


of our time working with existing software rather than writing
entirely new applications. And yet, when you look at tech blogs or
books, most people are writing about using new technologies to
build new software. This is understandable, because we developers
are magpies, always looking for the next shiny new toy to entertain
us. All the same, I felt that people should be talking more about
legacy software, so one motivation for this book is to start a
discussion. If you can improve on any of the advice in this book,
please write a blog about it and let the world know.

At the same time, I noticed that a lot of developers had given up on


any attempt to improve their legacy software and make it more
maintainable. Many people seemed to be afraid of the code that they
maintained. So I also wanted the book to be a call to arms, inspiring
developers to take charge of their legacy codebases.

After a decade or so as a developer, I had a lot of ideas rolling


around in my head plus a few scattered notes that I hoped to turn
into a book someday. Then, out of the blue, Manning contacted me
to ask if I wanted to contribute to a different book. I pitched them
my idea, they were keen, and the next thing I knew I was signing a
contract, and this book was a reality.
Of course, that was only the start of a long journey. I’d like to thank
everybody who helped take this project from a nebulous idea to a
completed book. I couldn’t have done it on my own!
Acknowledgments

This book would not have been possible without the support of
many people. I’ve been lucky enough to work with a lot of highly
skilled developers over the years who have indirectly contributed
countless ideas to this book.

Thanks to everybody at Infoscience, particularly the managers and


senior developers who gave me the freedom to experiment with new
technologies and development methodologies. I like to think I made
a positive contribution to the product, but I also learned a lot along
the way. Special mention goes to Rodion Moiseev, Guillaume
Nargeot, and Martin Amirault for some great technical discussions.

I’d also like to thank everybody at M3, where I had my first taste of
release cycles measured in days rather than months. I learned a lot,
especially from the “tigers” Lloyd Chan and Vincent Péricart. It was
also at M3 that Yoshinori Teraoka introduced me to Ansible.

Right now I’m at the Guardian, where I’m incredibly lucky to work
with so many talented and passionate developers. More than
anything else, they have taught me what it means to really work in
an agile way, rather than merely going through the motions.

I’d also like to thank the reviewers who took the time to read the
book in manuscript form: Bruno Sonnino, Saleem Shafi, Ferdinando
Santacroce, Jean-François Morin, Dave Corun, Brian Hanafee,
Francesco Basile, Hamori Zoltan, Andy Kirsch, Lorrie MacKinnon,
Christopher Noyes, William E. Wheeler, Gregor Zurowski, and Sergio
Romero.

This book also owes a great deal to the entire Manning editorial
team. Mike Stephens, the acquisitions editor, helped me get the
book out of my head and onto paper. Karen Miller, my editor, worked
tirelessly to review the manuscript. Robert Wenner, my technical
development editor, and René van den Berg, technical proofreader,
both made invaluable contributions. Kevin Sullivan, Andy Carroll, and
Mary Piergies helped take the finished manuscript through to
production. And countless other people reviewed the manuscript or
supported me in myriad other ways, some of which I probably didn’t
even know about!

Finally I would like to thank my wife, Yoshiko, my family, my friends


Ewan and Tomomi, Nigel and Kumiko, Andy and Aya, Taka and Beni,
and everybody else who kept me sane while I was writing. Especially
Nigel, because he is awesome.
About this Book

This book is ambitious in scope, setting itself the aim of teaching you
everything you need to do in order to transform a neglected legacy
codebase into a maintainable, well-functioning piece of software that
can provide value to your organization. Covering absolutely
everything in a single book is, of course, an unachievable goal, but
I’ve attempted to do so by approaching the problem of legacy
software from a number of different angles.

Code becomes legacy (by which I mean, roughly, difficult to


maintain) for a number of reasons, but most of the causes relate to
humans rather than technology. If people don’t communicate
enough with each other, information about the code can be lost
when people leave the organization. Similarly, if developers,
managers, and the organization as a whole don’t prioritize their work
correctly, technical debt can accrue to an unsustainable level and the
pace of development can drop to almost zero. Because of this, the
book will touch on organizational aspects time and again, especially
focusing on the problem of information being lost over time. Simply
being aware of the problem is an important first step toward solving
it.

That’s not to say that the book has no technical content—far from it.
We’ll cover a wide range of technologies and tools, including Jenkins,
FindBugs, PMD, Kibana, Gradle, Vagrant, Ansible, and Fabric. We’ll
look in detail at a number of refactoring patterns, discuss the relative
methods of various architectures, from monoliths to microservices,
and look at strategies for dealing with databases during a rewrite.

Roadmap
Chapter 1 is a gentle introduction, explaining what I mean when I
talk about legacy software. Everybody has their own definitions of
words like “legacy,” so it’s good to make sure we understand each
other from the start. I also talk about some of the factors that
contribute to code becoming legacy.

In chapter 2 we’ll set up the infrastructure to inspect the quality of


the codebase, using tools such as Jenkins, FindBugs, PMD,
Checkstyle, and shell scripting. This will give you solid, numerical
data to describe the code’s quality, which is useful for a number of
reasons. First, it lets you define clear, measurable goals for
improving quality, which provides structure to your refactoring
efforts. Second, it helps you to decide where in the code you should
focus your efforts.

Chapter 3 discusses how to get everybody in your organization on


board before starting a major refactoring project, as well as
providing some tips on how to tackle that most difficult of decisions:
rewrite or refactor?

Chapter 4 dives into the details of refactoring, introducing a number


of refactoring patterns that I’ve often seen used successfully against
legacy code.

In chapter 5 we’ll look at what I call re-architecting. This is


refactoring in the large, at the level of whole modules or
components rather than individual classes or methods. We’ll look at
a case study of re-architecting a monolithic codebase into a number
of isolated components, and compare various application
architectures including monolithic, SOA, and microservices.

Chapter 6 is dedicated to completely rewriting a legacy application.


The chapter covers the precautions needed to prevent feature creep,
the amount of influence the existing implementation should have on
its replacement, and how to smoothly migrate if the application has
a database.

The next three chapters move away from the code and look at
infrastructure. In chapter 7 we’ll look at how a little automation can
vastly improve the onboarding process for new developers, which
will encourage developers from outside the team to make more
contributions. This chapter introduces tools such as Vagrant and
Ansible.

In chapter 8 we’ll continue the automation work with Ansible, this


time extending its use to staging and production environments.

Chapter 9 completes the discussion of infrastructure automation by


showing how you can automate the deployment of your software
using tools like Fabric and Jenkins. This chapter also provides an
example of updating a project’s toolchain, in this case migrating the
build from Ant to Gradle.

In chapter 10, the final chapter, I’ll offer a few simple rules that you
can follow to hopefully prevent your code from becoming legacy.

Source code

All source code in the book is in a fixed-width font like


this, which sets it off from the surrounding text. In many listings,
the code is annotated to point out key concepts. In some listings
comments are set within the code, indicating what the developer
would see in the “real world.”

We have tried to format the code so that it fits within the available
page space in the book by adding line breaks and using indentation
carefully.
All the code used in the book is available for download from
www.manning.com/books/re-engineering-legacy-software. It is also
available on GitHub at https://github.com/cb372/ReengLegacySoft.

Author Online

Purchase of Re-Engineering Legacy Software includes free access to


a private web forum run by Manning Publications where you can
make comments about the book, ask technical questions, and
receive help from the author and from other users. To access the
forum and subscribe to it, point your web browser to
www.manning.com/re-engineering-legacy-software. This page provides
information on how to get on the forum once you are registered,
what kind of help is available, and the rules of conduct on the forum.
It also provides links to the source code for the examples in the
book, errata, and other downloads.

Manning’s commitment to our readers is to provide a venue where a


meaningful dialog between individual readers and between readers
and the author can take place. It is not a commitment to any specific
amount of participation on the part of the author, whose contribution
to the forum remains voluntary (and unpaid). We suggest you try
asking the author challenging questions lest his interest strays!

The Author Online forum and the archives of previous discussions


will be accessible from the publisher’s website as long as the book is
in print.

About the author

Chris Birchall is a senior developer at the Guardian in London,


working on the backend services that power the website. Previously
he has worked on a wide range of projects including Japan’s largest
medical portal site, high-performance log management software,
natural language analysis tools, and numerous mobile sites. He
earned a degree in Computer Science from the University of
Cambridge.

About the cover

The figure on the cover of Re-Engineering Legacy Software is


captioned “Le commisaire de police,” or “The police commissioner.”
The illustration is taken from a nineteenth-century collection of
works by many artists, edited by Louis Curmer and published in Paris
in 1841. The title of the collection is Les Français peints par eux-
mêmes, which translates as The French people painted by
themselves. Each illustration is finely drawn and colored by hand and
the rich variety of drawings in the collection reminds us vividly of
how culturally apart the world’s regions, towns, villages, and
neighborhoods were just 200 years ago. Isolated from each other,
people spoke different dialects and languages. In the streets or in
the countryside, it was easy to identify where they lived and what
their trade or station in life was just by their dress.

Dress codes have changed since then and the diversity by region, so
rich at the time, has faded away. It is now hard to tell apart the
inhabitants of different continents, let alone different towns or
regions. Perhaps we have traded cultural diversity for a more varied
personal life—certainly for a more varied and fast-paced
technological life.

At a time when it is hard to tell one computer book from another,


Manning celebrates the inventiveness and initiative of the computer
business with book covers based on the rich diversity of regional life
of two centuries ago, brought back to life by pictures from
collections such as this one.
Part 1. Getting started

If you’re planning to re-engineer a legacy codebase of any


reasonable size, it pays to take your time, do your homework, and
make sure you’re going about things the right way. In the first part
of this book we’ll do a lot of preparatory work, which will pay off
later.

In the first chapter we’ll investigate what legacy means and what
factors contibute to the creation of unmaintainable software. In
chapter 2 we’ll set up an inspection infrastructure that will allow us to
quantitatively measure the current state of the software and provide
structure and guidance around refactoring.

What tools you use to measure the quality of your software is up to


you, and it will depend on factors such as your implementation
language and what tools you already have experience with. In
chapter 2 I’ll be using three popular software-quality tools for Java
called FindBugs, PMD, and Checkstyle. I’ll also show you how to set
up Jenkins as a continuous integration server. I’ll refer to Jenkins
again at various points in the book.
Chapter 1. Understanding the challenges of
legacy projects
This chapter covers

What a legacy project is


Examples of legacy code and legacy infrastructure
Organizational factors that contribute to legacy projects
A plan for improvement

Hands up if this scene sounds familiar: You arrive at work, grab a


coffee, and decide to catch up on the latest tech blogs. You start to
read about how the hippest young startup in Silicon Valley is
combining fashionable programming language X with exciting NoSQL
datastore Y and big data tool Z to change the world, and your heart
sinks as you realize that you’ll never find the time to even try any of
these technologies in your own job, let alone use them to improve
your product.

Why not? Because you’re tasked with maintaining a few zillion lines
of untested, undocumented, incomprehensible legacy code. This
code has been in production since before you wrote your first Hello
World and has seen dozens of developers come and go. You spend
half of your working day reviewing commits to make sure that they
don’t cause any regressions, and the other half fighting fires when a
bug inevitably slips through the cracks. And the most depressing
part of it is that as time goes by, and more code is added to the
increasingly fragile codebase, the problem gets worse.

But don’t despair! First of all, remember that you’re not alone. The
average developer spends much more time working with existing
code than writing new code, and the vast majority of developers
have to deal with legacy projects in some shape or form. Secondly,
remember that there’s always hope for revitalizing a legacy project,
no matter how far gone it may first appear. The aim of this book is
to do exactly that.

In this introductory chapter we’ll look at examples of the types of


problems we’re trying to solve, and start to put together a plan for
revitalization.

1.1. Definition of a legacy project

First of all, I want to make sure we’re on the same page concerning
what a legacy project is. I tend to use a very broad definition,
labeling as legacy any existing project that’s difficult to maintain or
extend.

Note that we’re talking about a project here, not just a codebase. As
developers, we tend to focus on the code, but a project
encompasses many other aspects, including

Build tools and scripts


Dependencies on other systems
The infrastructure on which the software runs
Project documentation
Methods of communication, such as between developers, or
between developers and stakeholders

Of course, the code itself is important, but all of these factors can
contribute to the quality and maintainability of a project.

1.1.1. Characteristics of legacy projects

It’s neither easy nor particularly useful to lay down a rule about what
counts as a legacy project, but there are a few features that many
legacy projects have in common.
Old

Usually a project needs to exist for a few years before it gains


enough entropy to become really difficult to maintain. In that time, it
will also go through a number of generations of maintainers. With
each of these handoffs, knowledge about the original design of the
system and the intentions of the previous maintainer is also lost.
Large

It goes without saying that the larger the project is, the more
difficult it is to maintain. There is more code to understand, a larger
number of existing bugs (if we assume a constant defect rate in
software, more code = more bugs), and a higher probability of a
new change causing a regression, because there is more existing
code that it can potentially affect. The size of a project also affects
decisions about how the project is maintained. Large projects are
difficult and risky to replace, so they are more likely to live on and
become legacy.
Inherited

As is implied by the common meaning of the word legacy, these


projects are usually inherited from a previous developer or team. In
other words, the people who originally wrote the code and those
who now maintain it are not the same individuals, and they may
even be separated by several intermediate generations of
developers. This means that the current maintainers have no way of
knowing why the code works the way it does, and they’re often
forced to guess the intentions and tacit design assumptions of the
people who wrote it.
Poorly documented

Given that the project spans multiple generations of developers, it


would seem that keeping accurate and thorough documentation is
essential to its long-term survival. Unfortunately, if there’s one thing
that developers enjoy less than writing documentation, it’s keeping
that documentation up to date. So any technical documents that do
exist must invariably be taken with a pinch of salt.

I once worked on the software for a forum in which users could post
messages in threads. The system had an API that allowed you to
retrieve a list of the most popular threads, along with a few of the
most recently posted messages in each of those threads. The API
looked something like the following listing.
/**
* Retrieve a list of summaries of the most popular threads.
*
* @param numThreads
* how many threads to retrieve
* @param recentMessagesPerThread
* how many recent messages to include in thread summary
* (set this to 0 if you don't need recent messages)
* @return thread summaries in decreasing order of popularity
*/
public List<ThreadSummary> getPopularThreads(
int numThreads, int recentMessagesPerThread);

According to the documentation, if you only wanted a list of threads


and you didn’t need any messages, you should set
recentMessagesPerThread to 0. But at some point the behavior
of the system changed, so that 0 now meant “include every single
message in the thread.” Given that this was a list of the most
popular threads in the application, most of them contained many
thousands of messages, so any API call that passed a 0 now
resulted in a monster SQL query and an API response many MB in
size!

1.1.2. Exceptions to the rule

Just because a project fulfills some of the preceding criteria doesn’t


necessarily mean it should be treated as a legacy project.
A perfect example of this is the Linux kernel. It’s been in
development since 1991, so it’s definitely old, and it’s also large.
(The exact number of lines of code is difficult to determine, as it
depends on how you count them, but it’s said to be around 15
million at the time of writing.) Despite this, the Linux kernel has
managed to maintain a very high level of quality. As evidence of this,
in 2012 Coverity ran a static analysis scan on the kernel and found it
to have a defect density of 0.66 defects/kloc, which is lower than
many commercial projects of a comparable size. Coverity’s report
concluded that “Linux continues to be a ‘model citizen’ open source
project for good software quality.” (The Coverity report is available at
http://wpcme.coverity.com/wp-content/uploads/2012-Coverity-Scan-
Report.pdf.)

I think the primary reason for Linux’s continued success as a


software project is its culture of open and frank communication. All
incoming changes are thoroughly reviewed, which increases
information-sharing between developers, and Linus Torvalds’
uniquely “dictatorial” communication style makes his intentions clear
to everybody involved with the project.

The following quote from Andrew Morton, a Linux kernel maintainer,


demonstrates the value that the Linux development community
places on code review.

Well, it finds bugs. It improves the quality of the code.


Sometimes it prevents really really bad things from getting into
the product. Such as rootholes in the core kernel. I’ve spotted a
decent number of these at review time.

It also increases the number of people who have an


understanding of the new code—both the reviewer(s) and those
who closely followed the review are now better able to support
that code.
Exploring the Variety of Random
Documents with Different Content
right and proper; but to exalt this into a command, and represent
obedience to it as a meritorious act, is to turn the mind to trivial
outward performances, and to teach men to rest on them as on the
great duties of religion. And here the mere putting of the house into
order is represented as so grave a matter, that two angels are sent
home with every Israelite on the Sabbath eve, to take cognizance of
the matter. The story of the angels is evidently a fable, and is
another proof of the fictitious character of the oral law; but it shows
how the rabbies wandered from the substance of religion to the mere
shadow of external observances. The Sabbath lamp here mentioned
is another instance of the same kind:—
‫ויהא זהיר לעשות נר יפה דאמר רב הונא הרגיל בנר שבת להשתדל בו לעשותו‬
‫יפה הוין ליה בנים תלמידי חכמים ׃‬
“Let a man be careful to have a handsome lamp, for Rav Huna says,
He that is accustomed to take great care in trimming his Sabbath
lamp well, will have children who shall be disciples of the wise, i.e.
learned men.” No one can deny that this is a mere external act, but
yet it is represented as meritorious, and payment is promised: but
the mode in which the performance is required is still more
calculated to promote the idea, that this external act is of great
importance:—
‫ואחד אנשים ואחד נשים חייבין להיות בבתיהן נר דלוק בשבת אפילו אין לו מה‬
‫יאכל שואל על הפתחים ולוקח שמן ומדליק את הנר שזה בכלל עונג שבת וחייב‬
‫לברך קודם הדלקה ברוך אתה יי אלהינו מלך העולם אשר קדשנו במצוותיו וצונו‬
‫להדליק נר של שבת ׃‬
“Men and women are equally obligated to have a lighted lamp in
their house on the Sabbath. Yea, though a man have nothing to eat,
he must beg from door to door, and get oil, and light the lamp, for
this is an essential part of the Sabbath delight. He is also bound to
pronounce the benediction, Blessed art thou, O Lord, King of the
world! who has sanctified us by his commandments, and
commanded us to light the Sabbath lamp.” (Hilchoth Shabbath, c. v.
1.) Of course every Jew, who thinks that a Sabbath lamp is as
necessary as food, and that God requires it even from him that has
no food, must think that it is of great value, and that obedience to this
command is a most meritorious act. And yet all must confess that it
is a mere outward performance, which may be observed by him who
has neither the fear nor the love of God. The tendency of all these
laws is the same, that is, to draw the mind away from the solemn
duties of religion, and to persuade the impenitent sinner that these
observances will atone for his transgressions. When conscience
reminds him of sins, not those which he has committed long since, of
which he has repented, and which, he has forsaken, but of those
which he has been committing the past week, and intends to commit
again, as soon as the Sabbath is over, it is silenced by an
enumeration of the various acts of obedience, which are to be set
down at the other side of the account. He remembers that he has
never left a pot of victuals on a forbidden fire, nor carried his purse
on the Sabbath-day a distance of more than four ells, nor asked a
Gentile to do work for him. That, on the contrary, he has always
prepared his table, and lighted his Sabbath lamp, and pronounced
the benediction; or, in other words, that he has kept the Sabbath
according to its constitution, and that, therefore, though he had been
guilty of idolatry, he shall obtain forgiveness. Thus these rabbinic
precepts have a direct tendency to mislead the multitude, to harden
them in sin, and thus to make and keep them unfit for that great
Sabbath, which yet remains for the people of God.
No. XXX.
SABBATIC LAWS CONTINUED.

That religion, which is true, and has God for its author, is, like the
light of the sun, the common property of all who will only open their
eyes, and gaze upon the gift of God. It is not a religion for the rich or
the studious only, but is equally open to the understanding and the
hearts of the poor and unlearned. And therefore the Bible describes
the heavenly wisdom thus—“She standeth in the top of high places,
by the way in the places of the paths; she crieth at the gates at the
entry of the city, at the coming in at the doors: Unto you, O men, I
call; and my voice is to the sons of man. O ye simple, understand
wisdom; and, ye fools, be of an understanding heart.” (Prov. viii. 2-5.)
And so God invites men of every class by the mouth of the prophet
—“Ho, every one that thirsteth, come ye to the waters, and he that
hath no money; come ye, buy and eat; yea, come, buy wine and milk
without money and without price.” (Isa. lv. 1.) Every religion of man’s
making, presents, on the contrary, peculiar advantages to the rich
and the learned. It offers salvation either as the purchase of
almsgiving, or as the reward of religious study, or it makes religion so
difficult and intricate as to put it out of the poor labouring man’s
power to acquire any competent knowledge of its requirements. And
any system that does so must necessarily be false. Religion is as
necessary to the soul as daylight is to the corporeal eye, and it would
be a hard case, indeed, if the poor, who want it most, should be
excluded from the possibility of acquiring its consolations; or if, in the
day of judgment, the man who devotes his life to books should have
a better chance, than he who labours hard to get an honest living for
himself and his family; yet this is the case with the labouring classes
of the Jews. The religion of the oral law has so perplexed even the
simplest commandments, that an unlearned man has no chance of
being able to keep them. If nothing more were required for salvation
than the rabbinic sanctification of the Sabbath-day the majority of the
Jewish people must despair of attaining it; for the accurate
knowledge of the innumerable precepts and distinctions, which is
indispensable to obedience, requires time and study, which no
labouring man can bestow. And we are convinced that a
considerable portion of the Jewish population of this city live in
continual profanation of the Sabbath-day, if the rabbinic explanations
be true. Either they move something which they ought not to move,
or they carry something which they ought not to carry; and, if they do
it wilfully, render themselves liable to the utmost severity of the law.
For instance, the rabbies have determined that in one place it is
lawful to move or carry certain things on the Sabbath-day, but in
another place the very some act is unlawful, and calls down extreme
punishment. They distinguish between these places thus—
‫ רשות‬, ‫ רשות היחיד ורשות הרבים כרמלית ומקום פטור‬, ‫ארבע רשויות לשבת‬
‫היחיד הוא המקום המוקף מחיצות גבוהות עשרה ויש בו ארבעה טפחים על‬
‫ארבעה ואפילו אם יש בו כמה מילין אם מוקף לדירה ודלתותיו נעולות בלילה הוי‬
‫ וכן חריץ עמוק עשרה ורחב ד׳ על ד׳ או יותר וכן‬. ‫ ודיר וסהר וחצר‬, ‫רשות היחיד‬
‫ וכותלים המקיפין רשות היחיד על גביהן‬, ‫תל גבוה י׳ ורחב ארבעה על ארבעה‬
‫ ואויר רשות היחיד הוא רשות היחיד עד לרקיע ואפילו כלי‬, ‫וחוריהן רשות היחיד‬
‫ ורשות‬, ‫אם גבוה י׳ ורחב ד׳ על ד׳ כגון תיבה או כוורת או מגדל הוי רשות היחיד‬
‫היחיד הוא רחובות ושווקים הרחבים י׳ אמה על י׳ אמה ומפולשים משער לשער‬
‫ וכל דבר שהוא ברשות הרבים ואינו גבוה ג׳ טפחים חשוב‬, ‫וששים רבוא עוברין בו‬
‫ ואם‬, ‫כקרקע והוא רשות הרבים אפילו קוצים או צואה שאין רבים דורסין עליהם‬
‫הוא גבוה ג׳ ומג׳ עד ט׳ ולא ט׳ בכלל אם הוא רחב ד׳ על ד׳ הוי כרמלית פחות‬
‫מכאן הוי מקום פטור ׃‬
In reference to the Sabbath, places are distinguished into four sorts
of jurisdiction. 1st, the private jurisdiction; 2d, the public jurisdiction;
3d, the place called Karmelith; 4th, the place which is free.
By a private jurisdiction is meant a place surrounded by walls, ten
handbreadths high, and in which there is a space of four
handbreadths by four. But even though it should contain many miles,
if it be inclosed for habitation, and its gates be bolted at night, it is a
private jurisdiction. A lodging-place, an inclosed space, and a court,
are considered as in the same class. And thus, also, a pit which is
ten handbreadths deep, and whose breadth is four by four, or more;
and a raised place which is ten handbreadths high, and whose
breadth is four by four. The top of the walls, also, by which a private
jurisdiction is surrounded, and the openings in them, are considered
as private jurisdiction. The air of a private jurisdiction, up to the
firmament, is also considered; and even a vessel like a chest, if it be
ten handbreadths high, and in breadth four by four. A hollow vessel,
or a tower, is also considered as a private jurisdiction.
The term public jurisdiction includes roads and streets, if their
breadth be sixteen ells by sixteen, and they be open from gate to
gate, and six hundred thousand persons pass thereon. And
everything in a public jurisdiction, which is not three handbreadths
high, is reckoned as the ground, and is public jurisdiction: even
thorns and filth upon which the public does not tread.
But if it be from three to nine handbreadths high, but not nine
entirely, and its breadth be four by four, it is called a Karmelith.
“If it be less, it is called a free place.” (Orach Chaiim, 344.)
Now it may well be doubted, concerning many Jews in this city,
whether they are acquainted with even this portion of the Sabbath
laws, but it is quite certain that they are ignorant of the innumerable
modes of possible transgression which arise from these distinctions;
for the oral law then goes on to define what is lawful concerning
each. In a public jurisdiction he may move anything four ells:—
‫כל אדם יש לו ד׳ אמות ברשות הרבים שיכול לטלטל בהם ׃‬
“Every man has got four ells within which he may move things.” Or,
as Rambam expresses it—
‫רשות היחיד ומקים פטור מותר לטלטל בכולן אפילו היה אורך כל אחת משתיהן‬
‫ אבל רשות הרבים והכרמלית אין מטלטלין בהן אלא‬, ‫כמה מילין מטלטל בכולה‬
‫בארבע אמות ׃‬
“In a private jurisdiction, and in a free place it is lawful to move things
the whole length of the place, even though the length of each should
be many miles. But in a public jurisdiction or a Karmelith things may
not be moved more than four ells.” (Hilchoth Shabbath, c. xxiv. 11.)
Now, it may well be asked, upon what passage of the law of Moses
these distinctions are grounded, and what there is in a public
jurisdiction which converts an act lawful in a private jurisdiction, into
a sin to be expiated only by stoning the offender? For instance, in a
private jurisdiction a man may carry certain matters for miles without
violating the Sabbath commands, but if he venture out into a public
jurisdiction with a pocket-handkerchief or a snuff-box, or a half-crown
in his pocket, and carry it only five ells, he is guilty of death; and if
the Talmudists held the reigns of power, would be led out as soon as
the Sabbath was over, and stoned. Reason revolts against such
doctrine, the act is the very same in both cases, and is therefore in
both cases a sin, or in both cases lawful. Humanity shudders at the
thought of stoning a man for carrying a pocket-handkerchief, and the
Bible teaches us that a religion, teaching such inexorable and
wanton cruelty, cannot be from God. It is true that at present the
power of Christianity protects Israelites from such harsh treatment;
but wherever the Talmud has any degree of influence, Israel groans
under its bondage. Many a time have we seen Jews with their
pocket-handkerchief tied round their knee like a garter, for this is
lawful, though to carry it in his pocket would be a grave and capital
offence. And we once knew an Israelite who was taking a walk on
the Sabbath-day, and being addressed by a Gentile beggar, put his
hand into his pocket and gave the poor man a small coin. He was
observed by some Talmudists, who immediately attacked him for his
profanation of the Sabbath. Afraid of losing his character, and being
at that time more anxious for the praise of man than that which
cometh of God, he defended himself by saying, that he had
unintentionally taken out the money in his pocket, but had
remembered it when addressed by the beggar, and therefore took
the opportunity of getting rid of that which it was not lawful to carry.
The Talmudists were satisfied, and their wrath changed into profound
admiration for his piety. These cases exemplify the practical working
of the rabbinic system. It burdens the consciences of the sincere,
and makes the unscrupulous hypocrites. It may be replied that such
things could not happen in England, and that here the Jews are too
enlightened to observe such distinctions. But every one who makes
this reply condemns modern Judaism as a religion unfit for the
observation of the enlightened, and if he be a conscientious man,
should protest against doctrines which he believes to be false, and
laws which he abhors as cruel. These Sabbatic laws are a part, an
essential part, of modern Judaism. There is not any part of the oral
law upon which Talmudists lay more stress. The man, therefore, who
does not observe them has changed his religion. He has got a new
faith, as really, as if he had been baptized and professed Christianity.
Every Israelite who carries a pocket-handkerchief in his pocket
through the streets of London on the Sabbath-day, has apostatized
from that Jewish religion, which has been professed for near two
thousand years, and practically declares that the religion of the
synagogue is false. How then can he, without hypocrisy, profess to
believe in the religion of the Jews? or how can he, as an honest
man, uphold a system which he regards as false, and which would
have him executed as a criminal if it had the power? If such persons,
who live in the habitual transgression of all the Sabbatic laws, have
any regard for truth and for Divine revelation, they should openly
declare their sentiments, announce to the world that they have
forsaken the religion of their fathers, and assert that religion which
they regard as true. The blindest and most bigoted Talmudist is a far
more respectable man, and more acceptable in the sight of God,
than he who pretends to profess a religion in which he does not
believe, and whose precepts he regards as fanatical and
superstitious.
But to return. From the above laws it appears that it is a sin to carry
anything in a public jurisdiction a distance of more than four ells. But
suppose, then, that there was something which the Talmudists might
find it convenient or desirable to move to a greater distance, is there
no provision to effect its conveyance? Yes. These scrupulous
persons, who would stone a man to death for carrying anything five
ells, have an expedient for conveying it a hundred miles if necessary:

‫לגיכך מותר לאדם לעקור החפץ מרשות הרבים ולתנו לחברו שאצלו בתוך ד׳‬
‫אמותיו וחברו לחברו שאצלו אפילו ק׳ מילין אע׳׳פ שהחפץ הולך כמה מילין ברשות‬
‫הרבים שכל אחד לא יטלטלנו אלא בתוך ד׳ אמותיו ׃‬
“Therefore it is lawful for a man to move a matter from the public
jurisdiction, and to give it to his neighbour, who is within a distance of
four ells; and his neighbour to his neighbour again, and so on, even
for a hundred miles. For although the thing itself go many miles,
each person has only moved it his four ells.” (Orach Chaiim, 348.)
We have often heard of the wonderful effects of division of labour,
but never knew before that it could convert a capital offence into an
innocent employment. Surely it is not necessary to prove that if it be
unlawful for one person to do a particular act, it is equally unlawful
for a hundred persons to combine for its performance. This law really
has more the appearance of a caricature devised by some enemy of
the oral law, than the grave decision of religious men in a matter of
life and death. But if we examine a little further, we shall find that it is
unlawful to move this same thing, whatever it be, from one
jurisdiction to another, though that other be close at hand:—
‫כשם שאסור לטלטל בכל הכרמלית אסור להוציא ממנה לרשות היחיד או לרשות‬
‫ ואם הוציא או‬, ‫הרבים או להכניס לכרמלית מרשות היחיד או מרשות הרבים‬
‫הכניס פטור ׃‬
“As it is unlawful to move anything in the place called Karmelith, so it
is unlawful to carry anything out of it into a public or private
jurisdiction, or, vice versa, to introduce anything from either of these
into the Karmelith. But if any one does either he is not guilty,” that is,
he is only to get a flogging, but not to be stoned. An unlearned man
who had already seen something conveyed by the above expedient,
might easily be led to commit an offence of this kind. His untutored
mind might not perceive why the one should be sinful, if the other
was lawful; but such an assertion of common sense would draw
down certain chastisement. At all events, he might be tempted to put
his head from one jurisdiction into another, especially if he was
standing in the street, and was offered a drink by a friend in a house,
he might put his head into the window and take what was offered,
but would soon find, to his cost, that he had broken one of the
Sabbatic laws:—
‫לא יעמוד אדם ברשות היחיד ויוציא ראשו לרשות הרבים וישתה שם או איפכא‬
‫אלא אם כן יכניס ראשו ורובו למקים שהוא שותה דכיון שהוא צריך לאלו המים אנו‬
‫חוששין שמא יביאם אליו אבל מותר לעמוד ברשות היחיד או ברשות הרבים‬
‫ולשתות בכרמלית ׃‬
“A man may not stand in a private jurisdiction, and put forth his head
into a public jurisdiction, and then drink, or vice versa. But if he does
so, let him introduce his head and most of his body into the place in
which he drinks, for as he wants the water, we fear lest he should
take it to himself (into the place where he is standing). But it is lawful
to stand in a private or public jurisdiction and drink in that which is
called Karmelith. (Orach Chaiim, 349.) It is evident that no unlearned
man can stand a fair chance with laws like these. He could not hope
even to escape corporal punishment. But if the accurate observance
of such laws was the condition of salvation, he would have reason to
despair. The most honest desire to yield obedience and the utmost
exertion of his understanding will not help him, nor compensate for
his ignorance. If, for instance, he should conclude, because it is
unlawful for himself to have his head in one jurisdiction and his body
in another whilst he is drinking, that it would be equally unlawful for
cattle in the same predicament to get food, he would be mistaken:—
‫בהמה שהיתה רובה בחוץ וראשה בפנים אובסין אותה ׃‬
“A beast that has got most of its body outside, and its head inside,
may be fed.” And if he should take this as the general rule of his
conduct, he would be mistaken again, for long-necked animals form
an exception:—
‫ובגמל עד שיהא ראשו ורובו בפנים הואיל וצוארו ארוך ׃‬
“But in the ease of the camel, he must have his head and most of his
body inside, because his neck is long.” (Hilchoth Shabbath, c. xxv.
1.) And so with endless cases which arise from this one distinction of
places into four classes. Judaism is in all its parts a religion for the
studious, and for them only. For an unlearned man to keep the
Sabbath, as the oral law requirers, is absolutely impossible. And
after all, what good does it bestow upon those who spend their life in
the study? Does it improve the heart, or open more abundant views
of the Divine mercy, or fill the soul with love to man? That it sharpens
the wit and subtlety, we do not doubt, but that is but small profit to
man in general. The criminal law of any country will do the same,
and in truth the oral law is very little more than the rabbinical criminal
code. Its great subject is guilty and not guilty. And even in this it does
not address itself to the conscience, and lead a man to consider the
workings of the heart and the wanderings of the thought, and shew
him sin at its fountain-head. It is a mere dry detail of external
observances, as may be seen from the numerous specimens
adduced in these papers, and as might be shown more fully by
translating the whole. If real devout feeling and improvement of the
heart in the fear of God and the love of man be true religion, we
might expect it, if anywhere, in the Sabbath laws. The Sabbath is
that holy day which God has set apart to raise men’s thoughts from
earth to heaven. It is that period of earned relaxation on which even
the poor and the unlearned may lay aside their worldly cares and
occupations, and meditate upon the love and will of God, and that
eternity to which he is hastening. In the laws, then, respecting the
observance of this day, we might naturally expect the spirit of
devotion to be manifested; but in the oral law we look in vain for
anything of the kind. Its directions about the Sabbath are one
continued dry detail of external observances, which to a
conscientious man acquainted with them, must constitute a load
upon his conscience, sufficient to make the Sabbath the most
unhappy day of all the seven. But as to the poor and labouring
classes, who have no time for study, it is impossible that they should
know, and much more that they should keep, all that is necessary for
the right observation of the rabbinic Sabbath. If, therefore, the oral
law were true, the poor must lose a large portion of the blessings,
and even be in danger of perdition. Nay, if it be true, then we must
believe that God has given a religion impossible to be observed by
the poor, and offering great advantages to the rich and learned, that
is that He is a respecter of persons, though Moses and the prophets
teach the contrary. But we would ask our readers, what use is it to
them to profess a religion of which they can never attain a competent
knowledge? We venture to affirm that the majority of Israelites do not
know enough of the oral law to help them to keep the Sabbath, much
less to observe the six hundred and thirteen commandments; can it
be said, then, that they possess a religion with which they are not
even acquainted? If the knowledge and practice of the oral law be
necessary to constitute a true Jew, ninety-nine out of every hundred
must give up their claims to the Jewish name. But then what is to
become of the Jewesses, who are not even obligated to learn?
Every rabbi will be willing to confess that the women at least are
ignorant of the oral law. Can they then have a portion in the world to
come? If the knowledge and practice of the oral law be necessary to
salvation, they cannot. But if they can be saved without it, then it
follows that God has given a law, the knowledge of which is not
necessary to salvation. Let every Jew ask himself this question, Am I
acquainted with all the precepts of the oral law? If not, can I be
saved without this knowledge? If I cannot, then the Jewish religion is
one which makes it impossible for the poor to be saved. If I can, then
the Jewish religion is of no real use, for I can be saved even without
knowing it. Such a religion cannot be from God. His religion is
necessary to be known by every man, woman, and child in the world,
and the knowledge of it is just as easy to be acquired by the poor
and unlearned as by the rich and studious. Let then the poor and the
unlearned consider the folly of professing a religion, with which they
can never hope to become acquainted, and let them return to the
religion of Moses and the prophets, which, by the help of the God of
Israel, every one can understand, at least so far as is necessary to
salvation. The Bible, like everything that has God for its author, has
beauties discoverable by the eye of the poor, at the same time that it
has perfections to exercise the observation and skill of the most
learned. And this holy book is the heritage of Israel, which the oral
law can never be. The oral law may be the heritage and religion of
the rabbies who know it, but it has no more to do with the religion of
those who know it not, than the laws of the Chinese. The great
majority of the Jewish people might just as well call themselves
followers of Confucius. No man can be said to believe in doctrines
which he does not know, and can never hope to know: and this is the
case with nine-tenths of the oral law.
No. XXXI.
RABBINIC EXCOMMUNICATION.

It is a fact, that the religion of the oral law has hitherto done but little
to promote the temporal welfare of the Jewish people, and it is
equally certain that, if supreme, it would destroy the happiness both
of Jews add Gentiles. Its endless definitions would necessarily
produce transgression. Its severity and readiness in
excommunication would be the source of constant trouble to
individuals and families, and the sanguinary spirit of its criminal code
would make the Jews a nation of mourners. Indeed, we seriously
doubt, whether any, but a few fanatics, wish to see the oral law
vested with supreme power, and ruling over the lives and properties
of the Jewish nation. Every reflecting Israelite must know that the
Sanhedrin, wielding the absolute power ascribed to it in the rabbinic
traditions, would be the most oppressive tribunal that ever lorded it
over the consciences of men. But we must remember that it would
not be with the Sanhedrin and other tribunals alone, that the
Israelites would have to do. Every rabbi, and every disciple of a wise
man, would have the right of excommunicating any one who
offended them. After determining that the tribunals can and ought in
certain cases to excommunicate, the oral law adds—
‫וכן החכם עצמו מנדה לכבודו לעם הארץ שהקפיד בו ואין צריך לא עדים ולא‬
‫ ואם מת החכם באין שלשה‬, ‫ ואין מתירין לו עד שירצה את החכם‬, ‫התראה‬
‫ ואם רצה החכם למחול לו ולא לנדהו הרשות בידו ׃‬. ‫ומתירין לו‬
“And in like manner the wise man himself may, on account of his
honour, excommunicate an unlearned man who has treated him with
contumely, and there is no need of witnesses nor admonition. And
the excommunicate person is not to be absolved until he appease
the wise man. But if the wise man die, three persons come and
absolve him. If, however, the wise man wish to pardon, and not
excommunicate him, the power is in his own hand.” (Hilchoth Talmud
Torah, c. vi. 12.) From this law we see that the restoration of rabbinic
power would be the most oppressive system of government ever
devised. Every learned man would be a petty tyrant, constituting
both judge and jury in his own person, and able, at his own caprice,
to inflict a severe punishment. The most absolute aristocracy of the
feudal times never dared to assume or exercise a power so
monstrous and so oppressive. No priesthood, even in the darkest
times, ever claimed such personal authority as is here given to every
individual rabbi. It is true that he may, if he please, forgive the
unfortunate offender, but it is much to be feared that such absolute
power would in most cases be too strong a temptation to the frail
sons of men. And at all events the principle is utterly inconsistent
with wise legislation, and most dangerous to the liberty of the poor
and unlearned; for the reader will observe that it is only an unlearned
man, an “am-haaretz,” who may be dealt with in this summary
manner. And this is another proof that the religion of the oral law is a
religion devised for the advantage of the rich and learned, but
regardless of the spiritual and temporal welfare of the lower classes.
For the learned and the great the law is very different:—
‫חכם זקן בחכמה וכן נשיא או אב ב׳׳ד שסרח אין מנדין אותו בפרהסיא לעקלם‬
‫אלא אם כן עשה כירבעם בן נבט וחביריו אבל כשחטא שאר חטאות מלקין אותו‬
, ‫בצנעה שנאמר וכשלת היום וכשל גם נביא עמך לילה אע׳׳פ שכשל כסהו בלילה‬
‫ואומרים לו הכבד ושב בביתך וכן כל ת׳׳ח שנתחייב נידוי אסור לב׳׳ד לקפוץ‬
‫ולנדותו במהרה ׃‬
“A wise man, old in wisdom, or a prince, or a president of a tribunal,
who has sinned, is never to be excommunicated publicly, unless he
have done as Jeroboam, the son of Nebat, and his companions. But
when he commits other sins, he is to be flogged in private. For it is
said, ‘Therefore shalt thou fall in the day, and the prophet also shall
fall with thee in the night,’ (Hos. iv. 5,) i.e., although he fall, cover him
as it were with the night. And they say to him, ‘Honour thyself, and
abide in thy house.’ (2 Kings xiv. 10.) In like manner, when a disciple
of a wise man makes himself guilty of excommunication, it is
unlawful for the tribunal to be too quick, and to excommunicate him
hastily.” (Ibid. c. vii. 1.) The rabbies have endeavoured to justify this
different legislation for the learned and unlearned by a verse of the
Bible, but their interpretation of that verse is quite erroneous. When
God says, “Therefore shalt thou fall in the day, and the prophet shall
also fall with thee in the night,” he is not speaking of the learned and
unlearned, nor of the different way in which their sins were to be
punished, but of the destruction which was coming upon Israel, as
may be seen in Kimchi’s Commentary. He interprets the verse thus—
‫ היום ר׳׳ל חזמן הזה‬, ‫וכשלת היום אמר כנגד ישראל בעבור מעשיך תכשל ותפול‬
‫ ביום ההוא שורש ישי‬, ‫ וכן וחרה אפי בו ביום ההוא‬, ‫בקרוב תבוא מפלתך‬
‫ וכשל גם נביא עמך לילה נביא שקר המתעה‬, ‫ ענינם עת וזמן‬, ‫והדומים להם‬
‫אותך יכשל עמך כמו האדם נכשל בלילה בחשכה וכן תרגם יונתן ׃‬
“Therefore shalt thou stumble in the day.” This refers to Israel, and
means on account of thy deeds thou shalt stumble and fall. This day;
that is, in this time; thy fall shall soon come. And so we read, “Then
my anger shall be kindled against them in that day.” (Deut. xxxi. 17.)
And again, “In that day there shall be a root of Jesse,” (Isaiah xi. 10,)
where day means time and period. And the prophet also shall fall
with thee in the night, that is, the false prophet who deceiveth thee
shall stumble with thee, as men stumble in the night in darkness; and
so the Targum of Jonathan has it. (Kimchi, Comment. in Hos. iv. 2.)
Kimchi and Jonathan, then, both testify that the oral law gives a false
interpretation of this verse. This is in itself rather awkward for a law
that professes to have been given by God, but still more so when it is
made the basis of most unjust and partial legislation, to save the
learned from the punishment which an unlearned man would have in
similar circumstances to suffer. No one can deny that the learned
and unlearned are here placed on very unequal terms. If an
unlearned man provoke a rabbi, he may be excommunicated by that
individual without either judge or jury, or even the form of a trial. But
if a learned man makes himself liable to the same punishment, even
a court of justice has not the power to pronounce the sentence. Who
can doubt that the rabbies made these laws for their own
convenience? Can any one believe that God has given this law,
which makes the learned a privileged class of persons, who, though
guilty of the same offence as the working classes, is to be spared,
whilst they are to be punished? God is no respecter of persons, and
therefore no such law can be from him.
The extreme injustice of this mode of legislation will appear still more
from considering the nature of the punishment:—
‫ מנודה אסור לספר ולכבס כאבל‬, ‫מהו המנהג שינהג המנודה בעצמו ושנוהגין עמו‬
, ‫ ולא כוללין אותו בעשרה לכל דבר שצריך עשרה‬, ‫ ואין מזמנין עליו‬, ‫כל ימי נידויו‬
, ‫ ונשכר ושוכר‬, ‫ אבל שונה הוא לאחרים ושונין לו‬, ‫ולא יושבין עמו בארבע אמות‬
, ‫ כלומר שחן רוגמין אותו‬, ‫ואם מת בנדויו בית דין שולחין ומניחין אבן על ארונו‬
‫לפי שהוא מובדל מן הציבור ואין צריך לומר שאין מספידין אותו ואין מלוין את‬
‫ מי שישב בנידויו שלשים יום ולא בקש להתירו מנדין אותו שנייה ישב‬... ‫מטתו‬
‫שלשים יום אחרים ולא בקש להתירו מחרימין אותו ׃‬
“How is an excommunicate person to conduct himself, and how are
others to conduct themselves towards him? It is unlawful for an
excommunicate person, as for a mourner, to trim his heard or hair, or
to wash all the days of his excommunication; neither is he to be
associated in pronouncing the benedictions; neither is he to be
reckoned as one of ten, wherever ten persons are required; neither
may any one sit within four ells of him. He may however teach others
and be taught. He may hire and be hired. But if he die in his
excommunication, the tribunal send and lay a stone upon his coffin
to signify that they stone him because he is separated from the
congregation. And it is unnecessary to say that he is not to be
mourned for, and that his funeral is not to be attended.... Whosoever
remains thirty days in his excommunication without seeking to be
absolved, is to be excommunicated a second time. If he abide thirty
days more without seeking absolution, he is then to be
anathematized.” (Hilchoth Talmud Torah, ibid.) This, then, is the
punishment which a learned man has it in his power to inflict at will.
He may deprive him of the comforts of cleanliness and perhaps
injure his health. He may hold him up to the public scorn by
separating him by four ells from all decent people. He may heap
obloquy upon his death and deprive him of a respectful burial, or if
the man survive under the public contempt, and refuse to give the
rabbi satisfaction, he will be anathematized, and his prospects for
this world, at least, irretrievably ruined. The law respecting the
anathematized person is this:—
‫אינו שונה לאחרים ואין שונין לו אבל שונה הוא לעצמו שלא ישכח תלמודו ואינו‬
‫ ואין מתעסקין עמו אלא מעט עסק‬, ‫ ואין נושאין ונותנין עמו‬, ‫נשכר ואין נשכרין לו‬
‫כדי פרנסתו ׃‬
“He is not to teach others nor to be taught, but may learn by himself
that he may not forget the learning. He is not to be hired, nor to hire.
Men may have no dealings with him, nor any business except a little
that he may get a livelihood.” Now then suppose that an unlearned
man does or says something, which a rabbi interprets as contempt,
he is first excommunicated. If, in the consciousness of innocence, he
refuses to ask for the rabbi’s forgiveness, he is at last
anathematized, and all his business stopped, and all this is done to
him because he is an unlearned man. He is himself to be
dishonoured, his business ruined, and he himself to die of a broken
heart, not because he has committed some grievous crime, but
because he has been wanting in respect either to the rabbi’s person
or his words. The most absolute autocrat never made a law more
despotic.
But some one will say, that the rabbi has the power of forgiving if he
please, and that the oral law recommends him to do so. It is true that
if the affront be given in private, he has this power, and is told to
forgive, but not so if it be offered in public, he has then no choice. He
is bound to excommunicate the offender. That we may not appear to
act unfairly, we will give the whole passage:—
‫אף על פי שיש רשות לחכם לנדות לכבודו אינו שבח לתלמיד חכם להנהיג עצמו‬
‫בדבר זה אלא מעלים אזניו מדברי עם הארץ ולא ישית לבו להן כענין שאמר‬
‫ וכן היה דרך חסידים‬, ‫שלמה בחכמתו גם לכל הדברים אשר ידברו אל תתן לבך‬
‫הראשונים שומעים חרפתם ואינן משיבין ולא עוד אלא שמוחלים למחרף וסולחים‬
‫ וחכמים גדולים היו משתבחים במעשיהם הנאים ואומרים שמעולם לא נידו‬, ‫לו‬
, ‫ וזו היא דרכם של תלמידי חכמים שראוי לילך בה‬, ‫אדם ולא החרימוהו לכבודן‬
‫במה דברים אמורים כשבזוהו או חרפוהו בסתר אבל תלמיד חכם שבזהו או חרפו‬
‫אדם בפרהסיא אסור לו למחול על כבודו ואם מחל נענש שזה בזיון של תורה אלא‬
‫נוקם ונוטר הדבר כנחש עד שיבקש ממנו מחילה ׃‬
“Although a wise man has the power to excommunicate on account
of his honour, yet it is not to be praised in the disciple of a wise man
who does so. On the contrary he ought to shut his ears against the
words of an unlearned man (am-haaretz), and not to attend to them,
according as Solomon has said in his wisdom, ‘Take no heed to all
the things that are spoken.’ (Eccles. vii. 21.) And such was the
custom of the saints of old, who heard their reviling, but did not
answer; and not only so, but they pardoned the reviler, and forgave
him. The greatest of the wise men used to glory in their good deeds,
and say, that they had never excommunicated nor anathematized
any man on account of their honour, and this is the way in which the
disciples of the wise men ought to walk. In what case is this to be
applied? When they have been despised or reviled in secret. But if
the disciple of a wise man be despised or reviled by any man
publicly, it is unlawful for him to forgive any affront to his honour, and
if he forgive he is to be punished, for this is a contempt of the law. He
is on the contrary, to avenge and keep the thing in mind, like a
serpent, until the offender entreat to be forgiven.” (Ibid. c. vii. 13.)
The great object of these laws is plainly to uphold the power and
dignity of the rabbies, and to make it impossible for the people to
shake off their yoke. The care which is taken to punish every offence
against the wise men betrays a lurking consciousness of error, and a
fear lest the common people should compare their precepts with
Scripture, assert the plain unsophisticated truth, and thus shake off
the galling chains of rabbinism. To prevent this, the very first
semblance of disobedience is to be punished with excommunication.
But for the poor and unlearned, if insulted by a learned man, there is
no satisfaction. He cannot thunder out an excommunication or an
anathema in return. For him the oral law makes no provision, except
for his punishment. If Judaism, therefore, should ever attain the
supreme power, the working and unlearned classes will be placed in
the power and at the mercy of the learned, and every disciple of a
wise man will wield the absolute power of an autocrat.
But some one may say, that if the disciple of a wise man should
excommunicate any one hastily that the people would not regard his
excommunication. But if they did not, they would do it at their peril,
for the oral law expressly declares that they are bound to observe
the excommunication not only of a rabbi, but of one of his disciples:

‫הרב שנידה לכבודו כל תלמידיו חייבין לנהוג בו נדוי במנודה אבל תלמיד שנידה‬
‫לכבוד עצמו אין הרב חייב לנהוג בו נדוי אבל כל העם חייבין לנהוג בו נדוי ׃‬
“When a rabbi excommunicates on account of his honour, all his
disciples are bound to treat the excommunicate person as such. But
when a disciple excommunicates on account of his own honour, the
rabbi is not bound to treat that person as excommunicate, but all the
people are bound.” (Ibid. c. vi. 13.) Nothing can more clearly prove
the injustice of such excommunication. If the rabbi be not bound to
regard the disciples’ excommunication, why should all the people be
bound? If the offence committed against the disciple be a sin before
God, and such it ought to be to require such severe punishment, the
excommunication ought to be as binding upon the rabbi as upon the
people. But if it be not binding upon the rabbi, then the offence for
which it was inflicted cannot be a sin in the sight of God, it is
therefore an arbitrary and unjust punishment, and it is both wicked
and cruel to require the people to obey it. But the principle itself is
monstrous, that the disciple of a rabbi should be constituted both
judge and jury in his own case, and have the power of lording it over
those, whose circumstances do not permit them to devote their time
to study, and who, therefore, cannot be enrolled in the privileged
class. Just suppose that the clergy of this land, or the professors and
students at our Universities, were to claim such power, and to
excommunicate and anathematize all who treated them with
disrespect, and that without any trial or conviction before a legal
tribunal, and that the unfortunate victims were to be separated from
society, ruined, and then their dead bodies treated with dishonour,
would not this be regarded as a monstrous and insupportable
tyranny? Yet this is what the oral law claims for the rabbies and their
disciples, and what they would possess and exercise if Judaism ever
attains to supreme power. Would the Jews wish such a power
established? Do they desire to live under such a government? If they
do not, if they prefer the personal liberty and the even-handed justice
secured to them by Christian laws, then they confess that the
Christian principles are better than those of their own religion, and
they must be charged with inconsistency in professing and asserting
the truth of a religion, which they hope may never triumph. Every
man who believes his religious principles to be Divine, must wish
that they should triumph, and that they should have free scope for
their development. Any man who dreads the triumph of his religion
must have secret misgivings that it is false. We therefore ask every
Jew whether he desires that the oral law should attain that absolute
power which it claims, and that every rabbi and his disciples should
have the power of excommunicating and anathematizing all who
affront them? One of the most perfect tests of a religion, is to
consider what would be its effects if supreme. At present there are
various systems of religion in the world, some of which, as directly
contradicting others, must be decidedly false. The hope of all
reflecting men is, that the truth will ultimately triumph, that God
himself will at last interpose, and establish the dominion of truth and
eradicate all error. Each hopes that his own system will then prevail,
but let him follow out that system, and see how it will work, when all
resistance shall be vain. Let the Jews calmly consider the state of
things, when the rabbies and their disciples shall be masters of the
world, as they must one day be, if Judaism be true. The unlearned
will then be completely at their mercy, their servants and their
bondmen. Will this be a happy condition, or is this state of things
desirable? In the first place, there will be no personal liberty. Any
man who may chance to differ from a rabbi, and treat him with
disrespect will immediately be excommunicated. In the second
place, there will be no liberty of conscience or of thought. Every man
must then let the rabbies think for him, and he must be content to
receive their decisions without any appeal. The body will scarcely
have the appearance of being free, and the intellect will be bound in
fetters of adamant. It will no doubt be a glorious period for the wise
men and their disciples, but they will always form a small minority,
compared with the bulk of mankind. The majority of Israel, not now to
speak of the Gentiles, will then be degraded into poor, crouching,
submissive servants of the learned, afraid to use their reason, and
always having the fear and dread of excommunication before their
eyes. Do they then honestly wish for such a state of things, to be tied
hand and foot, and given into the hands of their learned men? If they
do not, if they see the horror and the injustice and degradation of
such a state of things, why do they profess a religion which will
inevitably lead to it, if it be true? If such laws be unjust, and such a
consummation dreadful, instead of desirable, the religion of the oral
law must necessarily be false; and it is the duty of every Israelite to
consider what he is doing in upholding it. The present state of things
will not continue always. The Jewish nation cannot always wish to be
wanderers in foreign lands. They look forward to a restoration to the
land of their fathers, and they wish in that land to be happy and
prosperous. But happiness and prosperity will be unknown words, if
they are then to be governed according to the principles of the oral
law. That law gives the learned a monopoly of power and happiness,
but leaves the mass of the nation in bondage. Do they then, in
contemplating the re-establishment of the kingdom of Israel, expect
another than the oral law, and other principles of religion and justice?
If they do, they confess that the oral law is false, and if it would be
false and hurtful, and destructive of all happiness, if supreme, it is
equally false and hurtful now. The Israelite, therefore, who upholds it,
is upholding a false system. He may do it in ignorance, and we
believe that this is the case with the majority; but it is most
unbecoming in any reasonable man to profess a religion of which he
is ignorant. He may answer, I have no time to acquire an accurate
knowledge of my religion. The books in which it is contained are too
voluminous to admit of my acquiring an acquaintance with them. I
must work for my bread. We grant that this is the fact, but then this
brings us back to our original position, that Judaism is only a religion
for those who have leisure, that is, for the rich and the learned, and
we conclude, on that very account, that it cannot be from God, who
looks neither at riches nor learning, but considereth the welfare, and
above all, the religious welfare of the poorest of his creatures. The
especial character of the Messiah is, that he will care for the poor.
“He shall judge the poor of the people, he shall save the children of
the needy.” (Psalm lxxii. 4.) He, therefore, cannot have the religion of
the oral law. He will not be a rabbi, nor a rabbi’s disciple.
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!

ebooknice.com

You might also like