Scripting in Java: Languages, Frameworks, and Patterns
|
| List Price: | $54.99 |
| Price: | $37.11 & eligible for FREE Super Saver Shipping on orders over $25. Details |
Availability: Usually ships in 24 hours
Ships from and sold by Amazon.com
30 new or used available from $10.19
Average customer review:Product Description
Groovy and Beyond: Leverage the Full Power of Scripting on the JavaTM Platform!
Using the JavaTM platform’s new scripting support, you can improve efficiency, streamline your development processes, and solve problems ranging from prototyping to Web application programming. In Scripting in Java, Dejan Bosanac covers key aspects of scripting with Java, from the exciting new Groovy scripting language to Java’s new Scripting and Web Scripting APIs.
Bosanac begins by reviewing the role and value of scripting languages, and then systematically introduces today’s best scripting solutions for the Java platform. He introduces Java scripting frameworks, identifies proven patterns for integrating scripting into Java applications, and presents practical techniques for everything from unit testing to project builds. He supports key concepts with extensive code examples that demonstrate scripting at work in real-world Java projects. Coverage includes
· Why scripting languages offer surprising value to Java programmers
· Scripting languages that run inside the JVM: BeanShell, JavaScript, and Python
· Groovy in depth: installation, configuration, Java-like syntax, Java integration, security, and more
· Groovy extensions: accessing databases, working with XML, and building simple Web applications and Swing-based UIs
· Bean Scripting Framework: implementation, basic abstractions, and usage examples
· Traditional and new patterns for Java-based scripting
· JSR 223 Scripting API: language bindings, discovery mechanisms, threading, pluggable namespaces, and more
· JSR 223 Web Scripting Framework: scripting the generation of Web content within servlet containers
About the Web Site
All code examples are available for download at this book’s companion Web site.
Product Details
- Amazon Sales Rank: #435518 in Books
- Published on: 2007-08-19
- Original language: English
- Number of items: 1
- Binding: Paperback
- 552 pages
Editorial Reviews
About the Author
Dejan Bosanac is a professional software developer and technology consultant. He specializes in the integration and interoperability of diverse technologies, especially those related to Java and the Web. He has spent several years developing complex software projects, ranging from highly trafficked Web sites to enterprise applications, and was a member of the JSR 223 Expert Group.
Excerpt. © Reprinted by permission. All rights reserved.
Preface
Java is an excellent object-oriented programming language. It has provided many benefits to software developers, including a good object-oriented approach, implicit memory management, and dynamic linking, among others. These language characteristics are one of the main reasons for Java's popularity and wide acceptance.
But Java is much more than a programming language; it's a whole development platform. This means that it comes with a runtime environment (JRE), which provides the virtual machine, and the standardized application programming interfaces (APIs) that help developers accomplish most of their desired tasks. The main advantages of this integrated runtime environment are its true platform independence and simplification of software development.
On the other hand, scripting languages have played an important role in the information technology infrastructure for many years. They have been used for all kinds of tasks, ranging from job automation to prototyping and implementation of complex software projects.
Therefore, we can conclude that the Java development platform can also benefit from scripting concepts and languages. Java developers can use scripting languages in areas proven to be most suitable for this technology. This synergy of the Java platform and scripting languages, as we will see, adds an extra quality to the overall software development process.
In this book, I describe the concepts behind scripting languages, summarize solutions available to Java developers, and explore use cases and design patterns for applying scripting languages in Java applications.
How This Book Is Organized
This book consists of five logical parts.
Part I
The first part of the book comprises two chapters that describe scripting languages in general:
Chapter 1, "Introduction to Scripting"—Here I define the basic characteristics of scripting languages and compare them to system programming languages.
Chapter 2, "Appropriate Applications for Scripting Languages"—In this chapter, I explain the role of traditional (native) scripting languages in the overall information technology infrastructure. I also discuss tasks for which scripting languages have been used in various systems over time.
Part II
After discussing the basic concepts and uses of scripting languages, we are ready to focus on real technologies and solutions for the Java platform. This part of the book contains the following chapters:
Chapter 3, "Scripting Languages Inside the JVM"—I begin this chapter by covering the basic elements of the Java platform and explaining where scripting languages fit into it. After that, I describe the main features of three popular scripting languages available for the Java Virtual Machine (JVM)—BeanShell, JavaScript, and Python—and how they can be used to interact with Java applications. At the end of this chapter, I describe other solutions available for Java developers.
Chapter 4, "Groovy"—Here I discuss the Groovy scripting language in detail. I cover its Java-like syntax and all the scripting concepts built into this language, and I discuss Groovy's integration with Java, as well as some security-related issues.
Chapter 5, "Advanced Groovy Programming"—In this chapter, I cover some of the Groovy extensions that can aid in day-to-day programming tasks. I also explain how Java programmers can access databases, create and process XML documents, and easily create simple Web applications and swing user interfaces, using the scripting-specific features in Groovy covered in Chapter 4.
Chapter 6, "Bean Scripting Framework"—In this chapter, I describe the general Java scripting framework. In addition to explaining how to implement general support in your project for any compliant scripting language, I also discuss some basic abstractions implemented in the Bean Scripting Framework (BSF) and show some examples of successful uses.
Part III
This part of the book focuses primarily on the use of scripting languages in real Java projects:
Chapter 7, "Practical Scripting in Java"—Here I cover topics related to the use of scripting for everyday programming tasks, such as unit testing, interactive debugging, and project building, among others.
Chapter 8, "Scripting Patterns"—In this chapter, I discuss Java application design patterns that involve scripting languages. I show how you can use scripts to implement some parts of traditional design patterns and introduce some new design patterns specific only to the scripting environment. I also discuss the pros and cons of these design patterns, as well as their purpose.
Part IV
In the final part of this book, I cover the "Scripting for the Java Platform" specification, which was created according to the Java Specification Request (JSR) 223. Specifically, I cover two APIs defined by the specification:
Chapter 9, "Scripting API"—Here I cover the Scripting API, the standardized general scripting framework for the Java platform. The purpose of this framework is the same as that of the Bean Scripting Framework, but the Scripting API brings many new features that the modern scripting framework needs. The Scripting API is a standard part of the Java platform with the release of Mustang (Java SE 6).
Chapter 10, "Web Scripting Framework"—In this chapter, I discuss the Web Scripting Framework, a framework built on top of the Scripting API and created to enable scripting languages to generate Web content inside a servlet container. I explain how native scripting languages, such as PHP, can be synergized with the Java platform to bring more flexibility in Web application development.
Part V
At the end of the book, you can find a section comprising three appendixes. The main purpose of these appendixes is to provide the technical details about installation and use of certain technologies described in the book:
Appendix A, "Groovy Installation"—In this appendix, I describe how to install, build, and configure the Groovy scripting language. A working installation of the Groovy interpreter is needed to run the code samples from the text.
Appendix B, "Groovy IDE Support"—In this appendix, I provide instructions on how to install general Groovy support for Integrated Development Environments (IDEs).
Appendix C, "Installing JSR 223"—Here I describe how to install the reference implementation (RI) of the JSR 223, which is needed to run examples from Chapter 10.
I hope you'll enjoy reading the book.
About the Web Site
This book is extended with a Web site at http://www.scriptinginjava.net where you can find the following:
Source codes of all examples shown in the book available for download
Book news, updates, and additions
News and information related to this field of software development
Customer Reviews
getting started with java 1.6 scripting
"Scripting in Java" is a great book to get started with using scripting languages that interact with Java. It is assumed the reader knows Java syntax, a reasonable assumption. The author does go into detail on dynamic vs static languages, the role of the JVM and other concepts. This is helpful as it highlights the important parts when thinking about scripting languages. When discussing any scripting language, the author includes a section on setting it up.
The description of scripting languages, benefits, syntax and libraries is all good. The author shows how to call scripting languages from Java and vice versa. I particularly like how the author pointed out concepts about each language such as how variables are handled. I also like how the author addressed concerns people, myself included, have about scripting languages. The end of the book covers advanced concepts about the scripting framework.
My only complaint is the formatting of the book. It has very large two inch margins. The text is only four inches wide. This makes the book seem heavier/thicker than it needs to be. More importantly, some of the code listings don't follow the huge margin requirement. On some pages, you see a code fragment that honors the two inch margin and another only a half inch from the edge of the book. This happens just often enough to be disorienting when reading.
Overall, the book is very good and I recommend it.
Too ambitious and stopped short at everything
I bought the book impressed at the the reviews at the top. Also the title was telling a lot. Bad judgment. I got disappointed by the lack of depth on almost all the subjects, including Groovy, which consumes good part of the book. And it was not even good at Groovy. It also fails at Bean scripting. Jython, which is my favorite language, is poorly covered as well.
Any computer collection which is both advanced and strong in Java programming references needs SCRIPTING IN JAVA.
Java platform's new scripting support can help streamline development processes and solve problems, especially when paired with SCRIPTING IN JAVA, which covers many key components of Java scripting. The overview begins with discussions of the importance of scripting language and processes, introduces Java frameworks, identifies proven routines for blending scripting into Java applications, and moves to in-depth technical details on language bindings, code configuration and more. Any computer collection which is both advanced and strong in Java programming references needs SCRIPTING IN JAVA.
Diane C. Donovan
California Bookwatch



