100% found this document useful (4 votes)
17 views

Programming Groovy Dynamic Productivity for the Java Developer 1st Edition Venkat Subramaniam All Chapters Instant Download

Programming

Uploaded by

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

Programming Groovy Dynamic Productivity for the Java Developer 1st Edition Venkat Subramaniam All Chapters Instant Download

Programming

Uploaded by

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

Download Full ebookname - Read Now at ebookname.

com

Programming Groovy Dynamic Productivity for the


Java Developer 1st Edition Venkat Subramaniam

https://ebookname.com/product/programming-groovy-dynamic-
productivity-for-the-java-developer-1st-edition-venkat-
subramaniam/

OR CLICK BUTTON

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebookname.com


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

Programming Groovy 2 Dynamic Productivity for the Java


Developer 2nd Edition Venkat Subramaniam

https://ebookname.com/product/programming-groovy-2-dynamic-
productivity-for-the-java-developer-2nd-edition-venkat-subramaniam/

ebookname.com

Programming Scala Tackle Multi Core Complexity on the Java


Virtual Machine 1st Edition Venkat Subramaniam

https://ebookname.com/product/programming-scala-tackle-multi-core-
complexity-on-the-java-virtual-machine-1st-edition-venkat-subramaniam/

ebookname.com

Programming Concurrency on the JVM Mastering


Synchronization STM and Actors Venkat Subramaniam

https://ebookname.com/product/programming-concurrency-on-the-jvm-
mastering-synchronization-stm-and-actors-venkat-subramaniam/

ebookname.com

Petrology of Sedimentary Rocks Second Edition Sam Boggs


Jr.

https://ebookname.com/product/petrology-of-sedimentary-rocks-second-
edition-sam-boggs-jr/

ebookname.com
Dark Secrets of the Old Oak Tree Southern Tree Series
First Edition Dolores J. Wilson

https://ebookname.com/product/dark-secrets-of-the-old-oak-tree-
southern-tree-series-first-edition-dolores-j-wilson/

ebookname.com

Dont download most pages are empty S ecrets of Self


Healing Harness Nature s Power to Heal Common Ailments
Boost Vitality and Achieve Optimum Wellness Maoshing Ni
https://ebookname.com/product/dont-download-most-pages-are-empty-s-
ecrets-of-self-healing-harness-nature-s-power-to-heal-common-ailments-
boost-vitality-and-achieve-optimum-wellness-maoshing-ni/
ebookname.com

MySQL and Java Developer s Guide 1st Edition Mark Matthews

https://ebookname.com/product/mysql-and-java-developer-s-guide-1st-
edition-mark-matthews/

ebookname.com

International Review of Research in Developmental


Disabilities 1st Edition Hodapp

https://ebookname.com/product/international-review-of-research-in-
developmental-disabilities-1st-edition-hodapp/

ebookname.com

Stand and Deliver High Impact Presentation 4th Edition


Speech

https://ebookname.com/product/stand-and-deliver-high-impact-
presentation-4th-edition-speech/

ebookname.com
An Introduction to Qualitative Research Becoming
Culturally Responsive 1st Edition Maria K E Lahman

https://ebookname.com/product/an-introduction-to-qualitative-research-
becoming-culturally-responsive-1st-edition-maria-k-e-lahman/

ebookname.com
What readers are saying about Programming Groovy

More than a tutorial on the Groovy language, Programming Groovy is


an excellent resource for learning the advanced concepts of metaob-
ject programming, unit testing with mocks, and DSLs. This is a must-
have reference for any developer interested in learning to program
dynamically.
Joe McTee
Developer, JEKLsoft

Venkat does a fantastic job of presenting many of the advanced fea-


tures of Groovy that make it so powerful. He is able to present those
ideas in a way that developers will find very easy to internalize. This
book will help Groovy developers take their kung fu to the next level.
Great work, Venkat!
Jeff Brown
Member, the Groovy and Grails development teams

At this point in my career, I am really tired of reading books that


introduce languages. This volume was a pleasant breath of fresh air,
however. Not only has Venkat successfully translated his engaging
speaking style into a book, he has struck a good balance between
introductory material and those aspects of Groovy that are new and
exciting. Java developers will quickly grasp the relevant concepts
without feeling like they are being insulted. Readers new to the plat-
form will also be comfortable with the arc he presents.
Brian Sletten
Zepheira, LLC

You simply won’t find a more comprehensive resource for getting up to


speed on Groovy metaprogramming.
Jason Rudolph
Author, Getting Started with Grails
This book is an important step forward in mastering the language.
Venkat takes the reader beyond simple keystrokes and syntax into
the deep depths of “why?” Groovy brings a subtle sophistication to
the Java platform that you didn’t know was missing. Once you see
those missing language features in action, you can’t imagine how you
ever programmed without them. As I read the book, I asked my own
“why?” question over and over: “Why wasn’t this book around when I
was learning Groovy?” After you’ve read this book, it’s difficult to look
at programming on the Java platform the same way.
Scott Davis
Editor-in-Chief, aboutGroovy.com; author of Groovy Recipes

Venkat neatly dissects the Groovy language—a language that is far


more than just “Java++”—in nice, edible chunks for the Groovy pro-
grammer to consume. If you’re a Java programmer and you’re try-
ing to figure out why everybody is getting all excited about dynamic
languages on top of the Java Virtual Machine, look no further than
Venkat’s book.
Ted Neward
Java/.NET/XML services, http://www.tedneward.com

Despite signs to the contrary, Java isn’t dead—it’s just evolving.


Today’s developer needs a dynamic language like Groovy in their
toolkit, and Venkat does a tremendous job presenting this exciting
new addition to the JVM. With all of his examples, you’ll be up and
running in no time!
Nathaniel T. Schutta
Author/Speaker/Teacher

I am always on the lookout for good books on the metaprogramming


features of languages, and Groovy finally has one. Part 3 of Venkat’s
book is devoted entirely to Groovy’s metaprogramming features.
Sweet. I won’t tell you which language to use, but if you are consid-
ering Groovy, read Part 3 of this book.
Stuart Halloway
CEO, Relevance, Inc.
www.thinkrelevance.com
This is a very well-written guide to Groovy. It’s an easy read, com-
pletely devoid of fluff, that will get you on the path to Groovy goodness
right out of the gate.
David Geary
Author, Clarity Training, Inc.

Venkat could make rocket science sound easy. He definitely makes


Groovy for Java developers sound easy.
Erik Weibust
Senior Architect, Credera
Programming Groovy
Dynamic Productivity for the Java Developer

Venkat Subramaniam

The Pragmatic Bookshelf


Raleigh, North Carolina Dallas, Texas
Many of the designations used by manufacturers and sellers to distinguish their prod-
ucts are claimed as trademarks. Where those designations appear in this book, and The
Pragmatic Programmers, LLC was aware of a trademark claim, the designations have
been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The
Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g
device are trademarks of The Pragmatic Programmers, LLC.

Every precaution was taken in the preparation of this book. However, the publisher
assumes no responsibility for errors or omissions, or for damages that may result from
the use of information (including program listings) contained herein.

Our Pragmatic courses, workshops, and other products can help you and your team
create better software and have more fun. For more information, as well as the latest
Pragmatic titles, please visit us at

http://www.pragprog.com

Copyright © 2008 Venkat Subramaniam.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmit-


ted, in any form, or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of the publisher.

Printed in the United States of America.

ISBN-10: 1-934356-09-3
ISBN-13: 978-1-934356-09-8
Printed on acid-free paper with 50% recycled, 15% post-consumer content.

      
 
   –
 

“As moves the world, to move in tune with


changing times and ways is wisdom”
— Thiruvalluvar, Poet and Philosopher, 31 B.C.
(Verse 426 from Thirukural, a collection of 1330 noble couplets)
Contents
Foreword 14

1 Introduction 16
1.1 Why Dynamic Languages? . . . . . . . . . . . . . . . . . 16
1.2 What’s Groovy? . . . . . . . . . . . . . . . . . . . . . . . 19
1.3 Why Groovy? . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.4 What’s in This Book? . . . . . . . . . . . . . . . . . . . . 23
1.5 Who Is This Book For? . . . . . . . . . . . . . . . . . . . 26
1.6 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 26

I Beginning Groovy 29

2 Getting Started 30
2.1 Getting Groovy . . . . . . . . . . . . . . . . . . . . . . . . 30
2.2 Installing Groovy . . . . . . . . . . . . . . . . . . . . . . 31
2.3 Test-Drive Using groovysh . . . . . . . . . . . . . . . . . 32
2.4 Using groovyConsole . . . . . . . . . . . . . . . . . . . . 33
2.5 Running Groovy on the Command Line . . . . . . . . . 34
2.6 Using an IDE . . . . . . . . . . . . . . . . . . . . . . . . . 35

3 Groovy for the Java Eyes 37


3.1 From Java to Groovy . . . . . . . . . . . . . . . . . . . . 37
3.2 JavaBeans . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.3 Optional Parameters . . . . . . . . . . . . . . . . . . . . 50
3.4 Implementing Interfaces . . . . . . . . . . . . . . . . . . 51
3.5 Groovy boolean Evaluation . . . . . . . . . . . . . . . . 55
3.6 Operator Overloading . . . . . . . . . . . . . . . . . . . . 56
3.7 Support of Java 5 Language Features . . . . . . . . . . 59
3.8 Gotchas . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
CONTENTS 10

4 Dynamic Typing 75
4.1 Typing in Java . . . . . . . . . . . . . . . . . . . . . . . . 75
4.2 Dynamic Typing . . . . . . . . . . . . . . . . . . . . . . . 78
4.3 Dynamic Typing != Weak Typing . . . . . . . . . . . . . 79
4.4 Design by Capability . . . . . . . . . . . . . . . . . . . . 80
4.5 Optional Typing . . . . . . . . . . . . . . . . . . . . . . . 86
4.6 Types in Groovy . . . . . . . . . . . . . . . . . . . . . . . 86
4.7 Multimethods . . . . . . . . . . . . . . . . . . . . . . . . 87
4.8 Dynamic: To Be or Not to Be? . . . . . . . . . . . . . . . 91

5 Using Closures 92
5.1 Closures . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.2 Use of Closures . . . . . . . . . . . . . . . . . . . . . . . 96
5.3 Working with Closures . . . . . . . . . . . . . . . . . . . 98
5.4 Closure and Resource Cleanup . . . . . . . . . . . . . . 98
5.5 Closures and Coroutines . . . . . . . . . . . . . . . . . . 101
5.6 Curried Closure . . . . . . . . . . . . . . . . . . . . . . . 102
5.7 Dynamic Closures . . . . . . . . . . . . . . . . . . . . . . 105
5.8 Closure Delegation . . . . . . . . . . . . . . . . . . . . . 107
5.9 Using Closures . . . . . . . . . . . . . . . . . . . . . . . 110

6 Working with Strings 111


6.1 Literals and Expressions . . . . . . . . . . . . . . . . . . 111
6.2 GString Lazy Evaluation Problem . . . . . . . . . . . . . 114
6.3 Multiline String . . . . . . . . . . . . . . . . . . . . . . . 118
6.4 String Convenience Methods . . . . . . . . . . . . . . . 120
6.5 Regular Expressions . . . . . . . . . . . . . . . . . . . . 121

7 Working with Collections 124


7.1 Using List . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
7.2 Iterating Over an ArrayList . . . . . . . . . . . . . . . . . 126
7.3 Finder Methods . . . . . . . . . . . . . . . . . . . . . . . 129
7.4 Collections’ Convenience Methods . . . . . . . . . . . . 130
7.5 Using Map . . . . . . . . . . . . . . . . . . . . . . . . . . 133
7.6 Iterating Over Map . . . . . . . . . . . . . . . . . . . . . 135
7.7 Map Convenience Methods . . . . . . . . . . . . . . . . . 137
CONTENTS 11

II Using Groovy 140

8 Exploring the GDK 141


8.1 Object Extensions . . . . . . . . . . . . . . . . . . . . . . 141
8.2 Other Extensions . . . . . . . . . . . . . . . . . . . . . . 147

9 Working with XML 155


9.1 Parsing XML . . . . . . . . . . . . . . . . . . . . . . . . . 155
9.2 Creating XML . . . . . . . . . . . . . . . . . . . . . . . . 160

10 Working with Databases 164


10.1 Connecting to a Database . . . . . . . . . . . . . . . . . 165
10.2 Database Select . . . . . . . . . . . . . . . . . . . . . . . 166
10.3 Transforming Data to XML . . . . . . . . . . . . . . . . . 167
10.4 Using DataSet . . . . . . . . . . . . . . . . . . . . . . . . 168
10.5 Inserting and Updating . . . . . . . . . . . . . . . . . . . 169
10.6 Accessing Microsoft Excel . . . . . . . . . . . . . . . . . 169

11 Working with Scripts and Classes 172


11.1 The Melting Pot of Java and Groovy . . . . . . . . . . . 172
11.2 Running Groovy . . . . . . . . . . . . . . . . . . . . . . . 173
11.3 Using Groovy Classes from Groovy . . . . . . . . . . . . 174
11.4 Using Groovy Classes from Java . . . . . . . . . . . . . 175
11.5 Using Java Classes from Groovy . . . . . . . . . . . . . 176
11.6 Using Groovy Scripts from Groovy . . . . . . . . . . . . 178
11.7 Using Groovy Scripts from Java . . . . . . . . . . . . . . 180
11.8 Ease of Integration . . . . . . . . . . . . . . . . . . . . . 182

III MOPping Groovy 183

12 Exploring Meta-Object Protocol (MOP) 184


12.1 Groovy Object . . . . . . . . . . . . . . . . . . . . . . . . 185
12.2 Querying Methods and Properties . . . . . . . . . . . . 190
12.3 Dynamically Accessing Objects . . . . . . . . . . . . . . 192

13 Intercepting Methods Using MOP 194


13.1 Intercepting Methods Using GroovyInterceptable . . . . 194
13.2 Intercepting Methods Using MetaClass . . . . . . . . . 197
CONTENTS 12

14 MOP Method Injection and Synthesis 202


14.1 Injecting Methods Using Categories . . . . . . . . . . . 203
14.2 Injecting Methods Using ExpandoMetaClass . . . . . . 208
14.3 Injecting Methods into Specific Instances . . . . . . . . 212
14.4 Method Synthesis Using methodMissing . . . . . . . . . 214
14.5 Method Synthesis Using ExpandoMetaClass . . . . . . 219
14.6 Synthesizing Methods for Specific Instances . . . . . . 222

15 MOPping Up 224
15.1 Creating Dynamic Classes with Expando . . . . . . . . 224
15.2 Method Delegation: Putting It All Together . . . . . . . 227
15.3 Review of MOP Techniques . . . . . . . . . . . . . . . . . 231

16 Unit Testing and Mocking 234


16.1 Code in This Book and Automated Unit Tests . . . . . . 234
16.2 Unit Testing Java and Groovy Code . . . . . . . . . . . 236
16.3 Testing for Exceptions . . . . . . . . . . . . . . . . . . . 240
16.4 Mocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
16.5 Mocking by Overriding . . . . . . . . . . . . . . . . . . . 244
16.6 Mocking Using Categories . . . . . . . . . . . . . . . . . 248
16.7 Mocking Using ExpandoMetaClass . . . . . . . . . . . . 249
16.8 Mocking Using Expando . . . . . . . . . . . . . . . . . . 251
16.9 Mocking Using Map . . . . . . . . . . . . . . . . . . . . . 253
16.10 Mocking Using the Groovy Mock Library . . . . . . . . . 254

17 Groovy Builders 260


17.1 Building XML . . . . . . . . . . . . . . . . . . . . . . . . 260
17.2 Building Swing . . . . . . . . . . . . . . . . . . . . . . . . 264
17.3 Custom Builder Using Metaprogramming . . . . . . . . 265
17.4 Using BuilderSupport . . . . . . . . . . . . . . . . . . . . 268
17.5 Using FactoryBuilderSupport . . . . . . . . . . . . . . . 272

18 Creating DSLs in Groovy 277


18.1 Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
18.2 Fluency . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
18.3 Types of DSLs . . . . . . . . . . . . . . . . . . . . . . . . 280
18.4 Designing Internal DSLs . . . . . . . . . . . . . . . . . . 281
18.5 Groovy and DSLs . . . . . . . . . . . . . . . . . . . . . . 281
18.6 Closures and DSLs . . . . . . . . . . . . . . . . . . . . . 282
18.7 Method Interception and DSLs . . . . . . . . . . . . . . 283
18.8 The Parentheses Limitation and a Workaround . . . . . 285
18.9 Categories and DSLs . . . . . . . . . . . . . . . . . . . . 286
18.10 ExpandoMetaClass and DSLs . . . . . . . . . . . . . . . 289
CONTENTS 13

A Web Resources 291

B Bibliography 296

Index 298
Foreword
Back in 2003, when we started Groovy, our goal was to provide Java
developers with an additional language to complement Java, a new
Swiss Army knife to add to their tool belt. Java is a great language and
a wonderful platform, but sometimes you need the agility and expres-
siveness of scripting languages or, even better, dynamic languages. We
didn’t want a new language that would be a paradigm shift for Java
developers. Instead, Groovy was made to seamlessly integrate with Java
in all possible ways while at the same time adding all the goodies
you would expect from a dynamic language. The best of both worlds!
You don’t even have to wait for Java 7, 8, or 9 to get all the nuggets
you’d want to have in your next programming language of choice: clo-
sures, properties, native syntax for lists, maps, and regular expres-
sions. Everything is already there.
Over the course of time, Groovy has matured a lot and has become a
very successful open source dynamic language used by tons of Java
developers and by big companies that embed it in their applications
servers or their mission-critical applications. Groovy lets you write more
expressive unit tests and simplifies XML parsing or SQL data imports,
and for your mundane tasks, there’s a scripting solution perfectly inte-
grated with your Java ecosystem. When you need to extend your appli-
cation to customize it to your needs, you can also integrate Groovy
at specific points by injecting Groovy scripts. Thanks to Groovy’s mal-
leable syntax, you can even create domain-specific languages fairly eas-
ily to represent business rules that even end users can author.
Now, step back a little. At first sight, despite the marketing taint of
the previous paragraphs, it sounds great, and you probably see a few
places where you’d definitely need to use such a versatile tool. But it’s
just something else you have to learn to be able to leverage it to its
fullest extent, right? You’re a Java developer, so do you fear it’s going
to be difficult to get the best out of it without wasting too much of your
time and energy?
F OREWORD 15

Fortunately, this book is right for you. Venkat will guide you through
Groovy and its marvels. Without being a boring encyclopedia, this book
covers a lot of ground. And in a matter of hours (well, in fact, just the
time to read the book), you’ll be up to speed, and you’ll see how Groovy
was made by Java developers for Java developers. You won’t regret your
journey, and you’ll be able to keep this book on your desk for reference
or for finding new creative ways to solve the problem of the day.

Guillaume Laforge (Groovy project manager)


February 5, 2008
Chapter 1

Introduction
As a busy Java developer, you’re constantly looking for ways to be more
productive, right? You’re probably willing to take all the help you can
get from the platform and tools available to you. When I wax poetic
about the “strength of Java,” I’m not talking about the language or its
syntax. It’s the Java platform that has become more capable and more
performant. To reap the benefit of the platform and to tackle the inher-
ent complexities of your applications, you need another tool—one with a
dynamic and metaprogramming capabilities. Java—the language—has
been flirting with that idea for a while and will support these features
to various degrees in future versions. However, you don’t have to wait
for that day. You can build performant Java applications with all the
dynamic capabilities today, right now, using Groovy.

1.1 Why Dynamic Languages?


Dynamic languages have the ability to extend a program at runtime,
including changing the structure of objects, types, and behavior. Dy-
namic languages allow you to do things at runtime that static languages
do at compile time; they allow you to execute program statements that
were created on the fly at runtime.
For example, if you want to get the date five days from now, you can
write this:
5.days.from.now

Yes, that’s your friendly java.lang.Integer chirping dynamic behavior in


Groovy, as you’ll learn later in this book.
W HY D YNAMIC L ANGUAGES ? 17

The flexibility offered by dynamic languages gives you the advantage


of evolving your application as it executes. You are probably familiar
with code generation and code generation tools. I consider code gener-
ation to be soooo 20th century. In fact, generated code is like an inces-
sant itch on your back; if you keep scratching it, it turns into a sore.
With dynamic languages, there are better ways. I prefer code synthe-
sis, which is in-memory code creation at runtime. Dynamic languages
make it easy to “synthesize code.” The code is synthesized based on the
flow of logic through your application and becomes active “just in time.”
By carefully applying these capabilities of dynamic languages, you can
be more productive as an application developer. This higher productiv-
ity means you can easily create higher levels of abstractions in shorter
amounts of time. You can also use a smaller, yet more capable, set
of developers to create applications. In addition, greater productivity
means you can create parts of your application quickly and get feed-
back from your fellow developers, testers, domain experts, and cus-
tomer representatives. And all this leads to greater agility.1
Dynamic languages have been around for a long time, so you may be
asking, why is now a great time to get excited about them? I can answer
that with four reasons:2
• Machine speed
• Availability
• Awareness of unit testing
• Killer applications
Let’s discuss each of these reasons for getting excited about dynamic
languages, starting with machine speed. Doing at runtime what other
languages do at compile time first raises the concern of the speed of
dynamic languages. Furthermore, interpreting code at runtime rather
than simply executing compiled code adds to that concern. Fortunately,
machine speed has consistently increased over the years—handhelds
have more computing and memory power today than what large com-
puters had decades ago. Tasks that were quite unimaginable using a

1. Tim O’Reilly observes the following about developing web applications: “Rather than
being finished paintings, they are sketches, continually being redrawn in response to
new data.” He also makes the point that dynamic languages are better suited for these in
“Why Scripting Languages Matter” (see Appendix A, on page 291).
2. A fifth reason is the ability to run dynamic languages on the JVM, but that came
much later.
W HY D YNAMIC L ANGUAGES ? 18

1980s processor are easy to achieve today. The performance concerns


of dynamic languages are greatly eased because of processor speeds
and other improvements in our field, including better just-in-time com-
pilation techniques.
Now let’s talk about availability. The Internet and active “public” com-
munity-based development have made recent dynamic languages eas-
ily accessible and available. Developers can now easily download lan-
guages and tools and play with them. They can even participate in
community forums to influence the evolution of these languages.3 This
is leading to greater experimentation, learning, and adaptation of lan-
guages than in the past.
Now it’s time to talk about the awareness of unit testing. Most dynamic
languages are dynamically typed. The types are often inferred based
on the context. There are no compilers to flag type-casting violations
at compile time. Since quite a bit of code may be synthesized and your
program can be extended at runtime, you can’t simply rely upon coding-
time verification alone. Writing code in dynamic languages requires a
greater discipline from the testing point of view. Over the past few years,
we’ve seen greater awareness among programmers (though not suffi-
ciently greater adoption yet) in the area of testing in general and unit
testing in particular. Most of the programmers who have taken advan-
tage of these dynamic languages for commercial application develop-
ment have also embraced testing and unit testing.4
Finally, let’s discuss the fourth bullet point listed earlier. Many devel-
opers have in fact been using dynamic languages for decades. How-
ever, for the majority of the industry to be excited about them, we
had to have killer applications—those compelling stories to share with
your developers and managers. That tipping point, for Ruby in partic-
ular and for dynamic languages in general, came in the form of Rails
([TH05], [SH07], [Tat06]). Rails showed struggling web developers how
they could quickly develop applications using the dynamic capabilities
of Ruby. Along the same vein came Grails built using Groovy and Java,
Django built using Python, and Lift built using Scala, to mention a few.

3. The Groovy users mailing list is very active, with constant discussions from passion-
ate users expressing opinions, ideas, and criticisms on current and future features. Visit
http://groovy.codehaus.org/Mailing+Lists and http://groovy.markmail.org if you don’t believe me.
4. “Legacy code is simply code without tests.” —Michael C. Feathers [Fea04]
W HAT ’ S G ROOVY ? 19

These frameworks have caused enough stir in the development commu-


nity to make the industry-wide adoption of dynamic languages a highly
probable event in the near future.
I find that dynamic languages, along with metaprogramming capabil-
ities, make simple things simpler and harder things manageable. You
still have to deal with the inherent complexity of your application, but
dynamic languages let you focus your effort where it’s deserved. When I
got into Java (after years of C++), features such as reflection, a good set
of libraries, and evolving framework support made me productive. The
JVM, to a certain extent, provided me with the ability to take advan-
tage of metaprogramming. However, I had to use something in addition
to Java to tap into that potential—heavyweight tools such as AspectJ.
Like several other productive programmers, I found myself left with two
options. The first option was to use the exceedingly complex and not-
so-flexible Java along with heavyweight tools. The second option was
to move on to using dynamic languages such as Ruby that are object-
oriented and have metaprogramming capability built in (for instance, it
takes only a couple of lines of code to do AOP in Ruby and Groovy). A
few years ago, taking advantage of dynamic capabilities and metapro-
gramming and being productive at the same time meant leaving behind
the Java platform. (After all, you use these features to be productive
and can’t let them slow you down, right?) That is not the case any-
more. Languages such as Groovy and JRuby are dynamic and run on
the JVM. They allow you to take full advantage of both the rich Java
platform and dynamic language capabilities.

1.2 What’s Groovy?


Groovy5 is a lightweight, low-ceremony, dynamic, object-oriented lan-
guage that runs on the JVM. Groovy is open sourced under Apache
License, version 2.0. It derives strength from different languages such
as Smalltalk, Python, and Ruby while retaining a syntax familiar to
Java programmers. Groovy compiles into Java bytecode and extends
the Java API and libraries. It runs on Java 1.4 or newer. For deploy-
ment, all you need is a Groovy JAR in addition to your regular Java
stuff, and you’re all set.

5. Merriam-Webster defines Groovy as “marvelous, wonderful, excellent, hip, trendy.”


W HY G ROOVY ? 20

I like to define Groovy as “a language that has been reborn several


times.”6 James Strachan and Bob McWhirter started it in 2003, and it
was commissioned into Java Specification Request (JSR 241) in March
2004. Soon after, it was almost abandoned because of various difficul-
ties and issues. Guillaume Laforge and Jeremy Rayner decided to rekin-
dle the efforts and bring Groovy back to life. Their first effort was to fix
bugs and stabilize the language features. The uncertainty lingered on
for a while. I know a number of people (committers and users) who sim-
ply gave up on the language at one time. Finally, a group of smart and
enthusiastic developers joined force with Guillaume and Jeremy, and a
vibrant developer community emerged. JSR version 1 was announced
in August 2005.
Groovy version 1.0 release was announced on January 2, 2007. It was
encouraging to see that, well before it reached 1.0, Groovy was put
to use on commercial projects in a handful of organizations in the
United States and Europe. In fact, I’ve seen growing interest in Groovy
in conferences and user groups around the world. Several organiza-
tions and developers are beginning to use Groovy at various levels on
their projects, and I think the time is ripe for major Groovy adoption in
the industry. Groovy version 1.5 was released on December 7, 2007.
Grails ([Roc06], [Rud07]),7 built using Groovy and Java, is a dynamic
web development framework based on “coding by convention.” It allows
you to quickly build web applications on the JVM using Groovy, Spring,
Hibernate, and other Java frameworks.

1.3 Why Groovy?


As a Java programmer, you don’t have to switch completely to a differ-
ent language. Trust me, Groovy feels like the Java language you already
know with but with a few augmentations.
There are dozens of scripting languages8 that can run on the JVM, such
as Groovy, JRuby, BeanShell, Scheme, Jaskell, Jython, JavaScript, etc.
The list could go on and on. Your language choice should depend on a
number of criteria: your needs, your preferences, your background, the
projects you work with, your corporate technical environment, and so

6. See “A bit of Groovy history,” a blog by Guillaume Laforge at http://glaforge.free.fr/


weblog/index.php?itemid=99.
7. See Jason Rudolph’s “Getting Started with Grails” in Appendix A, on page 291.
8. https://scripting.dev.java.net
W HY G ROOVY ? 21

on. In this section, I will discuss whether Groovy is the right language
for you.
As a programmer, I am shameless about languages. I can comfortably
program in about eight structured, object-oriented, and functional pro-
gramming languages and can come dangerously close to writing code
in a couple more. In any given year, I actively code in about two to three
languages at least. So, if one thing, I am pretty unbiased when it comes
to choosing a language—I will pick the one that works the best for a
given situation. I am ready to change to another language with the ease
of changing a shirt, if that is the right thing to do, that is.
Groovy is an attractive language for a number of reasons:
• It has a flat learning curve.
• It follows Java semantics.
• It bestows dynamic love.
• It extends the JDK.
I’ll now expand on these reasons. First, you can take almost any Java
code9 and run it as Groovy. The significant advantage of this is a flat
learning curve. You can start writing code in Groovy and, if you’re
stuck, simply switch gears and write the Java code you’re familiar with.
You can later refactor that code and make it groovier.
For example, Groovy understands the traditional for loop. So, you can
write this:
// Java Style
for(int i = 0; i < 10; i++)
{
//...
}

As you learn Groovy, you can change that to the following code or one
of the other flavors for looping in Groovy (don’t worry about the syntax
right now; after all, you’re just getting started, and very soon you’ll be
a pro at it):
10.times {
//...
}

9. See Section 3.8, Gotchas, on page 67 for known problem areas.


W HY G ROOVY ? 22

Second, when programming in Groovy, you can expect almost every-


thing you expect in Java. Groovy classes extend the same good old
java.lang.Object—Groovy classes are Java classes. The OO paradigm
and Java semantics are preserved, so when you write expressions and
statements in Groovy, you already know what those mean to you as a
Java programmer.
Here’s a little example to show you that Groovy classes are Java classes:
Download Introduction/UseGroovyClass.groovy

println XmlParser.class
println XmlParser.class.superclass

If you run groovy UseGroovyClass, you’ll get the following output:


class groovy.util.XmlParser
class java.lang.Object

Now let’s talk about the third reason to love Groovy. Groovy is dynamic,
and it is optionally typed. If you’ve enjoyed the benefits of other dynamic
languages such as Smalltalk, Python, JavaScript, and Ruby, you can
realize those in Groovy. If you had looked at Groovy 1.0 support for
metaprogramming, it probably left you desiring for more. Groovy has
come a long way since 1.0, and Groovy 1.5 has pretty decent metapro-
gramming capabilities.
For instance, if you want to add the method isPalindrome( ) to String—a
method that tells whether a word spells the same forward and back-
ward—you can add that easily with only a couple lines of code (again,
don’t try to figure out all the details of how this works right now; you
have the rest of the book for that):
Download Introduction/Palindrome.groovy

String.metaClass.isPalindrome = {->
delegate == delegate.reverse()
}

word = 'tattarrattat'
println "$word is a palindrome? ${word.isPalindrome()}"
word = 'Groovy'
println "$word is a palindrome? ${word.isPalindrome()}"

The following output shows how the previous code works:


tattarrattat is a palindrome? true
Groovy is a palindrome? false

Finally, as a Java programmer, you rely heavily on the JDK and the API
to get your work done. These are still available in Groovy. In addition,
W HAT ’ S IN T HIS B OOK ? 23

Groovy extends the JDK with convenience methods and closure support
through the GDK. Here’s a quick example of an extension in GDK to the
java.util.ArrayList class:
lst = ['Groovy' , 'is' , 'hip' ]
println lst.join(' ' )
println lst.getClass()

The output from the previous code confirms that you’re still working
with the JDK but that you used the Groovy-added join( ) method to con-
catenate the elements in the ArrayList:
Groovy is hip
class java.util.ArrayList

You can see how Groovy takes the Java you know and augments it.
If your project team is familiar with Java, if they’re using it for most
of your organization’s projects, and if you have a lot of Java code to
integrate and work with, then you will find that Groovy is a nice path
toward productivity gains.

1.4 What’s in This Book?


This book is about programming using the Groovy language. I make no
assumptions about your knowledge of Groovy or dynamic languages,
although I do assume you are familiar with Java and the JDK. Through-
out this book, I will walk you through the concepts of the Groovy lan-
guage, presenting you with enough details and a number of examples
to illustrate the concepts. My objective is for you to get proficient with
Groovy by the time you put this book down, after reading a substantial
portion of it, of course.
The rest of this book is organized as follows:
The book has has three parts: “Beginning Groovy,” “Using Groovy,” and
“MOPping Groovy.”
In the chapters in Part 1, “Beginning Groovy,” I focus on the whys and
whats of Groovy—those fundamentals that’ll help you get comfortable
with general programming in Groovy. Since I assume you’re familiar
with Java, I don’t spend any time with programming basics, like what
an if statement is or how to write it. Instead, I take you directly to the
similarities of Groovy and Java and topics that are specific to Groovy.
In the chapters in Part 2, “Using Groovy,” I focus on how to use Groovy
for everyday coding—working with XML, accessing databases, and
W HAT ’ S IN T HIS B OOK ? 24

working with multiple Java/Groovy classes and scripts—so you can put
Groovy to use right away for your day-to-day tasks. I also discuss the
Groovy extensions and additions to the JDK so you can take advantage
of both the power of Groovy and the JDK at the same time.
In the chapters in Part 3, “MOPping Groovy,” I focus on the metapro-
gramming capabilities of Groovy. You’ll see Groovy really shine in these
chapters and learn how to take advantage of its dynamic nature. You’ll
start with the fundamentals of MetaObject Protocol (MOP), learn how to
do aspect-oriented programming (AOP) such as operations in Groovy,
and learn about dynamic method/property discovery and dispatching.
Then you’ll apply those right away to creating and using builders and
domain-specific languages (DSLs). Unit testing is not only necessary in
Groovy because of its dynamic nature, but it is also easier to do—you
can use Groovy to unit test your Java and Groovy code, as you’ll see in
this part of the book.
Here’s what’s in each chapter:
Part 1: “Beginning Groovy”
In Chapter 2, Getting Started, on page 30, you’ll download and install
Groovy and take it for a test-drive right away using groovysh and groovy-
Console. You’ll also learn how to run Groovy without these tools—from
the command line and within your IDEs.
In Chapter 3, Groovy for the Java Eyes, on page 37, you’ll start with
familiar Java code and refactor that to Groovy. After a quick tour of
Groovy features that improve your everyday Java coding, you’ll learn
about Groovy’s support for Java 5 features. Groovy follows Java seman-
tics, except in places it does not—you’ll also learn gotchas that’ll help
avoid surprises.
In Chapter 4, Dynamic Typing, on page 75, you’ll see how Groovy’s
typing is similar and different from Java’s typing, what Groovy really
does with the type information you provide, and when to take advan-
tage of dynamic typing vs. optional typing. You’ll also learn how to take
advantage of Groovy’s dynamic typing, design by capability, and multi-
methods.
In Chapter 5, Using Closures, on page 92, you’ll learn all about the
exciting Groovy feature called closures, including what they are, how
they work, and when and how to use them.
W HAT ’ S IN T HIS B OOK ? 25

In Chapter 6, Working with Strings, on page 111, you’ll learn about


Groovy strings, working with multiline strings, and Groovy’s support
for regular expressions.
In Chapter 7, Working with Collections, on page 124, you’ll explore
Groovy’s support for Java collections—lists and maps. You’ll learn var-
ious convenience methods on collections, and after this chapter, you’ll
never again want to use your collections the old way.
Part 2: “Using Groovy”
Groovy embraces and extends the JDK. You’ll explore the GDK and
learn the extensions to Object and other Java classes in Chapter 8,
Exploring the GDK, on page 141.
Groovy has pretty good support for working with XML, including pars-
ing and creating XML documents, as you’ll see in Chapter 9, Working
with XML, on page 155.
Chapter 10, Working with Databases, on page 164 presents Groovy’s
SQL support, which will make your database-related programming easy
and fun. In this chapter, you’ll learn about iterators, datasets, and how
to perform regular database operations using simpler syntax and clo-
sures. I’ll also show how to get data from Microsoft Excel documents.
One of the key strengths of Groovy is the integration with Java. In
Chapter 11, Working with Scripts and Classes, on page 172, you’ll learn
ways to closely interact with multiple Groovy scripts, Groovy classes,
and Java classes from within your Groovy and Java code.
Part 3: “MOPping Groovy”
Metaprogramming is one of the biggest benefits of dynamic languages
and Groovy; it has the ability to inspect classes at runtime and dynam-
ically dispatch method calls. You’ll explore Groovy’s support for meta-
programming in Chapter 12, Exploring Meta-Object Protocol (MOP), on
page 184, beginning with the fundamentals of how Groovy handles
method calls to Groovy objects and Java objects.
Groovy allows you to perform AOP-like method interceptions using
GroovyInterceptable and ExpandoMetaClass, as you’ll see in Chapter 13,
Intercepting Methods Using MOP, on page 194.
In Chapter 14, MOP Method Injection and Synthesis, on page 202, you’ll
dive into Groovy metaprogramming capabilities that allow you to inject
and synthesize methods at runtime.
Random documents with unrelated
content Scribd suggests to you:
first in education, as she had been in war. Her example was
closely followed by the other States. In New York, in 1805,
many gentlemen of prominence associated for the purpose of
establishing a free school in New York City for the education
of the children of persons in indigent circumstances, and who
did not belong to, or were not provided for by, any religious
society. These public-spirited gentlemen presented a memorial
to the Legislature, setting forth the benefits that would
result to society from educating such children, and that it
would enable them more effectually to accomplish the objects
of their institution if the schools were incorporated. The
bill of incorporation was passed April 9, 1805. This was the
nucleus from which the present system of public schools
started into existence. Later on, in the year 1808, we find
from annual printed reports that two free schools were opened
and were in working order. ... It was the intention of the
founders of these schools--among whom the names of De Witt
Clinton, Ferdinand de Peyster, John Murray, and Leonard
Bleecker stand prominent as officers--to avoid the teachings
of any religious society; but there were among the people many
who thought that sufficient care was not being bestowed upon
religious instruction: to please these malcontents the
literary studies of the pupils were suspended one afternoon in
every week, and an association of fifty ladies of
'distinguished consideration ·in society' met on this day and
examined the children in their respective catechisms. ... To
read, write, and know arithmetic in its first branches
correctly, was the extent of the educational advantages which
the founders of the free-school system deemed necessary for
the accomplishment of their purposes."

A. H. Rhine, The Early Free Schools of


America. (Popular Science Monthly, March, 1880).

EDUCATION: A. D. 1785-1880.
The United States.-
Land-grants for Schools.
"The question of the endowment of educational institutions by
the Government in aid of the cause of education seems to have
met no serious opposition in the Congress of the
Confederation, and no member raised his voice against this
vital and essential provision relating to it in the ordinance
of May 20, 1785, 'for ascertaining the mode of disposing of
lands in the Western Territory.' This provided: 'There shall
be reserved the lot No. 16 of every township for the
maintenance of public schools within said township.' This was
an endowment of 640 acres of land (one section of land, one
mile square) in a township 6 miles square, for the support and
maintenance of public schools' within said township.' The
manner of establishment of public schools thereunder, or by
whom, was not mentioned. It was a reservation by the United
States, and advanced and established a principle which finally
dedicated one thirty-sixth part of all public lands of the
United States, with certain exceptions as to mineral, &c., to
the cause of education by public schools. ... In the
Continental Congress, July 13, 1787, according to order, the
ordinance for the government of the 'Territory of the United
States northwest of the river Ohio' came on, was read a third
time, and passed [see NORTHWEST TERRITORY: A. D.1787]. It
contained the following: 'Art. 3. Religion, morality, and
knowledge being necessary to good government and the happiness
of mankind, schools and the means of education shall forever
be encouraged.' The provision of the ordinance of May 20,
1785, relating to the reservation of the sixteenth section in
every township of public land, was the inception of the
present rule of reservation of certain sections of land for
school purposes. The endowment was the subject of much
legislation in the years following. The question was raised
that there was no reason why the United States should not
organize, control, and manage these public schools so endowed.
The reservations of lands were made by surveyors and duly
returned. This policy at once met with enthusiastic approval
from the public, and was tacitly incorporated into the
American system as one of its fundamental organic ideas.
Whether the public schools thus endowed by the United States
were to be under national or State control remained a
question, and the lands were held in reservation merely until
after the admission of the State of Ohio in 1802. ... To each
organized Territory, after 1803, was and now is reserved the
sixteenth section (until after the Oregon Territory act
reserved the thirty-sixth as well) for school purposes, which
reservation is carried into grant and confirmation by the
terms of the act of admission of the Territory or State into
the Union; the State then becoming a trustee for school
purposes. These grants of land were made from the public
domain, and to States only which were known as public-land
States. Twelve States, from March 3, 1803, known as
public-land States, received the allowance of the sixteenth
section to August 14, 1848. ... Congress, June 13, 1812, and
May 26, 1824, by the acts ordering the survey of certain towns
and villages in Missouri, reserved for the support of schools
in the towns and villages named, provided that the whole
amount reserved should not exceed one-twentieth part of the
whole lands included in the general survey of such town or
village. These lots were reserved and sold for the benefit of
the schools. Saint Louis received a large fund from this
source. ... In the act for the organization of the Territory
of Oregon, August 14, 1848, Senator Stephen A. Douglas
inserted an additional grant for school purposes of the
thirty-sixth section in each township, with indemnity for all
public-land States thereafter to be admitted, making the
reservation for school purposes the sixteenth and thirty-sixth
sections, or 1,280 acres in each township of six miles square
reserved in public-land States and Territories, and confirmed
by grant in terms in the act of admission of such State or
Territory into the Union. From March 13, 1853, to June 30,
1880, seven States have been admitted into the Union having a
grant of the sixteenth and thirty-sixth sections, and the
same area has been reserved in eight Territories."
T. Donaldson, The Public Domain, chapter 13.

{732}

EDUCATION: A. D. 1789.
The United States.

"The Constitution of the United States makes no provision for


the education of the people; and in the Convention that framed
it, I believe the subject was not even mentioned. A motion to
insert a clause providing for the establishment of a national
university was voted down. I believe it is also the fact, that
the Constitutions of only three of the thirteen original
States made the obligation to maintain a system of Free
Schools a part of their fundamental law."

H. Mann, Lectures and Annual Reports on


Education, lecture 5.

EDUCATION: A. D. 1793.-Massachusetts.
Williams College.

"Williams College, at Williamstown, Berkshire County, Mass.,


was chartered in 1793. The town and the college were named in
honor of Colonel Ephraim Williams, who had command of the forts
in the Hoosac Valley, and was killed in a battle with the
French and Indians, September 8, 1755. By his will he
established a free school in the township which was to bear
his name. The most advanced students of this free school
became the first college class, numbering 4, and received the
regular degree of bachelor of arts in the autumn of 1795. The
small amount left by the will of Colonel Williams was
carefully managed for 30 years by the executors, and they then
obtained permission from the State legislature to carry out
the benevolent purposes of the testator. The fund for building
was increased by individual subscriptions, and by the avails
of a lottery, which the general court granted for that
purpose. The building which is now known as West College was
then erected for the use of the free school and was finished
in 1790. ... The free school was opened in 1791, with Reverend
Ebenezer Fitch, a graduate of Yale College, as preceptor, and
Mr. John Lester as assistant. ... The success of the school
was so great that the next year the trustees asked the
legislature to incorporate the school into a college. This was
done, and a grant of $4,000 was made from the State treasury
for the purchase of books and philosophical apparatus. The
college was put under the care of 12 trustees, who elected
Preceptor Fitch the first president of the college."

E. B. Parsons (U. S. Bureau of Education,


Circular of Information, 1891, no. 6:
History of Higher Education in Massachusetts, chapter 9).

EDUCATION: A. D. 1795-1867.
The United States.
State School Funds.

"Connecticut took the lead in the creation of a permanent fund


for the support of schools. The district known as the Western
Reserve, in Northern Ohio, had been secured to her in the
adjustment of her claims to lands confirmed to her by the
charter of King Charles II. The Legislature of the State, in
1795, passed an act directing the sale of all the land
embraced in the Reserve, and setting apart the avails as a
perpetual fund for the maintenance of common schools. The
amount realized was about $1,120,000. ... New York was the
next State to establish a common school fund for the aid and
maintenance of schools in the several school districts of the
State. The other Northern States except New Hampshire,
Vermont, Pennsylvania, and one or two others, have established
similar funds. ... In all the new States, the 500,000 acres,
given by act of Congress, on their admission into the Union,
for the support of schools, have been sacredly set apart for
that purpose, and generally other lands belonging to the
States have been added to the fund. ... Prior to the war the
Slave States had made attempts to establish plans for popular
education, but with results of an unsatisfactory character. In
Virginia a school system was in force for the education of the
children of indigent white persons. In North Carolina a large
school fund, exceeding two millions of dollars, had been set
apart for the maintenance of schools. In all of these States
common schools had been introduced, but they did not flourish
as in the North and West. ... There was not the same
population of small and independent farmers, whose families
could be united into a school district. ... A more serious
obstacle was the slave population, constituting one-third of
the whole, and in some of the States more than half, whom it
was thought dangerous to educate."

V. M. Rice, Special Report on the Present State of


Education, 1867, pages 19-23.

EDUCATION: A. D. 1804-1837.
Michigan.
The University.

"In 1804, when Michigan was organized as a Territory, Congress


granted a township of land for a seminary of learning, and the
university to be established in 1817 was to be in accordance
with this grant. The Territorial government committed the
interests of higher education to the care of the Governor and
the Judges, and it is supposed that through the exertions of
Honorable A. B. Woodward, then presiding Judge of the Supreme Court
of the Territory of Michigan, that the act establishing a
university was framed. A portion of this most curious document
of the early History of Michigan will be given. It is entitled
'An act to establish the Catholepistemiad or University
Michigania.' 'Be it enacted by the Governor and Judges of the
Territory of Michigan, That there shall be in the said
Territory a catholepistemiad or university denominated the
Catholepistemiad or University Michigania. The
Catholepistemiad or University of Michigania shall be composed
of thirteen didaxum or professorships; first, a didaxia or
professorship catholepistemia, or universal science, the
dictator or professor of which shall be president of the
institution; second, a didaxia or professorship of
anthropoglassica, or literature embracing all of the
episternum or sciences relative to language; third, a didaxia
or professorship of mathematica or mathematics; fourth, a
didaxia or professorship of physiognostica or natural history,
etc.' The act thus continues through the whole range of the
'thirteen didaxum'; the remaining nine are as follows: Natural
philosophy, astronomy, chemistry, medical sciences, economical
sciences, ethical sciences, military sciences, historical
sciences, and intellectual. The university was to be under the
control of the professors and president, who were to be
appointed by the Governor, while the institution was to be the
center and controlling power of the educational system of the
State.
{733}
It was to be supported by taxation by an increase of the
amount of taxes already levied, by 15 per cent. Also power was
given to raise money for the support of the university by
means of lotteries. This remarkable document was not without
its influence in shaping the public school policy of Michigan,
but it was many years before the State approximated its
learned provisions. Impracticable as this educational plan
appears for a handful of people in the woods of Michigan, it
served as a foundation upon which to build. The officers and
president were duly appointed, and the work of the new
university began at once. At first the university appeared as
a school board, to establish and maintain primary schools
which they held under their charge. Then followed a course of
study for classical academies, and finally, in October, 1817,
an act was passed establishing a college in the city of
Detroit called 'The First College of Michigania.' ... The
people contributed liberally to these early schools, the sum
of three thousand dollars being subscribed at the beginning.
... An act was passed on the 30th of April, 1821, by the
Governor and Judges establishing a university in Detroit to
take the place of the catholepistemiad and to be called the
'University of Michigan.' In its charter nearly all the powers
of the former institution were substantially confirmed, except
the provision for taxes and lotteries. ... The second
corporation, known as the 'University of Michigan,' carried on
the work of education already begun from 1821 to the third
organization, in 1837. The education was very limited,
consisting in one classical academy at Detroit, and part of
the time a Lancasterian school. The boards of education kept
up and transmitted the university idea to such an extent that
it may be said truly and legally that there was one University
of Michigan, which passed through three successive stages of
development marked by the dates 1817, 1821, and 1837," at
which time it was removed to Ann Arbor.

F. W. Blackmar, Federal and State Aid to Higher


Education (U: S. Bureau of Education. Circular of
Information, 1890, no. 1), pages 239-241.

ALSO IN:
E. M. Farrand, History of the University of Michigan.

A. Ten Brook, American State Universities.

EDUCATION: A. D. 1818-1821.
Massachusetts.
Amherst College.

"Amherst College originated in a strong desire on the part of


the people of Massachusetts to have a college near the central
part of the State, where the students should be free from the
temptations of a large city, where the expenses of an
education should not be beyond the means of those who had but
little money, and where the moral and religious influences
should be of a decidedly Christian character. ... The
ministers of Franklin County, at a meeting held in Shelburne
May 18, 1815, expressed it as their opinion that a literary
institution of high order ought to be established in Hampshire
County, and that the town of Amherst appeared to them to be
the most eligible place for it. Their early efforts for a
literary institution in Hampshire County resulted in the first
place in the establishment of an academy in Amherst, which was
incorporated in the year 1816. ... In the year 1818 a
constitution was adopted by the trustees of Amherst Academy,
for the raising and management of a fund of at least $50,000,
for the classical education of indigent young men of piety and
talents for the Christian ministry. ... This charity fund may
be said to be the basis of Amherst College, for though it was
raised by the trustees of Amherst Academy it was really
intended to be the foundation of a college, and has always
been a part of the permanent funds of Amherst College, kept
sacredly from all other funds for the specific object for
which it was given. ... This was for many years the only
permanent fund of Amherst College, and without this it would
have seemed impossible at one time to preserve the very
existence of the college. So Amherst College grew out of
Amherst Academy, and was built permanently on the charity fund
raised by the trustees of that academy. ... Although the
charity fund of $50,000 had been received in 1818, it was not
till 1820 that the recipient felt justified in going forward
to erect buildings for a college in Amherst. Efforts were made
for the removal of Williams College from Williamstown to
Hampshire County, and to have the charity fund used in
connection with that college; and, if that were done, it was
not certain that Amherst could be regarded as the best
location for the college. But the legislature of Massachusetts
decided that Williams College could not be removed from
Williamstown, and nothing remained but for the friends of the
new institution to go on with their plans for locating it at
Amherst. ... This first college edifice was ready for
occupation and dedicated on the 18th of September, 1821. In
the month of May, 1821, Reverend Zephaniah Swift Moore, D. D., was
unanimously elected by the trustees of Amherst Academy
president of the new institution."

T. P. Field (U. S. Bureau of Education, Circular' of


Information, 1891, no. 6: History of Higher Education
in Massachusetts), chapter 11.

EDUCATION: A. D. 1837.
Massachusetts.
Horace Mann and the State System.

"When Massachusetts, in 1837, created a Board of Education,


then were first united into a somewhat related whole the more
or less excellent but varied and independent organizations,
and a beginning made for a State system. It was this massing
of forces, and the hearty co-operation he initiated, in which
the work of Horace Mann showed its matchless greatness.
'Rarely,' it has been said, 'have great ability, unselfish
devotion, and brilliant success, been so united in the course
of a single life.' A successful lawyer, a member of the State
Legislature, and with but limited experience as a teacher, he
has left his impress upon the educational sentiments of, not
only New England, but the United States."

R. G. Boone, Education in the U. S., page 103.

EDUCATION: A. D. 1840-1886.
The United States.
Proportion of College Students.

"It is estimated that in 1840 the proportion of college


students to the entire population in the United States was 1
to 1,540; in 1860, 1 to 2,012; in 1870,1 to 2,546; in 1880, 1
to 1,840; and in 1886, 1 to about 1,400, Estimating all our
combined efforts in favor of higher education, we fall far
short of some of the countries of the Old World."
F. W. Blackmar, Federal and State Aid to Higher
Education in the U. S. (U. S. Bureau of Education,
Circulars of Information, 1890, no. 1), page 36.

{734}

EDUCATION: A. D. 1844-1876.
Canada.
Ontario School System.

"From the earliest settlement of Ontario, schools were


established as the wants of the inhabitants required. The
Legislature soon recognized the needs of the country, and made
grants of land and money in aid of elementary, secondary, and
superior education. Statutes were passed from time to time for
the purpose of opening schools to meet the demands of the
people. The sparsely settled condition of the Province delayed
for a while the organization of the system. It was not until
1844 that the elementary schools were put on a comprehensive
basis. In that year the Reverend Egerton Ryerson, LL. D., was
appointed Chief Superintendent of Education, and the report
which he presented to the House of Assembly sketched in an
able manner the main features of the system of which he was
the distinguished founder, and of which he continued for
thirty-three years to be the efficient administrator. In 1876
the office of chief superintendent was abolished, and the
schools of the Province placed under the control of a member
of the Government with the title of Minister of Education. ...
The system of education in Ontario may be said to combine the
best features of the systems of several countries. To the Old
World it is indebted for a large measure of its stability,
uniformity and centralization; to the older settled parts of
the New World for its popular nature, its flexibility and its
democratic principles which have given, wherever desirable,
local control and individual responsibility. From the State of
New York we have borrowed the machinery of our school; from
Massachusetts the principle of local taxation; from Ireland
our first series of text books; from Scotland the co-operation
of parents with the teacher, in upholding his authority; from
Germany the system of Normal Schools and the Kindergarten; and
from the United States generally the non-denominational
character of elementary, secondary, and university education.
Ontario may claim to have some features of her system that are
largely her own. Among them may be mentioned a division of
state and municipal authority on a judicious basis; clear
lines separating the function of the University from that of
the High Schools, and the function of the High Schools from
that of the Public or elementary schools; a uniform course of
study; all High and Public Schools in the hands of
professionally trained teachers; no person eligible to the
position of inspector who does not hold the highest grade of a
teacher's certificate, and who has not had years of experience
as a teacher; inspectors removable if inefficient, but not
subject to removal by popular vote; the examinations of
teachers under Provincial instead of local control; the
acceptance of a common matriculation examination for admission
to the Universities and to the learned professions; a uniform
series of text books for the whole Province; the almost entire
absence of party politics in the manner in which school
boards, inspectors and teachers discharge their duties; the
system national instead of sectarian, but affording under
constitutional guarantees and limitations protection to Roman
Catholic and Protestant Separate Schools and denominational
Universities."

J. Millar, Educational System of the Province of Ontario.

EDUCATION: A. D. 1862.
The United States.
Land-grant for industrial Colleges.

"Next to the Ordinance of 1787, the Congressional grant of


1862 is the most important educational enactment in America.
... By this gift forty-eight colleges and universities have
received aid, at least to the extent of the Congressional
grant; thirty-three of these, at least, have been called into
existence by means of this act. In thirteen States the
proceeds of the land scrip were devoted to institutions
already in existence. The amount received from the sales of
land scrip from twenty-four of these States aggregates the sum
of $13,930,456, with land remaining unsold estimated at nearly
two millions of dollars. These same institutions have received
State endowments amounting to over eight million dollars. The
origin of this gift must be sought in local communities. In
this country all ideas of national education have arisen from
those States that have felt the need of local institutions for
the education of youth. In certain sections of the Union,
particularly the North and West, where agriculture was one of
the chief industries, it was felt that the old classical
schools were not broad enough to cover all the wants of
education represented by growing industries. There was
consequently a revulsion from these schools toward the
industrial and practical side of education. Evidences of this
movement are seen in the attempts in different States to found
agricultural, technical, and industrial schools. These ideas
found their way into Congress, and a bill was introduced in
1858, which provided for the endowment of colleges for the
teaching of agriculture and the mechanical arts. The bill was
introduced by Honorable Justin S. Morrill, of Vermont; it was
passed by a small majority, and was vetoed by President
Buchanan. In 1862 the bill was again presented with slight
changes, passed and signed, and became a law July 2, 1862. ...
It stipulated to grant to each State thirty thousand acres of
land for each Senator and Representative in Congress to which
the States were respectively entitled by the census of 1860,
for the purpose of endowing 'at least one college where the
leading object shall be, without excluding other scientific
and classical studies, and including military tactics, to
teach such branches of learning as are related to agriculture
and the mechanic arts, in such manner as the Legislatures of
the States may respectively prescribe, in order to promote the
liberal and practical education of the industrial classes in
the several pursuits and professions of life.' ... From this
proposition all sorts of schools sprang up, according to the
local conception of the law and local demands. It was thought
by some that boys were to be taught agriculture by working on
a farm, and purely agricultural schools were founded with the
mechanical arts attached. In other States classical schools of
the stereotyped order were established, with more or less
science; and, again, the endowment in others was devoted to
scientific departments. The instruction of the farm and the
teaching of pure agriculture have not succeeded in general,
while the schools that have made prominent those studies
relating to agriculture and the mechanic arts, upon the whole,
have succeeded best. ... In several instances the managers of
the land scrip have understood that by this provision the
State could not locate the land within the borders of another
State, but its assignees could thus locate lands, not more
than one million acres in any one State. By considering this
question, the New York land scrip was bought by Ezra Cornell,
and located by him for the college in valuable lands in the
State of Wisconsin, and thus the fund was augmented. However,
the majority of the States sold their land at a sacrifice,
frequently for less than half its value. There was a lull in
the land market during the Civil War, and this cause, together
with the lack of attention in many States, sacrificed the gift
of the Federal Government. The sales ranged all the way from
fifty cents to seven dollars per acre, as the average price
for each State."

F. W. Blackmar, Federal and State Aid to Higher


Education (U. S. Bureau of Education,
Circulars of Information, 1890, no. 1), pages 47-49.

{735}

EDUCATION: A. D. 1862-1886.
New York.
Cornell University.

"On the second of July, 1862, ... [President Lincoln] signed


the act of congress, donating public lands for the
establishment of colleges of agriculture and mechanic arts.
This act had been introduced into congress by the Honorable Justin
S. Morrill. ... The Morrill act provided for a donation of
public land to the several states, each state to receive
thirty thousand acres for each senator and representative it
sent to congress. States not containing within their own
borders public land subject to sale at private entry received
land scrip instead. But this land scrip the recipient states
were not allowed to locate within the limits of any other
state or of any territory of the United States. The act
laconically directed 'said scrip to be sold by said states.'
The proceeds of the sale, whether of land or scrip, in each
state were to form a perpetual fund. ... In the execution of
this trust the State of New York was hampered by great and
almost insuperable obstacles. For its distributive share it
received land scrip to the amount of nine hundred and ninety
thousand acres. The munificence of the endowment awakened the
cupidity of a multitude of clamorous and strangely unexpected
claimants. ... If the princely domain granted to the State of
New York by congress was not divided and frittered away, we
owe it in great measure to the foresight, the energy, and the
splendid courage of a few generous spirits in the legislature
of whom none commanded greater respect or exercised more
influence than Senator Andrew Dickson White, the gentleman who
afterwards became first president of Cornell University. ...
But the all-compelling force which prevented the dispersion
and dissipation of the bounty of congress was the generous
heart of Ezra Cornell. While rival institutions clamored for a
division of the 'spoils,' and political tricksters played
their base and desperate game, this man thought only of the
highest good of the State of New York, which he loved with the
ardor of a patriot and was yet to serve with the heroism of a
martyr. ... When the legislature of the State of New York was
called upon to make some disposition of the congressional
grant, Ezra Cornell sat in the senate. ... Of his minor
legislative achievements I shall not speak. One act, however,
has made his name as immortal as the state it glorified. By a
gift of half a million dollars (a vast sum in 1865, the last
year of the war!) he rescued for the higher education of New
York the undivided grant of congress; and with the united
endowments he induced the legislature to establish, not merely
a college of applied science but a great modern
university--'an institution,' according to his own admirable
definition, 'where any person can find instruction in any
study.' It was a high and daring aspiration to crown the
educational system of our imperial state with an organ of
universal knowledge, a nursery of every science and of all
scholarship, an instrument of liberal culture and of practical
utility to all classes of our people. This was, however, the
end; and to secure it Ezra Cornell added to his original gift
new donations of land, of buildings, and of money. ... But one
danger threatened this latest birth of time. The act of
congress donating land scrip required the states to sell it.
The markets were immediately glutted. Prices fell. New York
was selling at an average price of fifty cents an acre. Her
princely domain would bring at this rate less than half a
million dollars! Was the splendid donation to issue in such
disaster? If it could be held till the war was over, till
immigration opened up the Northwest, it would be worth five
times five hundred thousand dollars! So at least thought one
far-seeing man in the State of New York. And this man of
foresight had the heart to conceive, the wisdom to devise, and
the courage to execute--he alone in all the states--a plan for
saving to his state the future value of the lands donated by
congress. Ezra Cornell made that wonderful and dramatic
contract with the State of New York! He bound himself to
purchase at the rate of sixty cents per acre the entire right
of the commonwealth to the scrip, still unsold; and with the
scrip, thus purchased by him as an individual he agreed to
select and locate the lands it represented, to pay the taxes,
to guard against trespasses and defend from fires, to the end
that within twenty years when values had appreciated he might
sell the land and turn into the treasury of the State of New
York for the support of Cornell University the entire net
proceeds of the enterprise. Within a few years Ezra Cornell
had located over half a million acres of superior pine land in
the Northwestern states, principally in Wisconsin. Under bonds
to the State of New York to do the state's work he had spent
about $600,000 of his own cash to carry out the trust
committed to him by the state, when, alas, in the crisis of
1874, fortune and credit sank exhausted and death came to free
the martyr-patriot from his bonds. The seven years that
followed were the darkest in our history. ... Ezra Cornell was
our founder; Henry W. Sage followed him as wise masterbuilder.
The edifices, chairs and libraries which bear the name of
'Sage' witness to [his] later gifts: but though these now
aggregate the princely sum of $1,250,000, [his] management of
the university lands has been [his] greatest achievement. From
these lands, with which the generosity and foresight of Ezra
Cornell endowed the university, there have been netted under
[Mr. Sage's] administration, not far short of $4,000,000, with
over 100,000 acres still to sell. Ezra Cornell's contract with
the state was for twenty years. It expired August 4, 1886,
when a ten years' extension was granted by the state. The
trust will be closed in 1896."

J. G. Schurman, Address at Inauguration to the


Presidency of Cornell University, November 11, 1892.

EDUCATION: A. D. 1866-1869.
The United States.
Bureau of Education.

"Educators, political economists, and statesmen felt the need


of some central agency by which the general educational
statistics of the country could be collected, preserved,
condensed, and properly arranged for distribution. This need
found expression finally in the action taken at a convention
of the superintendence department of the National Educational
Association, held at Washington February, 1866, when it was
resolved to petition Congress in favor of a National Bureau of
Education. ...
{736}
The memorial was presented in the House of Representatives by
General Garfield, February 14, 1866, with a bill for the
establishment of a National Bureau on essentially the basis
the school superintendents had proposed. Both bill and
memorial were referred to a committee of seven members. ...
The bill was reported back from the committee, with an
amendment in the nature of a substitute, providing for the
creation of a department of education instead of the bureau
originally proposed. Thus altered, it was passed by a vote of
nearly two to one. In the Senate it was referred to the
Committee on the Judiciary ... who the following winter
reported it without amendment and with a recommendation that
it pass, which it did on the 1st of March, 1867, receiving on
the next day the approval of the President. By the act of July
28, 1868, which took effect June 30, 1869, the Department of
Education was abolished, and an Office of Education in the
Department of the Interior was established, with the same
objects and duties. ... The act of March 2, 1867, ...
established an agency 'for the purpose of collecting such
statistics and facts as shall show the condition and progress
of education in the several States and Territories, and of
diffusing such information respecting the organization and
management of school systems and methods of teaching as shall
aid the people of the United States in the establishment and
maintenance of efficient school systems and otherwise promote
the cause of education.' It will be perceived that the chief
duty of the office under the law is to act as an educational
exchange. Exercising and seeking to exercise no control
whatever over its thousands of correspondents, the office
occupies a position as the recipient of voluntary information
which is unique."
C. Warren, Answers to Inquiries about the
U. S. Bureau of Education, chapters 2-3.

EDUCATION: A. D. 1867.
New York.
Public Schools made entirely free.

The public schools of the State of New York were not entirely
free until 1867. In his report to the Legislature made in
February of that year, the State Superintendent of Public
Instruction, Honorable Victor M. Rice, said: "The greatest defect
in our school system is, as I have urged in previous reports,
the continuance of the rate bill system. Our common schools
can never reach their highest degree of usefulness until they
shall have been made entirely free. ... To meet this public
demand, to confer upon the children of the State the blessings
of free education, a bill has already been introduced into
your honorable body. ... The main features of the bill are the
provisions to raise, by State tax, a sum about equal to that
raised in the districts by rate bills, and to abolish the rate
bill system; to facilitate the erection and repair of school
houses." The bill referred to was passed at the same session
of the Legislature, and in his next succeeding report,
Superintendent Rice gave the following account of the law and
its immediate effects: "While the general structure of the
school law was not disturbed, a material modification was made
by the Act (chap. 406, Laws of 1867), which took effect on the
first day of October of the same year, and which, among other
things, provided for the abolishment of rate-bills, and for
increased local and State taxation for school purposes. This
was primarily a change in the manner of raising the requisite
funds; not an absolute increase of the aggregate amount to be
raised. It involved and encouraged such increase, so far as
the inhabitants in the several school districts should
authorize it, by substituting taxation exclusively on
property, for a mixed assessment which, in part, was a tax on
attendance. Thus relieved of an old impediment, and supplied
with additional power and larger resources, the cause of
public instruction, during the last fiscal year, has wrought
results unequaled in all the past. ... The effect of this
amendment has not been confined to the financial policy
thereby inaugurated. It is distinctly traceable in lengthened
terms of school, in a larger and more uniform attendance, and
in more liberal expenditures for school buildings and
appliances."

Superintendent of Public Instruction of the State


of New York, Annual Report, 1869, pages 5-6.

EDUCATION: A. D. 1867.
Maryland.
Johns Hopkins University.

"By the will of Johns Hopkins, a merchant of Baltimore, the


sum of $7,000,000 was devoted to the endowment of a university
[chartered in 1867] and a hospital, $3,500,000 being
appropriated to each. ... To the bequest no burdensome
conditions were attached. ... Just what this new university
was to be proved a very serious question to the trustees. The
conditions of Mr. Hopkins's bequest left the determination of
this matter open. ... A careful investigation led the trustees
to believe that there was a growing demand for opportunities
to study beyond the ordinary courses of a college or a
scientific school, particularly in those branches of learning
not included in the schools of law, medicine and theology.
Strong evidence of this demand was afforded by the increasing
attendance of American students upon the lectures of the
German universities, as well as by the number of students who
were enrolling themselves at Harvard and Yale for the
post-graduate courses. It was therefore determined that the
Johns Hopkins should be primarily a university, with advanced
courses of lectures and fully equipped laboratories; that the
courses should be voluntary, and the teaching not limited to
class instruction. The foundation is both old and new. In so
far as each feature is borrowed from some older university,
where it has been fairly tried and tested, it is old, but at
the same time this particular combination of separate features
has here been made for the first time. ... In the ordinary
college course, if a young man happens to be deficient in
mathematics, for example, he is either forced to lose any
advantage he may possess in Greek or Latin, or else is obliged
to take a position in mathematics for which he is unprepared.
In the college department of the Johns Hopkins, this
disadvantage does not exist; the classifying is specific for
each study. The student has also the privilege of pushing
forward in any one study as rapidly as he can with advantage;
or, on the other hand, in case of illness or of unavoidable
interruption, of prolonging the time devoted to the course, so
that no part of it shall be omitted. As the studies are
elective, it is possible to follow the usual college course if
one desires. Seven different courses of study are indicated,
any of which leads to the Baccalaureate degree, thus enabling
the student to direct and specialize his work. The same
standard of matriculation and the same severity of
examinations are maintained in all these courses.
{737}
A student has the privilege of extending his study beyond the
regular class work, and he will be credited with all such
private and outside study, if his examiners are satisfied of
his thoroughness and accuracy."

S. B. Herrick, The Johns Hopkins University


(Scribner's Monthly, December 1879).

EDUCATION: A. D. 1867-1891.
The United States.
The Peabody Education Fund.

"The letter announcing and creating the Peabody endowment was


dated February 7, 1867. In that letter, after referring to the
ravages of he late war, the founder of the Trust said: 'I feel
most deeply that it is the duty and privilege of the more
favoured and wealthy portions of our nation to assist those
who are less fortunate.' He then added: 'I give one million of
dollars for the encouragement and promotion of intellectual,
moral, and industrial education among the young of the more
destitute portions of the Southern and Southwestern States of
the Union.' On the day following, ten of the Trustees selected
by him held a preliminary meeting in Washington. Their first
business meeting was held in the city of New York, the 19th of
March following, at which a general plan was adopted and an
agent appointed. Mr. Peabody returned to his native country
again in 1869, and on the 1st day of July, at a special
meeting of the Trustees held at Newport, added a second
million to the cash capital of the fund. ... According to the
donor's directions, the principal must remain intact for
thirty years. The Trustees are not authorized to expend any
part of it, nor yet to add to it any part of the accruing
interest. The manner of using the interest, as well as the
final distribution of the principal, was left entirely to the
discretion of a self-perpetuating body of Trustees. Those
first appointed had, however, the rare advantage of full
consultation with the founder of the Trust while he still
lived, and their plans received his cordial and emphatic
approbation. ... The pressing need of the present seemed to be
in the department of primary education for the masses, and so
they determined to make appropriations only for the assistance
of public free schools. The money is not given as a charity to
the poor. It would be entirely inadequate to furnish any
effectual relief if distributed equally among all those who
need it, and would, moreover, if thus widely dissipated,
produce no permanent results. But the establishment of good
public schools provides for the education of all children,
whether rich or poor, and initiates a system which no State
has ever abandoned after a fair trial. So it seemed to the
donor as well as to his Trustees, that the greatest good of
the greatest number would be more effectually and more
certainly attained by this mode of distribution than by any
other. No effort is made to distribute according to
population. It was Mr. Peabody's wish that those States which
had suffered most from the ravages of war should be assisted
first."

American Educational Cyclopædia, 1875, pages 224-225.

The report made by the treasurer of the Fund in 1890, showed a


principal sum invested to the amount of $2,075,175.22,
yielding an income that year of $97,818. In the annual report
of the U. S. Commissioner of Education made February 1, 1891, he
says: "It would appear to the student of education in the
Southern States that the practical wisdom in the
administration of the Peabody Fund and the fruitful results
that have followed it could not be surpassed in the history of
endowments."

Proceedings of the Trustees of the Peabody


Education Fund, 1887-1892.

EDUCATION: A. D. 1884-1891.
California.
Leland Stanford Junior University.

"The founding at Palo Alto of 'a university for both sexes,


with the colleges, schools, seminaries of learning, mechanical
institutes, museums, galleries of art, and all other things
necessary and appropriate to a university of high degree,' was
determined upon by the Honorable Leland Stanford and Jane Lathrop
Stanford in 1884. In March of the year following the
Legislature of California passed an Act providing for the
administration of trust funds in connection with institutions
of learning. November 14, 1885, the Grant of Endowment was
publicly made, in accordance with this Act, and on the same
day the Board of Trustees held its first meeting in San
Francisco. The work of construction was at once begun, and the
cornerstone laid May 14, 1887. The University was formally
opened to students October 1, 1891. The idea of the
university, in the words of its founders, 'came directly and
largely from our son and only child, Leland, and in the belief
that had he been spared to advise as to the disposition of our
estate, he would have desired the devotion of a large portion
thereof to this purpose, we will that for all time to come the
institution hereby founded shall bear his name, and shall be
known as The Leland Stanford Junior University.' The object of
the University, as stated in its Charter, is 'to qualify
students for personal success and direct usefulness in life';
and its purposes, 'to promote the public welfare by exercising
an influence in behalf of humanity and civilization, teaching
the blessings of liberty regulated by law, and inculcating
love and reverence for the great principles of government as
derived from the inalienable rights of man to life, liberty,
and the pursuit of happiness.' The University is located on
the Palo Alto estate in the Santa Clara valley, thirty-three
miles southeast of San Francisco, on the Coast Division of the
Southern Pacific Railway. The estate consists of over eight
thousand acres, partly lowland and partly rising into the
foothills of the Santa Cruz range. On the grounds is the
residence of the Founders, and an extensive and beautiful
arboretum containing a very great variety of shrubs and trees.
The property conveyed to the University, in addition to the
Palo Alto estate, consists of the Vina estate, in Tehama
County, of fifty-five thousand acres, of which about four
thousand acres are planted in vines, and the Gridley estate,
in Butte County, of twenty-two thousand acres, devoted mainly
to the raising of wheat. ... The founders of the Leland
Stanford Junior University say: 'As a further assurance that
the endowment will be ample to establish and maintain a
university of the highest grade, we have, by last will and
testament, devised to you and your successors additional
property. We have done this as a security against the
uncertainty of life and in the hope that during our lives the
full endowment may go to you. The aggregate of the domain
thus dedicated to the founding of the University, is over
eighty-five thousand acres, or more than one hundred and
thirty-three square miles, among the best improved and most
valuable lands in the State."

Leland Stanford Junior University,


Circulars of Information, numbers 6 and 1-2.

{738}

EDUCATION: A. D. 1887-1889.
Massachusetts.
Clark University.

"Clark University was founded [at Worcester] by ... a native


of Worcester County, Massachusetts. It was 'not the outcome of
a freak of impulse, or of a sudden wave of generosity, or of
the natural desire to perpetuate in a worthy way one's
ancestral name. To comprehend the genesis of the enterprise we
must go back along the track of Mr. Clark's personal history
20 years at least. For as long ago as that, the idea came home
with force to his mind that all civilized communities are in
the hands of experts. ... Looking around at the facilities
obtainable in this country for the prosecution of original
research, he was struck with the meagerness and the
inadequacy. Colleges and professional schools we have in
abundance, but there appeared to be no one grand inclusive
institution, unsaddled by an academic department, where
students might pursue as far as possible their investigation
of any and every branch of science. ... Mr. Clark went abroad
and spent eight years visiting the institutions of learning in
almost every country of Europe. He studied into their history
and observed their present working.' ... It is his strong and
expressed desire that the highest possible academic standards
be here forever maintained; that special opportunities and
inducements be offered to research; that to this end the
instructors be not overburdened with teaching or examinations.
... A charter was granted early in 1887. Land and other
property that had been before secured by the founder was
transferred to the board, and the erection of a central
building was begun. In the spring of 1888 G. Stanley Hall,
then a professor at the Johns Hopkins University, was invited
to the presidency. ... The plans of the university had so far
progressed that work was begun in October, 1889, in
mathematics, physics, chemistry, biology, and psychology."

G. G. Bush, History of Higher Education in


Massachusetts (U. S. Bureau of Education,
Circular of Information, 1891, no. 6), chapter 18.

EDUCATION: A. D. 1889-1892.
Illinois.
Chicago University.

"At its Annual Meeting in May, 1889, the Board of the American
Baptist Education Society resolved to take immediate steps
toward the founding of a well-equipped college in the city of
Chicago. At the same time John D. Rockefeller made a
subscription of $600,000 and this sum was increased during the
succeeding year by about $600,000 more in subscriptions
representing more than two thousand persons. Three months
after the completion of this subscription, Mr. Rockefeller
made an additional proffer of $1,000,000. The site of the
University consists of three blocks of ground--about two
thousand feet long and three hundred and sixty-two feet wide,
lying between the two South Parks of Chicago, and fronting on
the Midway Plaisance, which is itself a park connecting the
other two. One-half of this site is a gift of Marshall Field
of Chicago, and the other half has been purchased at a cost of
$132,500. At the first meeting of the Board after it had
become an incorporated body, Professor William R. Harper, of
Yale University, was unanimously elected President of the
University. ... It has been decided that the University will
begin the work of instruction on the first day of October,
1892. ... The work of the University shall be arranged under
three general divisions, viz., The University Proper, The
University-Extension Work, The University Publication Work."

University of Chicago,
Official Bulletin no. 1, January, 1891.

EDUCATION: A. D. 1890.
United States.
Census Statistics.

The following statistics of education in the United States are


from the returns gathered for the Eleventh Census, 1890. In
these statistics the states and territories are classed in
five great geographical divisions, defined as follows: North
Atlantic Division, embracing the New England States, New York,
New Jersey, and Pennsylvania; South Atlantic Division,
embracing the States of the eastern coast, from Delaware to
Florida, together with the District of Columbia; North Central
Division, embracing Ohio, Indiana, Illinois, Michigan,
Wisconsin, Minnesota, Iowa, Missouri, North and South Dakota,
Nebraska, and Kansas; South Central Division, embracing
Kentucky, Tennessee, Alabama, Mississippi, Louisiana, Texas,
Arkansas, and Oklahoma; Western Division, embracing all the
remaining States and Territories. The total taxation for
public schools in the United States, as reported by this
census, was $102,164,796; of which $37,619,786 was raised in
the North Atlantic Division, $5,678,474 in the South Atlantic
Division, $47,033,142 in the North Central Division,
$5,698.562 in the South Central Division, and $6,134,832 in
the Western Division. From funds and rents there were raised
for school purposes a total of $25,694,449 in the United
States at large, of which $8,273,147 was raised in the North
Atlantic Division, $2,307,051 in the South Atlantic Division,
$8,432,593 in the North Central Division, $3,720,158 in the
South Central Division, and $2,961,500 in the Western
Division. The total of all "ordinary" receipts for school
support in the United States, was $139,619,440, of which
$49,201,216 were in the North Atlantic Division, $8,685,223 in
the South Atlantic Division. $61,108,263 in the North Central
Division, $10,294,621 in the South Central Division, and
$10,330,117 in the Western Division. The total "ordinary
expenditures" were $138,786,393 in the whole United States;
being $47,625,548 in the North Atlantic Division, $8,630,711
in the South Atlantic Division, $62,815.531 in the North
Central Division, $9,860,050 in the South Central Division,
and $9,854,544 in the Western Division. For teachers' wages
there was a total expenditure of $88,705,992, $28,067,821
being in the North Atlantic Division, $6,400,063 in the South
Atlantic Division, $39,866,831 in the North Central Division,
$8,209,509 in the South Central Division, and $6,161,768 in
the Western Division. The total expenditure for Libraries and
Apparatus was $1,667,787, three-fourths of which was in the
North Atlantic and North Central Divisions. The expenditure
reported for construction and care of buildings, was
$24,224,793, of which $10,687,114 was in the North Atlantic
Division, $884,277 was in the South Atlantic Division,
$9,869,489 in the North Central Division, $770,257 in the
South Central Division, and $2,013,656 in the Western
Division. Reported estimates of the value of buildings and
other school property are incomplete, but $27,892,831 are
given for Massachusetts, $41,626,735 for New York, $35,435,412
for Pennsylvania, $32,631,549 for Ohio, $26,814,480 for
Illinois, and these are the States that stand highest in the
column.
{739}
The apparent enrollment in Public Schools for the
census year, reported to July, 1891, was as follows:
North Atlantic Division, 3,124,417;
South Atlantic Division, 1,758,285;
North Central Division, 5,032,182;
South Central Division, 2,334,694;
Western Division, 520,286;
Total for the United States, 12,769,864
being 20.39 per cent. of the population, against 19.84 per
cent. in 1880. The reported enrollment in Private Schools at
the same time was:
North Atlantic Division, 196,173;
South Atlantic Division, 165,253;
North Central Division, 187,827;
South Central Division, 200,202;
Western Division, 54,749;
Total for the United States, 804,204.
The reported enrollment in Parochial Schools was:
North Atlantic Division, 311,684;
South Atlantic Division, 30,869;
North Central Division, 398,585;
South Central Division, 41,115;
Western Division, 17,349;
Total for the United States, 799,602.
Of this total, 626,496 were enrolled in Catholic and 151,651
in Lutheran Parochial Schools; leaving only 21,455 in the
schools of all other denominations. Total enrollment reported
in all schools 14,373,670. The colored public school
enrollment in the Southern States was 1,288,229 in 1890,
against 797,286 in 1880,--an increase of more than 61 per
cent. The enrollment of whites was 3,358,527, against
2,301,804,--an increase of nearly 46 per cent. The approximate
number of Public School-houses in the United States, for the
census year 1890 is given at 219,992, being 42,949 in the
North Atlantic Division, 32,142 in the South Atlantic
Division, 97,166 in the North Central Division, 38,962 in the
South Central Division, 8,773 in the Western Division. The
largest number reported is 14,214 in Pennsylvania. Of 6,408
school-houses in Virginia 4,568 are for white, and 1,840 for
colored children; in North Carolina, 3,973 white and 1,820
colored. The above statistics are taken in part from the
Compendium of the Eleventh Census, published in 1894, and
partly from tables courteously furnished from the Census
Bureau in advance of their publication.
EDUCATION: Modern: Reforms and Movements.

EDUCATION: A. D. 1638-1671.
Comenius.

"To know Comenius [born in Moravia, 1592] and the part he


played in the seventeenth century, to appreciate this grand
educational character, it would be necessary to begin by
relating his life; his misfortunes; his journeys to England
[1638], where Parliament invoked his aid; to Sweden [1642],
where the Chancellor Oxenstiern employed him to write manuals
of instruction; especially his relentless industry, his
courage through exile, and the long persecutions he suffered
as a member of the sect of dissenters, the Moravian Brethren;
and the schools he founded at Fulneck, in Bohemia, at Lissa
and at Patak, in Poland."

G. Compayré, The History of Pedagogy, chapter 6 (section 137).

"Comenius's inspiring motive, like that of all leading


educationalists, was social regeneration. He believed that
this could be accomplished through the school. He lived under
the hallucination that by a proper arrangement of the
subject-matter of instruction, and by a sound method, a
certain community of thought and interests would be
established among the young, which would result in social
harmony and political settlement. He believed that men could
be manufactured. ... The educational spirit of the Reformers,
the conviction that all--even the humblest--must be taught to
know God, and Jesus Christ whom he has sent, was inherited by
Comenius in its completeness. In this way, and in this way
only, could the ills of Europe be remedied, and the progress
of humanity assured. While, therefore, he sums up the
educational aim under the threefold heads of Knowledge,
Virtue, and Piety or Godliness, he in truth has mainly in view
the last two. Knowledge is of value only in so far as it forms
the only sound basis, in the eyes of a Protestant theologian,
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