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

Software Architecture Design Patterns in Java 1st Edition Partha Kuchana instant download

The document is a comprehensive guide on software architecture design patterns in Java, authored by Partha Kuchana. It covers various design patterns, including creational, structural, and behavioral patterns, along with UML references and practical examples. The book is intended for software developers looking to enhance their understanding and application of design patterns in Java programming.

Uploaded by

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

Software Architecture Design Patterns in Java 1st Edition Partha Kuchana instant download

The document is a comprehensive guide on software architecture design patterns in Java, authored by Partha Kuchana. It covers various design patterns, including creational, structural, and behavioral patterns, along with UML references and practical examples. The book is intended for software developers looking to enhance their understanding and application of design patterns in Java programming.

Uploaded by

kasenimajrul
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/ 62

Software Architecture Design Patterns in Java

1st Edition Partha Kuchana pdf download

https://ebookname.com/product/software-architecture-design-
patterns-in-java-1st-edition-partha-kuchana-2/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Software Architecture Design Patterns in Java 1st


Edition Partha Kuchana

https://ebookname.com/product/software-architecture-design-
patterns-in-java-1st-edition-partha-kuchana/

Patterns in Java A Catalog of Reusable Design Patterns


Illustrated with UML 2nd Edition Volume 1 Grand

https://ebookname.com/product/patterns-in-java-a-catalog-of-
reusable-design-patterns-illustrated-with-uml-2nd-edition-
volume-1-grand/

Integration Ready Architecture and Design Software


Engineering with XML Java NET Wireless Speech and
Knowledge Technologies 1st Edition Jeff Zhuk

https://ebookname.com/product/integration-ready-architecture-and-
design-software-engineering-with-xml-java-net-wireless-speech-
and-knowledge-technologies-1st-edition-jeff-zhuk/

Membrane Technology Volume 3 Membranes for Food


Applications 1st Edition Klaus-Viktor Peinemann

https://ebookname.com/product/membrane-technology-
volume-3-membranes-for-food-applications-1st-edition-klaus-
viktor-peinemann/
Flavor chemistry and technology 2nd Edition Gary
Reineccius

https://ebookname.com/product/flavor-chemistry-and-
technology-2nd-edition-gary-reineccius/

The Fifth Freedom Jobs Politics and Civil Rights in the


United States 1941 1972 Anthony S. Chen

https://ebookname.com/product/the-fifth-freedom-jobs-politics-
and-civil-rights-in-the-united-states-1941-1972-anthony-s-chen/

Ethnography Principles in Practice 3rd Edition Martyn


Hammersley

https://ebookname.com/product/ethnography-principles-in-
practice-3rd-edition-martyn-hammersley/

Maximum Likelihood Estimation of Misspecified Models


Twenty Years Later 1° Edition T. Fomby & R. Carter Hill
(Editors)

https://ebookname.com/product/maximum-likelihood-estimation-of-
misspecified-models-twenty-years-later-1-edition-t-fomby-r-
carter-hill-editors/

Piloting Palm Andrea Butter

https://ebookname.com/product/piloting-palm-andrea-butter/
Assault on Nightwyrm Fortress Adventure P3 D D
Adventure Dungeons Dragons Bruce R. Cordell

https://ebookname.com/product/assault-on-nightwyrm-fortress-
adventure-p3-d-d-adventure-dungeons-dragons-bruce-r-cordell/
Software
Architecture
Design Patterns
in Java

© 2004 by CRC Press LLC


Other CRC/Auerbach Publications in Software Development,
Software Engineering, and Project Management
The Complete Project Management Six Sigma Software Development
Office Handbook Christine Tanytor
Gerard M. Hill 0-8493-1193-4
0-8493-2173-5
Software Architecture Design Patterns
Complex IT Project Management: 16 Steps in Java
to Success Partha Kuchana
Peter Schulte 0-8493-2142-5
0-8493-1932-3 Software Configuration Management
Creating Components: Object Oriented, Jessica Keyes
Concurrent, and Distributed Computing 0-8493-1976-5
in Java
Software Engineering for Image Processing
Charles W. Kann Phillip A. Laplante
0-8493-1499-2 0-8493-1376-7
Dynamic Software Development: Software Engineering Handbook
Manging Projects in Flux Jessica Keyes
Timothy Wells 0-8493-1479-8
0-8493-129-2
Software Engineering Measurement
The Hands-On Project Office: Guaranteeing John C. Munson
ROI and On-Time Delivery 0-8493-1503-4
Richard M. Kesner
0-8493-1991-9 Software Engineering Processes: Principles
and Applications
Interpreting the CMMI®: A Process Yinxu Wang, Graham King, and Saba Zamir
Improvement Approach 0-8493-2366-5
Margaret Kulpa and Kent Johnson
Software Metrics: A Guide to Planning,
0-8493-1654-5
Analysis, and Application
Introduction to Software Engineering C.R. Pandian
Ronald Leach 0-8493-1661-8
0-8493-1445-3 Software Testing: A Craftsman’s Approach,
ISO 9001:2000 for Software and Systems 2e
Providers: An Engineering Approach Paul C. Jorgensen
Robert Bamford and William John Deibler II 0-8493-0809-7
0-8493-2063-1 Software Testing and Continuous Quality
Improvement, Second Edition
The Laws of Software Process:
William E. Lewis
A New Model for the Production
and Management of Software 0-8493-2524-2
Phillip G. Armour IS Management Handbook, 8th Edition
0-8493-1489-5 Carol V. Brown and Heikki Topi, Editors
0-8493-1595-9
Real Process Improvement Using
the CMMI® Lightweight Enterprise Architectures
Michael West Fenix Theuerkorn
0-8493-2109-3 0-9493-2114-X

AUERBACH PUBLICATIONS
www.auerbach-publications.com
To Order Call: 1-800-272-7737 • Fax: 1-800-374-3401
E-mail: orders@crcpress.com
© 2004 by CRC Press LLC
Software
Architecture
Design Patterns
in Java
Partha Kuchana

AUERBACH PUBLICATIONS
A CRC Press Company
Boca Raton London New York Washington, D.C.

© 2004 by CRC Press LLC


Library of Congress Cataloging-in-Publication Data

Kuchana, Partha.
Software architecture design patterns in Java / Partha Kuchana.
p. cm.
Includes bibliographical references and index.
ISBN 0-8493-2142-5 (alk. paper)
1. Java (Computer program language) 2. Computer Software. 3. Computer architecture.
4. Software patterns. I. Title.

QA76.73.J38K83 2004
005.13′3—dc22 2003070897

This book contains information obtained from authentic and highly regarded sources. Reprinted material is quoted
with permission, and sources are indicated. A wide variety of references are listed. Reasonable efforts have been
made to publish reliable data and information, but the author and the publisher cannot assume responsibility for the
validity of all materials or for the consequences of their use.

Neither this book nor any part may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, microfilming, and recording, or by any information storage or retrieval system,
without prior permission in writing from the publisher.

The consent of CRC Press LLC does not extend to copying for general distribution, for promotion, for creating new
works, or for resale. Specific permission must be obtained in writing from CRC Press LLC for such copying.

Direct all inquiries to CRC Press LLC, 2000 N.W. Corporate Blvd., Boca Raton, Florida 33431.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation, without intent to infringe.

Visit the Auerbach Publications Web site at www.auerbach-publications.com

© 2004 by CRC Press LLC


Auerbach is an imprint of CRC Press LLC

No claim to original U.S. Government works


International Standard Book Number 0-8493-2142-5
Library of Congress Card Number 2003070897
Printed in the United States of America 1 2 3 4 5 6 7 8 9 0
Printed on acid-free paper

© 2004 by CRC Press LLC


DEDICATION

To my family

© 2004 by CRC Press LLC


CONTENTS

SECTION I: AN INTRODUCTION TO DESIGN PATTERNS


1 Design Patterns: Origin and History
Architectural to Software Design Patterns
What Is a Design Pattern?
More about Design Patterns
About This Book
Source Code
Source Code Disclaimer

SECTION II: UNIFIED MODELING LANGUAGE (UML)


2 UML: A Quick Reference
Structure Diagrams
Behavior Diagrams
Model Management Diagrams
Class Diagrams
Class
Inner Class
Access Specifiers
Static
Abstract Class/Method
Exception
Note
Generalization
Interface
Realization
Dependency
Class Association
Multiplicity
Navigability
Composition
Aggregation
Sequence Diagrams
Object
Message
Self Call

© 2004 by CRC Press LLC


SECTION III: BASIC PATTERNS
3 Interface
Description
Example
Practice Questions

4 Abstract Parent Class


Description
Example
Abstract Parent Class versus Interface
Practice Questions

5 Private Methods
Description
Example
Practice Questions

6 Accessor Methods
Description
Accessor Method Nomenclature
Example
Direct Reference versus Accessor Methods
Practice Questions

7 Constant Data Manager


Description
Example
Practice Questions

8 Immutable Object
Description
Example
Practice Questions

9 Monitor
Description
Example
Practice Questions

SECTION IV: CREATIONAL PATTERNS


10 Factory Method
Description
Example
Practice Questions

11 Singleton
Description
Who Should Be Responsible?
Example
Make the Constructor Private
Static Public Interface to Access an Instance
Practice Questions

© 2004 by CRC Press LLC


12 Abstract Factory
Description
Abstract Factory versus Factory Method
Example I
Example II
Logical Flow When the Application Is Run
Practice Questions

13 Prototype
Description
Shallow Copy versus Deep Copy
Shallow Copy Example
Deep Copy Example
Example I
Design Highlights of the HostingPlanKit Class
Example II
Redesign the UserAccount Class
Create a Prototype Factory Class
Practice Questions

14 Builder
Description
Example I
A Side Note
Back to the Example Application
Example II
Example III
Practice Questions

SECTION V: COLLECTIONAL PATTERNS


15 Composite
Description
Example
Design Approach I
FileComponent
getComponentSize()
DirComponent
addComponent(FileSystemComponent)
getComponent(int)
getComponentSize()
Design Approach II
Practice Questions

16 Iterator
Description
Iterators in Java
Filtered Iterators
Internal versus External Iterators
Example: Internal Iterator
Client/Container Interaction
Example: External Filtered Iterator
Practice Questions

© 2004 by CRC Press LLC


17 Flyweight
Description
How to Design a Flyweight in Java
Design Highlights
Example
Design Approach I
Design Approach II
Practice Questions

18 Visitor
Description
Design Idea 1
Design Idea 2
Defining New Operations on the Object Collection
Adding Objects of a New Type to the Collection
Example
Design Approach I
Design Approach II
Design Approach III (Composite Pattern)
Design Approach IV (The Visitor Pattern)
Application Flow
Defining a New Operation on the Order Object Collection
Adding a New Order Type to the Collection
Practice Questions

SECTION VI: STRUCTURAL PATTERNS


19 Decorator
Description
Characteristics of a Decorator
Example
Concrete Logger Decorators
HTMLLogger
EncryptLogger
Adding a New Message Logger
Adding a New Decorator
Practice Questions

20 Adapter
Description
Class Adapters versus Object Adapters
Class Adapter
Object Adapter
Example
Address Adapter as an Object Adapter
Practice Questions

21 Chain of Responsibility
Description
Example
Practice Questions

© 2004 by CRC Press LLC


22 Façade
Description
Example
Important Notes
Practice Questions

23 Proxy
Description
Proxy versus Other Patterns.
Proxy versus Decorator
Proxy versus Façade
Proxy versus Chain of Responsibility
RMI: A Quick Overview
RMI Components
RMI Communication Mechanism
RMI and Proxy Pattern
Example
Additional Notes
Compilation and Deployment Notes
Practice Questions

24 Bridge
Description
Example
Abstraction Implementation Design
Abstraction Interface Design
Design Highlights of the Abstraction Interface Classes
Bridge Pattern versus Adapter Pattern
Practice Questions

25 Virtual Proxy
Description
Advantage
Disadvantage
Example
Practice Questions

26 Counting Proxy
Description
Example
Practice Questions

27 Aggregate Enforcer
Description
Example
Design Approach I (On-Demand Initialization)
Design Approach II (Early Initialization)
Design Approach III (Final Variables)
Practice Questions

28 Explicit Object Release


Description
The finalize Method

© 2004 by CRC Press LLC


When an Object Goes Out of Scope, It Is Believed to
Be Garbage Collected Immediately
The Garbage Collection Process Runs as a Low-Level
Background Daemon Thread
The finally Statement
Example
Best Case Scenario
Exception Scenario 1
Exception Scenario 2
Practice Questions

29 Object Cache
Description
Example
Practice Questions

SECTION VII: BEHAVIORAL PATTERNS


30 Command
Description
Example I
Example II
Application Flow
Practice Questions

31 Mediator
Description
Mediator versus Façade
Example I
Client Usage of the Mediator
User Interface Objects: Mediator Interaction
Example II
Practice Questions

32 Memento
Description
Example
DataConverter (Originator)
ID
Memento
process
createMemento
setMemento
DCClient (Client)
MementoHandler
Practice Questions

33 Observer
Description
Adding New Observers
Example
Subject–Observer Association
Logical Flow

© 2004 by CRC Press LLC


Practice Questions

34 Interpreter
Description
Example
Infix-to-Postfix Conversion (Listing 34.8)
Construction of the Tree Structure (Listing 34.9)
Postorder Traversal of the Tree
Additional Notes
Infix-to-Postfix Conversion
Infix Expression
Postfix Expression
Conversion Algorithm
Example
Binary Tree Traversal Techniques
Preorder (Node-Left-Right)
In-Order (Left-Node-Right)
Postorder (Left-Right-Node)
Level-Order
Practice Questions

35 State
Description
Stateful Object: An Example
Example
Practice Questions

36 Strategy
Description
Strategies versus Other Alternatives
Strategy versus State
Example
SimpleEncryption
CaesarCypher
SubstitutionCypher
CodeBookCypher
Practice Questions

37 Null Object
Description
Example
Practice Questions

38 Template Method
Description
Abstract Class
Concrete Class
Example
Additional Notes
Mod 10 Check Digit Algorithm
Practice Questions

39 Object Authenticator
Description

© 2004 by CRC Press LLC


Example
Practice Questions

40 Common Attribute Registry


Description
Example
Practice Questions

SECTION VIII: CONCURRENCY PATTERNS


41 Critical Section
Description
Example
Approach I (Critical Section)
Approach II (Static Early Initialization)
Practice Questions

42 Consistent Lock Order


Description
Example
Practice Questions

43 Guarded Suspension
Description
Example
Use of wait() and notify() in the ParkingLot Class Design
Practice Questions

44 Read-Write Lock
Description
Design Highlights of the ReadWriteLock Class
Lock Statistics
Lock Methods
Lock Release
Example
Practice Questions

SECTION IX: CASE STUDY


45 Case Study: A Web Hosting Company
Objective
KPS Hosting Solutions: A Brief Overview
Requirements
Functional
Technical
Business Objects and Their Association
Framework for Application Processing
Enterprise Service Level
Generic Interface Contract
Sample Interface Contract
Task Level
Generic Task-Handler Mapping
Sample Task-Handler Mapping

© 2004 by CRC Press LLC


Error Processing
Enterprise Services Design
Address Validation
Credit Card Service
Validation
Search Management
Customer Management
Conclusion

SECTION X: APPENDICES
Appendix A: List of Design Patterns
Appendix B: References

© 2004 by CRC Press LLC


FOREWORD

Partha Kuchana is an experienced enterprise systems architect. He understands


that patterns are not about things that are just good ideas, but that patterns are
about capturing knowledge bred from experience. This hard-won knowledge is
what Partha is sharing with readers of his book. Here are some of the things I
really like about what he has to say.
The book presents 42 design patterns, which include the 23 GoF patterns.
These patterns are categorized as follows:

䡲 7 Basic patterns
䡲 5 Creational patterns
䡲 4 Collectional patterns
䡲 11 Structural patterns
䡲 11 Behavioral patterns
䡲 4 Concurrency patterns

The discussion of each pattern includes an example implemented in Java.


Further, the source code for all examples is found on the following Web site for
this book: http://www.crcpress.com/e_products/downloads/download.asp. The
source code and the easily understood examples make this format work well.
Partha takes complex material and clearly explains the ideas so they are easy-
to-understand, an important consideration for both the novice encountering the
material for the first time and the experienced developer who quickly wants to
extract the important bits for immediate use. Each pattern discussion also includes
Practice Questions for exactly that — your own use to improve your skills or, if
this book were to be chosen as a text, to help the time-pressured instructor.
Partha takes the time to compare and contrast the patterns. For example, in the
discussion on the Mediator pattern, a table shows similarities and differences
between Mediator and Façade. The reader will find that this analysis leads to a
clearer understanding than simply trying to focus on each pattern in isolation. The
text also includes consideration of relationships between patterns. For example, in
the discussion on the Mediator pattern there is a reference to a previous design
example for the Command pattern.

© 2004 by CRC Press LLC


Finally, at the end of the book, the reader will be happy to find a case study
that pulls some of the patterns together to illustrate how a more complicated
problem would be tackled and how the patterns work together. As those who
have studied the work of Christopher Alexander realize—patterns are not applied
in isolation but collaborate within a specific domain to address large and small
problems.
It has been ten years since the GoF book was published. A lot of patterns
have been identified and captured in that time. A lot of patterns books have been
written. This book is like the GoF book, a catalog; probably not one you will
read cover-to-cover in a single setting, but which will find a place on your
bookshelf. Keep it handy for all those “How do I do this in Java?” questions
where you wish you had an expert in the office next door to provide answers.
This book is the next best thing.
Linda Rising
Phoenix, AZ

© 2004 by CRC Press LLC


ABOUT THE AUTHOR

Partha Kuchana is an experienced enterprise systems architect. He has eleven


years of experience in all aspects of project delivery management (onsite/offshore
models), enterprise architecture, design, development, mentoring and training. He
is a Sun certified enterprise architect.
During the last several years, he has worked on numerous client–server, E-
business, Web portal and enterprise application integration (EAI) projects at various
client sites in the United Kingdom and the United States, involving iterative design
methodologies such as Rational Unified Process (RUP) and extreme programming.
He has extensive experience applying design patterns in application architec-
ture and design. He has successfully architected and designed business-to-business
systems and complex heterogeneous systems integration using Web services,
middleware and messaging products from various vendors. He has several pub-
lished software-related publications.

Home page: http://members.ITJobsList.com/partha


E-mail: ParthaKuchana@ITJobsList.com

© 2004 by CRC Press LLC


ACKNOWLEDGMENTS

First and foremost, I would like to thank my wife for her patience and support,
for taking some of my workload especially in the ar eas of UML and Java
programming and for her inspirational contributions at the time of frustrating
moments. I would like to thank my parents, my sister, my brother and my dear
friends whose support and encouragement throughout my life have made it
possible for me to build the skill set necessary to succeed.
I would like to thank Venu Kuchana and D.R. Sudhakar for their contributions
in terms of writing different Java programs. I would like to thank BalaLingam
Kuchana for his contributions in the area of UML and for being in charge of
creating the formatted version of my draft.
I would like to thank the entire team at Auerbach publications for their
contributions in this project and for making this a remarkable experience. In
particular, I have a deep sense of gratitude towards my acquisitions editor, John
Wyzalek, for sharing my enthusiasm and providing me with great advice and
help. I also would like to thank the managing editor, Claire Miller, for her
invaluable advice and contribution in arranging the book in a presentable form.
My sincere thanks to Linda Rising for writing the Foreword.
I am truly appreciative and thankful to the following reviewers who have
taken the time to read the draft and provide me with feedback.

䡲 Pradyumn Sharma, CEO, Pragati Software Pvt. Ltd.


䡲 Carsten Kuckuk, project lead, Design Patterns Study Group Stuttgart, RIB
Software AG
䡲 Tim Kemper, Boulder Design Patterns Group
䡲 Geoffrey Sparks, CEO, Sparx Systems P/L
䡲 Edward L. Howe, software architect, Employease, Inc.
䡲 Christopher R. Gardner, software developer, McKesson Information Solutions
䡲 David Deriso, senior software engineer, Employease, Inc.
䡲 Mike Heinrich, software engineer, Canada
䡲 Rodney Waldoff, director of systems architecture, Encyclopedia Brittanica
Inc.
䡲 Thomas SMETS, software engineer, Belgium
䡲 Linda Rising, Ph.D., independent software consultant, Arizona State University
䡲 Ray Tayek, coordinator LAJUG/OCJUG

© 2004 by CRC Press LLC


In particular, thanks to Pradyumn Sharma, Carsten Kuckuk, and Tim Kemper
for their insightful recommendations, their thoroughness, and their invaluable
suggestions, including questions that an inquisitive reader might have about design
patterns.
I would like to thank Mark Grand for his encouragement and advice on various
aspects of writing a patterns book. I am sure I have forgotten someone important;
please accept my sincere apologies.

© 2004 by CRC Press LLC


I
AN INTRODUCTION TO
DESIGN PATTERNS

© 2004 by CRC Press LLC


1
DESIGN PATTERNS:
ORIGIN AND HISTORY

During the late 1970s, an architect named Christopher Alexander carried out the
first known work in the area of patterns. In an attempt to identify and describe
the wholeness or aliveness of quality designs, Alexander and his colleagues studied
different structures that were designed to solve the same problem. He identified
similarities among designs that were of high quality. He used the term pattern in
the following books to refer to these similarities.

䡲 A Pattern Language: Towns, Buildings, Construction (Oxford University


Press, 1977)
䡲 The Timeless Way of Building (Oxford University Press, 1979)

The patterns identified and documented by Alexander are purely architectural


and deal with structures like buildings, gardens and roadways.

ARCHITECTURAL TO SOFTWARE DESIGN PATTERNS


In 1987, influenced by the writings of Alexander, Kent Beck and Ward Cunningham
applied the architectural pattern ideas for the software design and development.
They used some of Alexander’s ideas to develop a set of patterns for developing
elegant user interfaces in Smalltalk. With the results of their work, they gave a
presentation entitled Using Pattern Languages for Object-Oriented Programming
at the Object-Oriented Programming Systems, Languages, and Applications (OOP-
SLA) ’87 conference. Since then, many papers and presentations relating to patterns
have been published by many eminent people in the Object Oriented (OO) world.
In 1994, the publication of the book entitled Design Patterns: Elements of
Reusable Object-Oriented Software on design patterns by Erich Gamma, Richard
Helm, Ralph Johnson and John Vlissides explained the usefulness of patterns and
resulted in the widespread popularity for design patterns. These four authors
together are referred to as the Gang of Four (GoF). In this book the authors
documented the 23 patterns they found in their work of nearly four and a half
years.

© 2004 by CRC Press LLC


Since then, many other books have been published capturing design patterns
and other best practices for software engineering.

WHAT IS A DESIGN PATTERN?


A design pattern is a documented best practice or core of a solution that has
been applied successfully in multiple environments to solve a problem that recurs
in a specific set of situations.
Architect Christopher Alexander describes a pattern as “a recurring solution to
a common problem in a given context and system of forces.” In his definition,
the term context refers to the set of conditions/situations in which a given pattern
is applicable and the term system of forces refers to the set of constraints that
occur in the specific context.

MORE ABOUT DESIGN PATTERNS

䡲 A design pattern is an effective means to convey/communicate what has


been learned about high-quality designs. The result is:
– A shared language for communicating the experience gained in dealing
with these recurring problems and their solutions.
– A common vocabulary of system design elements for problem solving
discussions. A means of reusing and building upon the acquired insight
resulting in an improvement in the software quality in terms of its
maintainability and reusability.
䡲 A design pattern is not an invention. A design pattern is rather a docu-
mented expression of the best way of solving a problem that is observed
or discovered during the study or construction of numerous software
systems.
䡲 One of the common misconceptions about design patterns is that they are
applied only in an object-oriented environment. Even though design pat-
terns discussions typically refer to the object-oriented development, they
are applicable in other areas as well. With only minor changes, a design
pattern description can be adjusted to refer to software design patterns in
general. From the preceding section, Origin and History, it can be seen
that patterns have existed from the early days of architecture, long before
the object-oriented design and programming era.
䡲 Design patterns are not theoretical constructs. A design pattern can be
seen as an encapsulation of a reusable solution that has been applied
successfully to solve a common design problem.
䡲 Though design patterns refer to the best known ways of solving problems,
not all best practices in problem resolution are considered as patterns. A
best practice must satisfy the Rule of Three to be treated as a design
pattern. The Rule of Three states that a given solution must be verified to
be a recurring phenomenon, preferably in at least three existing systems.
Otherwise, the solution is not considered as a pattern. The goal is to ensure
that some community of software professionals applied the solution
described by the pattern to solve software design problems. Satisfying the

© 2004 by CRC Press LLC


Rule of Three indicates that a design pattern provides a practical solution
to deal with a real-world problem.
䡲 Design patterns do not provide solutions to every problem found in real-
world software design and development. Design patterns are about pro-
viding elegant, reusable solutions to commonly encountered software
development problems in a particular context. This means that a pattern
that is meant to provide the best solution to a problem in a particular
context may not produce an effective solution to the same problem in a
different context. Sometimes, the solution proposed by the design pattern
may not even be applicable in a different context.

Software frameworks can be confused with design patterns. They are closely
related. Table 1.1 lists the similarities and differences between the two.

Table 1.1 Design Patterns versus Frameworks


Design Patterns Frameworks

Design patterns are recurring solutions to A framework is a group of components


problems that arise during the life of a that cooperate with each other to
software application in a particular provide a reusable architecture for
context. applications with a given domain.
The primary goal is to: The primary goal is to:
• Help improve the quality of the • Help improve the quality of the
software in terms of the software software in terms of the software
being reusable, maintainable, being reusable, maintainable,
extensible, etc. extensible, etc.
• Reduce the development time • Reduce development time
Patterns are logical in nature. Frameworks are more physical in nature,
as they exist in the form of some
software.
Pattern descriptions are usually Because frameworks exist in the form of
independent of programming language some software, they are
or implementation details. implementation-specific.
Patterns are more generic in nature and can Frameworks provide domain-specific
be used in almost any kind of functionality.
application.
A design pattern does not exist in the Frameworks are not complete
form of a software component on its applications on their own. Complete
own. It needs to be implemented applications can be built by either
explicitly each time it is used. inheriting the components const
directly.
Patterns provide a way to do “good” Design patterns may be used in the
design and are used to help design design and implementation of a
frameworks. framework. In other words,
frameworks typically embody several
design patterns.

© 2004 by CRC Press LLC


ABOUT THIS BOOK
The objective of this book is to discuss design patterns in an easy to understand
manner with simple examples. This book discusses 42 design patterns including
the 23 patterns by GoF. These patterns are arranged in six categories:

䡲 7 Basic Patterns — Section III (Chapter 3 through Chapter 9)


䡲 5 Creational Patterns — Section IV (Chapter 10 through Chapter 14)
䡲 4 Collectional Patterns — Section V (Chapter 15 through Chapter 18)
䡲 11 Structural Patterns — Section VI (Chapter 19 through Chapter 29)
䡲 11 Behavioral Patterns — Section VII (Chapter 30 through Chapter 40)
䡲 4 Concurrency Patterns — Section VIII (Chapter 41 through Chapter 44)

Each pattern discussion starts with an explanation of the pattern followed by


an example implemented in Java™ programming language. How a given pattern
is applied in the example is discussed in detail along with code segments and
UML diagrams (class, sequence). At the end of each pattern discussion, a few
practice questions are provided for you to work on to improve your understanding
of the pattern. Wherever applicable, patterns are compared with other similar
looking patterns.
The examples in this book are kept simple for easy understanding. The
objective is to enhance the explanation of each pattern with examples for a better
understanding.
The UML section provides an overview of the Unified Modeling Language
(UML) and discusses various elements of class and sequence diagrams.
The case study at the end of the book demonstrates the collective usage of
different design patterns in a real-world application design scenario. This section
discusses how various patterns can be used in designing a reusable application
framework for a fictitious Web hosting company.

Source Code
The source code for all example applications is available on the following Web
site for this book: http://www.crcpress.com/e_products/download.asp.

Source Code Disclaimer


Both the author and the publisher make no representations or warranties about
the suitability of the software, either expressed or implied, including but not
limited to the implied warranties of merchantability, fitness for a particular purpose
or noninfringement. Both the author and the publisher shall not be liable for any
damages suffered as a result of using, modifying or distributing the software or
its derivatives.
Java is a trademark of Sun Microsystems, Inc. Windows is a registered trademark
of Microsoft Corporation.

© 2004 by CRC Press LLC


Random documents with unrelated
content Scribd suggests to you:
After that first night I groped my way alone to bed, the candle stub
having come to an end, feeling my way along the pitch dark
passageways to the room with the linoleum mat, the room which
had not known fire for three years and a half, whose paneless
windows were boarded up, the one room in the house which had not
lost a ceiling or floor or whose walls were not clipped through with
shells. The regular inmates of the hotel slept nightly in the cellar. It
saved time and was warmer.

Notwithstanding the reassurances of the patronne I confess to going


to bed with half my clothes on. But under the wing of the storm
Dunkirk slept tranquilly for three successive nights. Of course, there
was always the soft bum-bum of the cannon on the northern
horizon, strange tremors shook the bed, and the night was full of
weird sounds, the rattling skeletons of dead houses.

BRAVE LITTLE DUNKIRK


Like an arm held up to protect the face, the coast between Calais
and Dunkirk bears the brunt of storm from the North Sea. A dark
sea, sombre and brooding, girdled by lowering clouds; on the snow-
driven plain a few detached towers, etched as though in sepia
against the gray sky and rising abruptly above the low line of roof—
this is Dunkirk on a Winter's day. A homely little town with a deep
fringe of docks and waterways on its seaward side and a girdle of
fortifications built by Vauban encircling the rest. The whole set in a
ring of dark water which fills the moat. It is thoroughly Flemish in
character, and, seen from the water, must resemble a city on a delft
tile. The moral attitude of the town has always been one of robust
activity. Even its patron saints are among the most industrious and
enterprising in the calendar—notably St. Eloi, who brought
Christianity to the Dunkerquois and to whom the original Dunkirk
(church on the dunes) was dedicated.
All the history of the town is tinged with a vigor which has blown in
to it from the sea. Here the crusading ships of Baldwin of Flanders,
and later those of St. Louis of France, were fitted out. After the
momentous marriage of Marie of Burgundy had thrown the city for a
time under the dominion of Spain it played a brilliant part in the
game of the period—piracy.

The quaint tower on the quay—called Lugenhaer, the Liar—was used


at that epoch to give false signals to ships at sea. But it dates from a
much earlier period, and was one of twenty-eight towers with which
Baldwin of Flanders bound together the wall with which he
surrounded the city. The Liar and the belfry of the recently ruined
Cathedral of St. Eloi were the only interesting architectural bits left in
Dunkirk. The thirteenth century tower, dark and strong at its base,
rises to a great height, flowering into restrained tracery at the top
and shepherding under its shadow the heart of the town, which lies
below it. This is the lodestone. Toward it I turned after leaving the
battered hotel that first morning at Dunkirk.

A photograph, full of human interest, showing


Americans, headed by a regimental band, marching
to the front in France (American Official
Photograph)

The Harvard University Regiment marching through


the streets of Boston (© Underwood)

CITY OF SHATTERED HOMES


From the snowy Place de la Gare the street cars started regularly in
divergent directions, but oh, the gloom of those dead streets which
they passed! Wide streets, winding between rows of low houses,
plain and solid, but built on a neighborly plan. Their desolation is the
more marked because of this innate, homelike quality. In almost all
of them the window and door spaces were boarded up, and the first
impression was rather that of a deserted city than of a demolished
one. But a second glance showed that destruction had come from
the sky, tearing away the roof, annihilating the interior, and
rendering the house uninhabitable, perhaps irreparable, though the
walls might to a certain extent be left standing. Often the havoc was
more apparent, exposing the bare skeleton of a home and the
shattered remnants of household comforts in shocking nudity.

The freakishness of destruction by bombardment is proverbial. It is


this which creates in the timid an intense anxiety and in the hardy
the willingness to take a chance. The 8-year-old son of the chief
surgeon at the Military Hospital, stretching out his hand during a
bombardment, said calmly, "Of course it may fall on that, but there
is plenty of room on each side." And this rather sums up the spirit of
the Dunkerquois who remain.

Of a population of 40,000, about 5,000 are left, and most of these


have become modern cave men. To be thoroughly up to date one
must live in a "casemate." In every quarter of the town posters
announce the locality of these public refuges. They are either cellars
reinforced overhead, or dugouts in the public squares, strongly
roofed with corrugated iron, which is covered with wood and
sandbags. Often there is extra trench work inside, always a tight
little stove with a pipe running the length of the cave, plank benches
along the sides, and usually beds with army blankets.

DODGING THE BOMBS


Into these refuges the Dunkerquois has learned to precipitate
himself with extraordinary celerity. He considers a minute and a half
sufficient time in which to gain safety, no matter where he may be
when the "alerte" is given. When there is a bombardment from the
land side the alarm is sounded as the obus[**? *french for shell]
leaves the gun at the front. It takes 90 seconds for its flight to
Dunkirk. So accurately is this calculated that casualties seldom result
from a land bombardment. The inhabitants scuttle into safety, and
the damage is limited to bricks and mortar. The peppering from sea
is also taken lightly. The firing is very rapid, but it is soon over, and
the shots are comparatively small, passing clean through the walls
without shattering them. It is the air raids which are dreaded, and
these are increasingly frequent and destructive. Often the chugging
of the motors can be heard in the thick darkness for a quarter of an
hour or more before there is an explosion, and this is a nerve-
racking experience.

A striking feature of the streets in Dunkirk is the incumbrance of the


sidewalks by boxes filled with stones and sandbags. These cover the
windows and approaches to the cellars and serve as shock absorbers
against flying pieces of shell.

And why does any one stay in so precarious an outpost on the verge
of the fighting line? Some perhaps because to set forth alone or with
a brood of children into an unknown world already trampled by
countless refugees seems an equally perilous outlook. Others
because their maintenance still depends upon the docks and
shipyards, though the 6,000 longshoremen usually employed about
the piers have disappeared. Then there are those whose interests
are bound up in a shop or other investment in the town, and
business is brisk in Dunkirk, owing to the presence of two armies. A
few there are who are not only of Dunkirk but who are Dunkirk itself,
upon whose presence depends the prosperity of the town and its
usefulness to the State.

STILL A LIVELY PORT


For if the picturesque landmarks have disappeared, Dunkirk has by
no means lost its sea prestige. It is the third port of France, and
though its position is singularly exposed it is largely through its
harbor that the British Army has been revictualed since the
beginning of the war. This renders still more remarkable the fact that
not one ship has been lost between Dunkirk and the English port of
clearing. One does not appreciate at first glance all that this implies.
It means for one thing that some one must sit tight at Dunkirk.
Traffic by sea has gone on uninterruptedly and until recently has
been quite that of normal times. Now, owing to the recent
restrictions on imports and exports, it is greatly reduced, though still
regular. The sailings and dockings take place on schedule time.

One of those largely responsible for the order of the port is the
Consular Agent of the United States, M. Morel, also President of the
Chamber of Commerce of Dunkirk. His house, a mere skeleton, has
long since been abandoned for the superior comforts and safety of
the cellar. Attached to the jamb of the almost equally ruined office
building his small sign in black and gold makes a brave showing. The
front of the building had been largely torn away and with it a part of
the roof. Looking up one saw a dizzy arrangement of laths and
rafters, suggestive of the underside of a heap of jackstraws. But the
staircase was firm and led to a small back room, where a bright fire
burned and where business was transacted as usual; not only the
business of the port, for while I was there an American Red Cross
doctor and a bevy of nurses came in to have their passports
renewed.

Another home which I had the privilege of entering, that of


Commandant Boultheel, had been more fortunate, for it stood as yet
untouched by disaster. Here in an atmosphere of warm charm, a
serene and gracious hostess dispensed hospitality to her friends.
Pewter and old china on the walls and a great fire of logs dispelled
the depression of the outside world. Around the table were men of
war and men of the world, who represented the finest qualities of
the French. Among them was a valiant Préfet du Nord, who had
spent ten months as hostage in a German prison, using his time to
study English and reread Horace. In fact, I felt, as I had on the train,
that the further I got from Paris the nearer I came to the heart of
France.

A glimpse of "cave life" I had in the pharmacie maintained by the


Sisters of the Sacré Coeur in the basement of the Hôtel de Ville,
where it had been temporarily installed by the city, its own quarters
being untenable. This was a large space lighted by electricity and
crowded with bottles and jars, bundles of herbs and bandages, and
made cheerful by the bright faces of the sisters. In another portion
of the cellar they sleep, living entirely underground.

Families are large in Dunkirk, and children troop unconcernedly to


and fro between home and school. To them the nightly flight to the
casemate is no longer a wild adventure.

BUSINESS UNDER DIFFICULTIES


The business part of the town has not the sad aspect of the
residence streets, for it is full of life. The decrepit shops, half
boarded up, many of them resembling a face with a bandage over
one eye, are doing a lively business. With the demands of a large
floating population of two armies, Dunkirk is not suffering
commercially. Department stores, book shops, shoe stores, provision
shops of all kinds, make the most of a short day. Oranges, figs,
dates, nuts, and conserved food of all kinds are much in evidence,
also warm clothing, blankets, boots, and novels. The restaurant of
the Hôtel Chapeau Rouge was filled with French and English officers,
and an excellent meal was served much as it would be in Paris. At
4:30 everything is closed. Lights are extinguished, windows and
doors are sealed with their householders behind them, unless the
latter are among those who seek the comparative safety of the
suburbs at nightfall. For though the entire surrounding country is
subject to bombardment, the town is the centre of attack. In the
twilight of the unlighted streets scarce a footfall is heard. Only the
occasional rumble of a heavy cannon shakes the air. Behind the wall
of darkness pulses a full life undismayed by the terrors of the
approaching night or the possibilities of the tomorrow.

A STAG AT BAY
In the heart of the forest I once saw a stag leading his herd to the
shelter of a rock in the rush of an oncoming storm. Having urged
them into crouching positions around him, he turned and with a
simple gesture lifted his head to the storm. There was that in his
attitude which compelled reverence. One mentally saluted, though
one might think "poor, silly beast, in what way could he mitigate the
lash of the tempest?" But instinctively he had obeyed the highest for
which he had been created, the protection of the weak. And his calm
presence caught away all panic from those around him. Often while
in Dunkirk this scene came back to me, recalled by the simple
matter-of-courseness with which these brave men and equally brave
women stayed on because it was the place for them to be.

At the Military Hospital of Rosendael, with the exception of the


intrepid surgeon and the almoner, it is the women who hold the
position. Originally the city hospital, it was taken over by the army at
the beginning of the war. An immense building with modern
equipment and a capacity for 700 patients, it has been necessary of
late to evacuate many of the sections because of the increasing
frequency of the bombardments. The hospital has been struck many
times and one ward completely destroyed. As it happened there
were no soldiers in that section, it being used as a maternity hospital
for the city. Several women and little children were killed and also
the sister in charge, Sister St. Etienne, so dear to her co-workers
that she is never spoken of without tears. She had just finished her
rounds for the night when the alarm came. Her one thought was to
save her ward from panic. A bomb crashing through the roof hurled
a beam across the sister, killing her instantly and wrecking the entire
wing.

"FOR ALL AMERICAN WOMEN"


In spite of this tragedy and of recurring attacks, the other sisters
and the head nurse, Mlle. Guyot, have held their posts with quiet
heroism and have never lost an hour's duty. The patients now are
mostly convalescent, because fresh cases are no longer brought
there.
The supplies of shirts, pajamas, and bandages sent from America
were gratefully commented upon by Mlle. Guyot, and I was touched
by similar expressions from the men. One poor aviator, terribly
burned, but recovering, put up a bandaged hand and saluted me
"for all American women." Another poilu wove for me a table mat of
red, white, and blue cord. All were fervent in their good wishes.

Everywhere warmth and order prevailed, from the wards where the
bandaged soldiers sat about with their pipes and their knitting to the
big bakery where the fragrant brown bread is baked and to the
kitchens with their caldrons of broth and crisp roasts of meat.

Dry, well ventilated "abris" or bomb shelters have been built in


connection with each section of the hospital. The surgeon, who
sleeps in a cellar near the centre, is the first to assist his patients to
shelter in case of an alarm. There, underground, long games of
cards are played on the brink of the unknown. This is not
callousness, but is done with deliberate intent by the clever surgeon,
(a refugee from Lille,) knowing that by this means his men may be
saved a nervous strain which might prove fatal.

Mlle. Guyot, who has been at the hospital since the beginning of the
war, knows as well as any one what the city has endured. It was she
who said to me:

"I shall never forget that Dunkirk has borne the weight of the war
from the first day; that she has seen the exodus of the Belgian
population, to whom she has given refuge as well as to the people
of the Department du Nord; that she has known the passing of
innumerable armies going and coming from the Yser; that in
October, 1914, she began to be bombarded, having at the same time
to fulfill the immense duty of bringing in and caring for the wounded
from that immortal battlefield; and through it all I have seen Dunkirk
living and working and saving with a smile!"
The military position of Dunkirk is sometimes confusing because it
has been alternately on the French and English fronts. The English
are now retiring, but sentinels of three nationalities still guard the
city gates; English Tommy and French poilu stand with their arms
across each other's shoulders, the Belgian stands apart.

On the sands of Malo, which is but a prolongation of Dunkirk, with a


sweeping beach toward the North Sea, strange men from Tonquin
were digging trenches—dark men branded by the sun and the mark
of the East, with warm dabs of color on their high cheekbones, and
small opaque eyes under rising brows. The uniform of the French
Colonial is often a medley. He looks as though he had begun
"dressing up" like children in the attic, and as though his mind had
fallen short of his expectations. Out on those bleak sands his
touches of rich blue, crimson, and green had almost the fervor of
stained glass set against the dark and sinister sea. To the north the
Belgian coast cut the background with a livid streak of sand.

In spite of the moving figures, the loneliness was as of the ends of


the earth. The silence was accentuated rather than broken by the
purr of the cannon and the mewing of a stray gull slapped sidewise
by the wind. But it is thus that I like to think of Dunkirk—scourged
by the wind, blotted out by the storm, knowing that for the time
being her stout hearts are safe.

As the sea has been the life of Dunkirk in the past, so it will be its
resurrection. The city cannot be struck a deathblow from the land
side as has many another less favorably situated. But what a unique
protégé for some god-mothering American city to help re-establish
through her sympathy and aid!

Is it any wonder that France has just included in the arms of Dunkirk
the following legend in addition to the one gained by the naval battle
of 1793: "Ville heroique, sert d'exemple à toute la nation"?
Brutal Treatment of Italian
Prisoners

S worn statements from British soldiers returned from German


prison camps and hospitals received by Reuter's Agency (the
Associated Press of Great Britain) indicate that systematic brutality is
practiced there upon Italian prisoners. Lance Corporal Horace Hills,
7th Suffolk Regiment, made the following statement under oath:

Five or six thousand Italians came in. They had traveled


three or four days, and had had nothing at all to eat. After
they arrived soup was brought in, and, as they were
starving, they rushed at it. The Germans then dashed
forward and stabbed them with their swords and
bayonets, and killed and wounded a lot. Seven or eight
Italians were dying every day in the camp of starvation.
They had no parcels. I saw an Englishmen give an Italian
bread, and the Italian went down on his knees and kissed
his hands.

Private J. F. Jackson, King's Liverpool Regiment, swore:

One Italian told me they had been fifteen days on the


journey and had only three meals all the time. Our
hospital lager was separated from the camp by barbed
wire; we took some bread and threw it over the wire to
the Italians; they all began to grab for it, but a lot of
Germans rushed up and drew their bayonets and
flourished them in the air in a threatening manner, and
kicked and threw the Italians about, and got the bread for
themselves.
At Friedrichsfeld the treatment of the Italians was equally barbarous,
the sentries shooting them for trying to get food from the British.
Equally revolting stories come from Ohrdrup, Nammelburgh, Stendal,
Soltau, Limburg, and Hamburg.
Germany's Attempt to Divide
Belgium
Official Summary of Recent Political Events in
Flanders, Issued by the Belgian Foreign Office
Germany's plan to divide Belgium by organizing a small group of
"activists" to establish a so-called Council of Flanders for the purpose
of separating the Flemish from the Walloon Provinces, was described
in the April issue of Current History Magazine, pp. 91-96, along with
the fearless opposition which the attempt created. The following
summary of the case, with a fuller array of dates and details, has
since been prepared by the Belgian Foreign Office at St. Adresse,
France, the seat of King Albert's Government in exile:

T he semi-official Wolff Agency in Berlin announced on Jan. 20,


1918, that the so-called Council of Flanders had proclaimed the
autonomy of Flanders Dec. 22, 1917. Soon after that action, which
had passed unnoticed and had left Belgian opinion indifferent and
scornful, Herr von Walraff, German Secretary of the Interior, had
judged the time opportune for a trip to Belgium, (Jan. 1, 1918.) The
"council," after getting into close relations with him, had taken up
the decree which the Landtag had intrusted to him on the 4th of
February preceding, and had declared that it would submit itself to a
popular referendum.

At length a commission of executive officials was created; it included


heads for the Departments of the Interior, Agriculture, Public Works,
Arts and Sciences, Justice, Finance, Labor, National Defense, Posts
and Telegraph, and the Navy. The German telegraphic agencies sent
out this news in all directions to spread the idea that Flanders was
showing an intention of detaching itself from Belgium, and to give
the impression of a spontaneous popular movement for political
separation.

The thought that inspired this intrigue dates back to a period almost
two years earlier. On April 5, 1916, the German Chancellor, in
defining the war aims of Germany before the Reichstag, had outlined
the imperial policy of establishing a protectorate over the Flemings.
Later there were found in Belgium some obscure and discredited
citizens who, betraying their sacred duty, placed themselves in the
pay of the enemy and consented to make themselves the agents
and accomplices of the invaders.

GERMAN ACT OF SEPARATION


On Feb. 4, 1917, an assembly composed of 200 Belgians speaking
the Flemish language met and voted for the creation of a "Council of
Flanders." On March 3 this body sent a deputation to Berlin, and the
Chancellor announced to it that "the policy tending toward the
administrative separation would be pursued with all the vigor
possible during the occupation," and that "during the negotiations
and after the conclusion of peace the empire would not cease to
watch over the development of the Flemish race." The German
decrees dividing Belgium into two administrative regions followed
close upon these declarations, (March 21, 1917.)

At the end of 1917 the German authorities believed that the moment
had come to consummate the enterprise by completing the
administrative separation with a political separation. Thus the end
would be attained: Belgium would be dismembered; one part of the
country would fall under vassalage to Germany, and, in case there
were no annexation, would become in a way a sphere of influence
for the empire.

The intrigues of the "Council of Flanders" are merely a comedy


intended to mask this policy. The policy rests upon a clever juggling
with the question of languages. Under cover of the principle of free
self-determination of peoples, it seeks to internationalize an internal
problem in the hope of dislocating the Belgian nationality. Perhaps it
also aims at the creation of a fictitious Government which shall
furnish the German Government with the means for opening
fallacious peace negotiations to deceive the world and weaken the
cohesion of the Allies. Many German newspapers have allowed these
aims to appear, and some have boldly unveiled them.

ALL BELGIUM PROTESTS


But the strong protests of Flemish communities and of the entire
Belgian Nation have foiled these plans, and the news coming from
the occupied region enables us to determine with precision the
character of the rôle played by the "Council of Flanders." At the
same time it attests the determination of the Belgian people to repel
all foreign interference and to maintain its unity unshaken.

What is this "Council of Flanders"? It has no representative


character. It was created by a private assembly which had no
mandate from the people. It now pretends to seek popular sanction
through an election. This is only a subterfuge. There has been no
election. There has been no consultation of the people. The
promoters have limited themselves to assembling groups of
adherents in theatres or restaurants, and causing gatherings
composed of their proselytes, with an admixture of the curious and
the idle, to vote on lists of candidates previously arranged in the
private offices of those who are directing the work.

The Deputies and Senators, in a protest to the Chancellor, thus


denounced the pretense of an election that was organized in
Brussels:

A meeting was called at a day's notice in an exhibition


hall. Everybody entered who wished to, Belgians or
strangers, men, women, and children. There were in all
600 or 700 persons. It was these unknown persons, come
together by chance, without control or guarantee, that in
a few moments, as an interlude in a speech, proclaimed
the election of twenty-two Deputies to the "Council of
Flanders" and fifty-two Provincial Councilors, Such was the
expression—without the knowledge of the people—of the
will of the Municipality of Brussels, which has 200,000
electors and almost 1,000,000 inhabitants.

PROTESTS OF CITY COUNCILS


Foreign occupation has not wholly destroyed legitimate and regular
representation in Belgium. The Provincial Councils and the City
Councils are still functioning. The administrative framework of the
country survives. The municipal organization, so solidly rooted, has
not ceased to exercise power. The Provincial and Municipal
Councilors, like the Deputies and Senators, most of whom remain in
the country, have been elected by universal, direct, and secret
suffrage. They alone in the occupied territory are competent to
express the true national opinion, and that opinion is strikingly
voiced in the protest of the Flemish and Walloon members of
Parliament, in that of the Common Councils of the capital and the
large cities of Antwerp and Ghent, whose example has been followed
by an increasing number of prominent citizens and local
Governments of smaller towns in Flanders.

It has been demonstrated that the "Council of Flanders" is pursuing


an enterprise of usurpation, that it is a tool of the invader, and that
its members are in reality only agents of the German authorities.
They went to Berlin a year ago to ask for administrative separation.
Herr von Walraff met them at Brussels at the beginning of 1918 to
arrange for political separation. When Tack and Borms were arrested
by the Belgian police on the order of Belgian Magistrates it was the
German functionaries who, by force, compelled their release, and
they came out of prison by the side of the German officer who had
liberated them. It was the Kommandantur of Antwerp that ordered
the communal administration, disregarding its resistance, to
authorize the "activist" demonstration of Feb. 3, and to have this
protected by the police, in violation of orders of the Burgomaster
that had been in force nearly four years. It was the German military
headquarters, too, that forbade all demonstrations of other groups
and commandeered the hall of the Chamber of Commerce, placing it
at the disposition of the organizers of a demonstration judged by the
Burgomaster to be one to wound public sentiment and endanger the
public peace.[1]

At length Governor General von Falkenhausen stamped the "Council


of Flanders" with the seal of German investiture, deciding by a
decree of Jan. 18, 1918, (published Feb. 10,) that the appointment
of the "council's" delegates was subject to his ratification, and that
these delegates were called to collaborate with him in his legislative
labors.

Thus one has the right to conclude that the whole organism of the
"Council of Flanders" is only a foreign tool to serve the enemy in his
designs of division and oppression. The delegates of the council
cannot pretend to any independence, since the decree of Jan. 18
reduces them to the rôle of functionaries of German authority,
named by that authority and expected to contribute, by their advice,
to its political work.

THE DELEGATES OSTRACIZED


The Belgian people, without distinction of language, party, or
condition, have, by impressive demonstrations, repudiated the
faithless citizens who, joining hands with the enemy, have arrogated
to themselves the right to speak in the name of the Flemings. The
Flemings were the first to condemn the crime. To the protests of the
Deputies and Senators and of the City Councils have been added
those of the leading intellectual and political societies of Flanders.
The Flemish Academy raised its voice to "affirm its fidelity to the
Belgian Fatherland and its King." The Belgian Labor Party proclaimed
that "not one of the 800 labor groups composing it, and not one of
its authorized leaders, had been led astray or corrupted by the
activist-separatist movement, either in Flanders or in Wallonia."

In the streets of Antwerp, of Malines, of Brussels, spontaneous


uprisings which the German troops could not suppress voiced the
scorn and anger of the crowds.

Crowning this expression of the popular will and giving it the


sanction of law, the Brussels Court of Appeals, acting upon the
protest of the Deputies and Senators, at a plenary sitting of all its
united chambers, [Feb. 7, 1918,] ordered a hearing which ended in
the arrest of delegates of the "Council of Flanders" on a charge of
conspiracy against the form of the State, interference with public
functions, and wicked attacks against the constitutional authority of
the King, the rights of the chambers, and the laws of the nation.
When the German authorities, protecting the guilty ones and acting
in the guise of vengeance, caused the arrest of the Presidents of the
Court, who had come in the august garb of justice to do their duty,
the Court of Cassation, by a decree of Feb. 11, decided unanimously
to suspend its sittings; the Courts of Appeals in Ghent and Liége,
with all the courts of first instance and the courts of commerce,
followed its example. The civic heroism of a whole people is summed
up in that impressive gesture. There is no more eloquent page in
history.

This nation can remain free. It stoically endures the presence and
domination of the enemy in its territory. The foreign occupation that
has lasted three and a half years has not broken its spirit or its will
to resistance. The Flemish, like the Walloon communities, victims of
the most frightful brutalities, subjected to a system of forced labor,
decimated by deportations, have remained immovably faithful to
King and country. The moral unity of the nation has continued intact.
FLEMISH QUESTION NOT NEW
The Flemish question does not imperil this unity. It dates much
further back than the war and has often been a subject of lively
debate. It is a question of interior policy which the nation alone must
solve, after the war, independently, under its own free constitutional
powers. Belgium has had the same Constitution since 1831, and has
not dreamed of altering its principles, unless we except the
proclamation of universal manhood suffrage in 1893. In eighty-three
years of peace and prosperity there was not a single political party
that cast doubt upon the validity of the fundamental charter—an
eloquent proof of its plastic vitality and perfect harmony with the
deepest needs of the nation's collective existence.

Equality before the law, (Article 6,) individual liberty, (Articles 7, 8, 9,


10,) liberty of religious faith, (Articles 14 and 15,) freedom in
education, (Article 17,) freedom of the press, (Article 18,) the right
of assembly, (Article 19,) liberty of association, (Article 20,) freedom
as to language, (Article 21)—these are the essential axioms on
which the nation's public life is based.[2]

The Belgian Constitution, after guaranteeing respect for these


fundamental principles, regulates the exercise of political powers, all
of which, it declares, "emanate from the nation." (Article 25.) "The
legislative power is exercised jointly by the King, the House of
Representatives, and the Senate." (Article 26.) The Deputies are
elected directly by all the Belgian citizens who are 25 years old and
who have lived at least one year in the commune, those who fulfill
certain requirements of knowledge or capacity being allowed one or
two supplementary votes. (Article 47.) Senators are elected on the
same principles, with the difference that the voters must be at least
30 years old. The Senate also includes a certain number of members
elected by the Provincial Councils. (Article 53.) For both chambers
the voting is obligatory and secret, and the division of seats is
arranged on a system of proportional representation that safeguards
the rights of minorities. Subject to the responsibility of his Ministers
the King exercises the executive power. (Articles 63 and 64.)

Judicial power is exercised through courts whose members are not


subject to removal. (Articles 99 and 100.) A jury alone can deal with
criminal cases, political charges, and indictments brought against the
press. (Article 98.)

Finally, side by side with the three great political branches, the
provincial and communal Governments deal with all matters of local
interest. Chief among them are—for the commune: the City Council,
elected by direct vote, and the "College of Burgomasters and
Aldermen," whose members are chosen by the Common Council,
with the exception of the Burgomaster, who is appointed by the
King; and for the province: the Provincial Council, directly elected,
the "Permanent Deputation," elected by the Provincial Council, and
the Governor, who represents the National Government.

SETTLING THE LANGUAGE ISSUE


This rapid sketch suffices to show the democratic and liberal nature
of the Belgian Governmental system. Such institutions permit of free
discussion and facilitate the peaceful solution of the most irritating
internal problems. As the protest of the Flemish societies puts it,
"The Flemings are not a conquered nation; they have the same
electoral right as the Walloons; they have all the means for
safeguarding their just rights."

Belgium has always lived an intense life, yet this has never
compromised its unity. Three great parties, the Catholic, the Liberal,
the Socialist, struggle for preponderance, and their action extends to
all parts of the country without distinction of language. Each of them
supports an identical program, in Flanders as in Wallonia, regardless
of whether the citizens speak Flemish or French. The party lines
have never corresponded with the linguistic lines. In each are found
leaders of the Flemish movement, whose aspirations have given rise
to many speeches, but have never been repudiated as anti-patriotic.
This movement is thus described by the Flemish societies in their
protest against the "Council of Flanders:" It is the expression of the
fundamental principle that every population possesses the
inalienable right to develop itself according to its own character and
its own language, life, and historic personality." But it remains
essentially national and declares itself, in the document just cited,
unalterably hostile to the separation of the country into two
Governments with two capitals, two Ministries, two Parliaments. The
Flemish societies see in separation only "a weakening that will lead
to a catastrophe for the Flemings, as well as for the Walloons." They
add:

Our most sacred political and economic interests are


menaced by these absurd plans. The organic whole which
has made of Belgium, through its commerce and industry,
its rivers, ports and railways, its agriculture and
workingmen, all working together under a single
Government through scores of years, an economic power
of the first order, would be dissolved, artificially weakened
by contradictory influences, enervated by divergent official
policies. The narrow particularism which in the past and
present has done so much harm would dominate. The
balance between the different political, religious, and
social tendencies in our country would be destroyed, and
Belgium would be left in a state of crisis which, through
long years, would render almost impossible the relief of
the country and the curing of the wounds caused by the
war.

RIGHTS OF FLEMISH TONGUE


In the years before the war the Belgian Parliament passed several
laws intended to assure to the Flemish language the place that
belongs to it in the national life, especially in the administrative,
judicial, and educational departments. It will suffice to recall the law
of May 12, 1910, on secondary schools, and the law of July 2, 1913,
on languages in the army, making a knowledge of Flemish and
French obligatory for admission to the National Military School. At
the moment when the war broke out the Parliament was considering
a proposition tending to organize Flemish high schools, and in a
report to the King, Oct. 8, 1916, the Government declared itself
"convinced that immediately upon the re-establishment of peace a
general agreement of favorable sentiments, which it will try to
promote, will assure to the Flemings, both in the higher schools and
in all the others, that complete equality, in right and in fact, which
ought to exist under the guarantees of our Constitution." (Moniteur,
Oct. 8-14, 1916.)

Only after the war can the Government solve the problems arising
out of the Flemish movement. The promoters of that movement
themselves deplore the intervention of an alien power and scorn the
traitors who have conspired with the enemy, accepting money and
positions at his hand. It is as loyal Belgian citizens, they declare, that
they are striving for reforms from which they expect a fuller
intellectual development of Flemish communities, and they see in
such culture a new force of unity for the nation, from which they by
no means wish to be separated.

BELGIAN PREMIER'S VIEW


Baron de Broqueville, the Belgian Prime Minister, said to a
correspondent of The London Times:

The Belgian people, after three and a half years of the most grinding
oppression, have shown by the courageous defiance of enemy
bayonets which brought about the collapse of the "activist" plot, that
they have lost none of their sturdy resolve to be free; that the spirit
which moved them to reject the German ultimatum of Aug. 2, 1914,
is as strong as ever. * * *
Only one thing is worrying and humiliating in a quite special degree
all Belgians in occupied territory. It is the fear lest abroad it may be
imagined that there really is an "activist" movement in Belgium. All
the reports we have received on this point amount to this: "No one
in Belgium talks of this alleged movement, for it is nonexistent.
There are a few miserable individuals in German pay—always the
same—who intrigue and plot. All they have achieved is to arouse
against them such feelings of repulsion and hate that they have
been thrust forever forth from the nation, and nothing can cleanse
them of their crime. For mercy's sake, beg people not to insult us by
treating the agitation of these individuals seriously, and to stop
seeing any agitation where there is nothing but the work of a few
paid traitors.

It is in this sense that our compatriots write to us from behind the


German barrier. There, as elsewhere, the most ardent advocates of
Flemish claims reject foreign interference in internal policy, and they
treat as traitors to the cause all those who accept bribes from the
torturers of their country.
Stripping Belgian Industries
Germany's Use of the "Rathenau Plan" for the
Exploitation of Belgium and Northern France

T he German Government from the beginning of the war has


systematically stripped the factories of Belgium and other
conquered territory with the purpose, it is charged, of crippling
industries in those countries, not only as a war measure, but as an
economic means of preventing future competition. This phase of
German war policy is treated in a brochure edited by Professors
Dana C. Munro of Princeton, George C. Sellery of the University of
Wisconsin, and August C. Krey of the University of Minnesota. It is
issued by the United States Committee on Public Information under
the title, "German Treatment of Conquered Territory." The editors
find their text in this statement by Deputy Beumer, made before the
Prussian Diet in February, 1917:

Anybody who knows the present state of things in Belgian


industry will agree with me that it will take at least some
years—assuming that Belgium is independent at all—
before Belgium can even think of competing with us in the
world market. And anybody who has traveled, as I have
done, through the occupied districts of France, will agree
with me that so much damage has been done to industrial
property that no one need be a prophet in order to say
that it will take more than ten years before we need think
of France as a competitor or of the re-establishment of
French industry.

This exploitation for the benefit of German industry is an outgrowth


of the plan suggested early in August, 1914, by Dr. Walter Rathenau,
President of the General Electric Company of Germany, to establish a
Bureau of Raw Materials for the War. The bureau
(Kriegsrohstoffabtheilung) was made a part of the Ministry of War.
Its operation in the occupied territories was explained in a lecture by
Dr. Rathenau in April, 1916, as follows:

It was necessary to be sure of an increase in the reserve


of raw materials both by purchase in neutral countries and
by monopolizing all stocks found in the occupied territory
of the enemy. * * * The occupation of Belgium, of the
most valuable industrial parts of France, as well as of
parts of Russia, made a new task for the organization. It
was necessary to make use of the stocks of raw material
of these three territories for the domestic economy of the
war, to use, especially, the stores of wool found at the
centres of the Continental wool market. Valuable stocks of
rubber and of saltpeter were to be used for the profit of
the manufacturer at home. The difficulties that are met
with in keeping to the rules of war while making these
requisitions have been overcome. A system of collecting
stations, of depots and of organizations for distribution
was arranged which solved the difficulties of
transportation, infused new blood into industry at home,
and gave it a firmer and more secure basis.

BRAND WHITLOCK'S STATEMENT


This plan, which has given German industry "a firmer and more
secure basis," was used not merely to "make war support war" by
contributions wrung from the conquered peoples, but also to destroy
future competition—in violation of The Hague Convention, (Articles
46, 52, 53,) which Germany had signed. In the first months of the
war a pretense was still made of acting under military necessity, but
this was soon abandoned. On March 4, 1915, Brand Whitlock,
American Minister to Belgium, reported to the State Department:
The Federation of Belgian Steel and Iron Manufacturers
forwarded a protest to the German Governor General in
Belgium, on Jan. 22, 1915, complaining that the German
authorities have invaded the Belgian plants and seized the
machinery and tools, which have been taken to pieces and
sent to Germany in great number; in many cases no
receipt was left in the hands of the legitimate owner to
prove the nature, number, and value of the seized tools.
Machinery to the value of 16,000,000 francs ($3,000,000)
had been taken away up to Jan. 22.

Furthermore, the Feldzeugmeisterei in Berlin has entered


into a contract with the firm Sonnenthal Junior of Cologne,
which firm is to collect, transport, and deliver to German
manufactories of war supplies all engines and tools seized
in Belgium and France, and to bring them back after the
war is over.

This contract provides, also, that the Sonnenthal Company


has the right and even is compelled, in co-operation with
the gun foundry at Liége, to pick out in factories of the
occupied territory those machines which seem most useful
for the manufacture of German war supplies and to
propose the seizure of the machinery.

The Royal Belgian Government protests, with indignation,


against these measures, which constitute a clear violation
of Article 53 of the regulations of the Fourth Hague
Convention. The items enumerated in Article 53 are
limited and neither the seizure nor the transport to
another country of machinery and tools used in industry
are permitted; these implements must always be
respected when they are private property, (Article 46.)

By the removal of these tools, the efforts made by the


manufacturers in order to maintain a certain activity in the
plants are nullified, numerous workmen are obliged to
remain idle and are facing starvation. These measures will
also retard the restoration of industry after the war is over.

Furthermore, the German authorities disregard in a


systematic way the prescriptions of Article 52 of the
above-mentioned regulations of the Fourth Hague
Convention, which stipulate that requisitions in nature
from towns and their inhabitants in the occupied territory
can only be permitted when they are directly destined for
the army of occupation.

UNJUST FINES
A dispatch from Minister Whitlock dated at Brussels, Aug. 2, 1915,
gives a fuller memorandum on the subject, as follows:

Upon the arrival of German troops at Brussels, the city


and communes of the agglomeration were required to pay
as a war contribution the sum of 50,000,000 francs in
gold, silver, or banknotes, the Province of Brabant having
to pay, in addition, the sum of 450,000,000 francs, to be
delivered not later than Sept. 1, 1914.

The sum of 50,000,000 francs imposed on the City of


Brussels was reduced to 45,000,000 francs, but the city
was later subjected to a penalty of 5,000,000 francs on
the ground that two members of the German Secret
Service had been attacked by the crowd without
assistance having been rendered by the Brussels police.
On this point it may be noted that when Mr. Max, the
Burgomaster, at the beginning of the occupation, asked
the German authorities to inform him of the names of the
German secret police agents whom they intended to
employ, he was told that there were no German secret
police in Brussels.
In December, 1914, a contribution of 480,000,000 francs,
payable at the rate of 40,000,000 a month, was imposed
on the provinces.

At the beginning of April, 1915, a fine of 500,000 marks


was imposed on the City of Brussels, which refused to
repair the road between Brussels and Antwerp—a State
road the repair of which devolved upon the State. But the
German authorities had taken over the State moneys, and
should, therefore, have assumed the expense of the work.
Furthermore, this road is entirely outside of the territory of
the City of Brussels, and, finally, the city had not the
administration for the maintenance or construction of
roads, and had neither material nor personnel to carry on
such work.

On Jan. 16, 1915, on Belgians who had voluntarily left the


country and had not returned by March 1, 1915, tenfold
advance of personal tax was made; and many taxes were
imposed on communes as indemnity for damages claimed
by German citizens to have been suffered through acts of
the inhabitants at the time war was declared.

When the German Army arrived in Brussels, it


requisitioned for the daily support of the troops 18,000
kilos of wheat, 10,000 kilos of fresh meat, 6,000 kilos of
rice, 10,000 kilos of sugar, and 72,000 kilos of oats.
Similar requisitions were made, in all cities in which the
German troops camped. The requisitions, however,
exceeded the needs of the troops in passing or in
occupation, and a large part of the requisitioned supplies
was sent to Germany.

At Louvain the German authorities requisitioned 250,000


francs' worth of canned vegetables and at Malines about
4,000,000 francs' worth.
In Flanders and in part of Hainault the farmers were
despoiled of almost all their horses and cattle and the little
wheat and grain remaining. The little village of
Middleburg, for instance, which numbers 850 inhabitants,
after having given up 50 cows, 35 hogs, and 1,600 kilos of
oats, was forced to furnish in January and February, 1915,
100 hogs, 100,000 kilos of grain, 50,000 kilos of beans or
peas, 50,000 kilos of oats, and 150,000 kilos of straw.

At Ghent and Antwerp the German authorities found about


40,000 tons of oil-cake, necessary for the feeding of cattle
in Winter, and seized it.

They also carried off several hundred thousand tons of


phosphates from Belgium for use in Germany.

Walnut trees on private properties, as well as on State


lands, were cut down and requisitioned.

Besides, draught horses—the result of a rational selection


carried on through more than a century and probably the
most perfect Belgian agricultural product—were carried off
throughout all Belgium. Not only did the German Army
requisition horses necessary for its wagons, mounts for its
troops or artillery service, but it carried away from the
Belgian stock horses absolutely unfit for military service,
which were sent to Germany. The same is true as regards
the cattle.

All crude materials indispensable for Belgian industries


were requisitioned and sent to Germany—leather, hides,
copper, wool, flax, &c. Furthermore, if not the entire stock,
at least the greatest number possible of machinery parts,
were shipped to Germany to be used, according to
German statements, in making munitions which the
Belgian factories had refused to produce.
At Antwerp, requisitions of all kinds of materials and
products were considerable, notably:

Francs.
Cereals 18,000,000
Oilcake, about 5,000,000
Nitrate, over 4,000,000
Oils—animal and vegetable—
2,000,000
over
Oils—petrol and mineral—about 3,000,000
Wools 6,000,000
Rubber 10,000,000
Foreign leathers, to Dec. 1,
20,000,000
about
Hair 1,500,000
Ivory, about 800,000
Wood 500,000
Cacao 2,000,000
Coffee 275,000
Wines 1,100,000

Cottons in large quantities—one house having been


requisitioned to the amount of 1,300,000 francs. Other
enormous requisitions were made on shop depots, &c.,
and are impossible of computation just now.

PAYMENT WITHHELD
The requisitions from Antwerp, which Mr. Whitlock enumerates, were
the subject of a protest by the Acting President of the Antwerp
Chamber of Commerce on March 18, 1915. He valued these goods
at more than 83,000,000 francs ($16,600,000) and stated that only
20,000,000 francs ($4,000,000) had been paid by the German
authorities. The reply of Governor General von Bissing on Sept. 24
shows that up to that time payment had not been made. The reason
is indicated in the following statement of German policy, published in
the Frankfurter Zeitung Dec. 21, 1914:

The raw materials which the Imperial Government has


bought in Antwerp, Ghent, and other places will be paid
for as soon as possible. The payment will be made only
after the goods have been transported into Germany and
after the valuation has been made, and the payment shall
be made in such manner that no money shall be sent from
Germany to Belgium during the period of the war.

Professor Munro and his fellow-editors have drawn freely upon the
official texts printed in the work entitled "German Legislation for the
Occupied Territories of Belgium," edited, in ten volumes, by Huberich
and Nicol-Speyer, (The Hague, 1915-17.) These volumes cover the
period from Sept. 5, 1914, to March 29, 1917, and contain a reprint
of "The Official Bulletin of Laws and Ordinances" in German, French,
and Flemish. The documents show that the first step under the
Rathenau plan was to ascertain what raw materials and other
supplies were accessible. Consequently, there were many ordinances
commanding the declaration of certain wares. The following is an
example:

Brussels, Dec. 11, 1914.

All stocks of benzine, benzol, petroleum, spirits of alcohol,


glycerine, oils and fats of any kind, toluol, carbide, raw
rubber and rubber waste, as well as all automobile tires,
shall immediately be reported in writing to the respective
chiefs of districts or commanders, with a statement of
quantity and the place of storage. * * *

If a report is not made the wares shall be confiscated for


the State and the guilty individual shall be punished by the
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!

ebookname.com

You might also like