ISBN-10:
1937785300
ISBN-13:
9781937785307
Pub. Date:
07/22/2013
Publisher:
Pragmatic Programmers, LLC, The
Programming Groovy 2: Dynamic Productivity for the Java Developer / Edition 1

Programming Groovy 2: Dynamic Productivity for the Java Developer / Edition 1

by Venkat Subramaniam
Current price is , Original price is $35.0. You

Temporarily Out of Stock Online

Please check back later for updated availability.

Product Details

ISBN-13: 9781937785307
Publisher: Pragmatic Programmers, LLC, The
Publication date: 07/22/2013
Edition description: Second Edition
Pages: 370
Product dimensions: 7.40(w) x 9.10(h) x 0.80(d)

About the Author

Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., and an adjunct faculty at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly invited speaker at several international conferences. He's (co)author of multiple books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer.

Table of Contents


Foreword     xvii
Introduction     1
Why Dynamic Languages?     1
What's Groovy?     4
Why Groovy?     5
What's in This Book?     8
Who Is This Book For?     11
Acknowledgments     11
Beginning Groovy     15
Getting Started     17
Getting Groovy     17
Installing Groovy     18
Test-Drive Using groovysh     19
Using groovyConsole     20
Running Groovy on the Command Line     21
Using an IDE     22
Groovy for the Java Eyes     25
From Java to Groovy     25
JavaBeans     33
Optional Parameters     38
Implementing Interfaces     39
Groovy boolean Evaluation     43
Operator Overloading     44
Support of Java 5 Language Features     47
Gotchas     55
Dynamic Typing     63
Typing in Java     63
Dynamic Typing     66
Dynamic Typing != Weak Typing     67
Design by Capability     68
Optional Typing     74
Types in Groovy     74
Multimethods     75
Dynamic: To Be or Not to Be?     79
Using Closures     81
Closures     81
Use of Closures     85
Working with Closures     87
Closure and Resource Cleanup     87
Closures and Coroutines     90
Curried Closure     91
Dynamic Closures     94
Closure Delegation     96
Using Closures     99
Working with Strings     101
Literals and Expressions     101
GString Lazy Evaluation Problem     104
Multiline String     108
String Convenience Methods     110
Regular Expressions     111
Working with Collections     115
Using List     115
Iterating Over an ArrayList     117
Finder Methods     120
Collections' Convenience Methods     121
Using Map     124
Iterating Over Map     126
Map Convenience Methods     128
Using Groovy     131
Exploring the GDK     133
Object Extensions     133
Other Extensions     139
Working with XML      147
Parsing XML     147
Creating XML     152
Working with Databases     157
Connecting to a Database     158
Database Select     159
Transforming Data to XML     160
Using DataSet     161
Inserting and Updating     162
Accessing Microsoft Excel     162
Working with Scripts and Classes     165
The Melting Pot of Java and Groovy     165
Running Groovy     166
Using Groovy Classes from Groovy     167
Using Groovy Classes from Java     168
Using Java Classes from Groovy     169
Using Groovy Scripts from Groovy     171
Using Groovy Scripts from Java     173
Ease of Integration     175
MOPping Groovy     177
Exploring Meta-Object Protocol (MOP)     179
Groovy Object     180
Querying Methods and Properties     185
Dynamically Accessing Objects     187
Intercepting Methods Using MOP     189
Intercepting Methods Using GroovyInterceptable     189
Intercepting Methods Using MetaClass     192
MOP Method Injection and Synthesis     197
Injecting Methods Using Categories     198
Injecting Methods Using ExpandoMetaClass     203
Injecting Methods into Specific Instances     207
Method Synthesis Using methodMissing     209
Method Synthesis Using ExpandoMetaClass     214
Synthesizing Methods for Specific Instances     217
MOPping Up     219
Creating Dynamic Classes with Expando     219
Method Delegation: Putting It All Together     222
Review of MOP Techniques     226
Unit Testing and Mocking     229
Code in This Book and Automated Unit Tests     229
Unit Testing Java and Groovy Code     231
Testing for Exceptions     235
Mocking     236
Mocking by Overriding     239
Mocking Using Categories     243
Mocking Using ExpandoMetaClass     244
Mocking Using Expando     246
Mocking Using Map     248
Mocking Using the Groovy Mock Library     249
Groovy Builders     255
Building XML     255
Building Swing     259
Custom Builder Using Metaprogramming     260
Using BuilderSupport     263
Using FactoryBuilderSupport      267
Creating DSLs in Groovy     273
Context     273
Fluency     275
Types of DSLs     276
Designing Internal DSLs     277
Groovy and DSLs     277
Closures and DSLs     278
Method Interception and DSLs     279
The Parentheses Limitation and a Workaround     281
Categories and DSLs     282
ExpandoMetaClass and DSLs     285
Web Resources     287
Bibliography     293
Index     295

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews