Friday, December 31, 2010

OSGi book preview and press release

I'm currently reading (and will soon provide a review for) the new OSGi / Apache Felix book from Packt.

If you've never heard of OSGi, the following press release about the book might help provide some idea what it's all about. Here's the release:

Build your OSGi applications using Packt's new Apache Felix book

Packt is pleased to announce OSGi and Apache Felix 3.0 Beginner's Guide, a new book that will help readers to build their very own OSGi applications using the flexible and powerful Felix Framework. Written by Walid
Joseph Gedeon, this book will assist readers to get acquainted with the OSGi concepts in an easy-to-follow manner and build a completely operational real-life application using Felix.

Apache Felix is an open source implementation of the OSGi Release 4 core framework specification. Furthermore, the OSGi specifications originally targeted embedded devices and home services gateways, but they are ideally suited for any project interested in the principles of modularity, component-orientation, and/or service-orientation.

OSGi and Apache Felix 3.0 Beginner's Guide starts off with an introduction to the OSGi Service Platform, its parts and its bundle structure. It then walks users through setting up the Felix framework and their development environment. Additionally, this book explains the operation of the Felix Framework by means
of Gogo and teaches users practical implementation of OSGi, OBR repositories, dependency management, and bundle version management.

Using this book, developers will be able to discover the practical implementation of important OSGi concepts, understand the use of Maven to build and deploy OSGi bundles, create an OSGi-compliant application, learn the implementation of JSP Web Application Bundles, dive deep into Felix iPOJO, get an overview of the Felix Web Management Console and learn to troubleshoot an OSGi application with ease.

A relentlessly practical beginner's guide with step-by-step instructions, this book is ideal for Java developers, who wish to learn about writing reusable and network distributable software following the OSGi standards using the famous Felix framework. The book is out now and available from Packt. To read more about it, please visit: www.packtpub.com/osgi-and-apache-felix-3-0-beginners-guide/book

Well, there's the preview. Watch for a review in the near future!

Happy Holidays!

Wednesday, December 22, 2010

Pythonistas -- Packt books discounted this month!

Hi all,

Just a quick note for the Python fans-- I've just been informed by my friends at Packt Publishing that they're holding a special on Python books.

Through the month of December, all books and e-books are offered at discounts of up to 30% off.
More details are available here.

Python is a great language, so go buy yourself a Christmas book if you need one!

Happy e-shopping!

Tuesday, December 21, 2010

Coming Soon: Apache Felix & jBPM


OSGi is an interesting topic. Application server vendors and near-application servers like Spring are making provisions for it in their future offerings. Apache is helping lead the charge with Felix, an open source OSGi implementation. I hope to soon review a new book on the basics of OSGi, "OSGi and Apache Felix 3.0 Beginner's Guide" from Packt. Watch this space for a review in the near future.


Another interesting topic is Business Process Management. I've worked around this one for many years, and have at times used JBoss's JBPM product for my tasks. I look forward to reading another Packt title, 'jBPM Developer Guide', which promises to hold some good tips for optimal jBPM development.




















BTW, how about that crazy upper/lower-case letter treatment for these two books? Totally coincidental!

The OSGi book can be found here.

The jBPM book can be found here.

Saturday, December 18, 2010

Book Review for "Jboss AS 5 Performance Tuning"

Let me make one recommendation, right off the bat. Do not pick this book up in the book store and page through the first chapter and a half before putting it back on the shelf. If you do that, you'd miss out on what is perhaps the best contemporary JEE tuning book in existence.

The first 50 pages are a little slow. Mostly they cover the author's recommendation for a performance tuning lifecycle, and a handful of open source tools that can be used to assist with performance tuning. The tools section in particular might lead you to believe the book is light on content-- there are plenty of big screenshots that show you things you could have picked up from the tool's website. But once you're past the tools section, the fluff ends there. What lies ahead is pure good stuff, and it will lead you from the O/S clear through the application server and into the application code.

The author has a clear bias towards Linux in the writing, but does include some Windows-centric advice in places. One constant throughout the book is the use of before/after metrics (captured with JMeter, as you are likewise taught to do) to demonstrate the effect some tuning tweak has had. This is consistent with the stated philosophy of basing things on hard data, not seat-of-the-pants observations. There are plenty of graphs pulled straight from JMeter, which is consistent with how the author recommends we go about measuring progress. Clearly, this guy believes in the methdology he suggests we use.

As the title suggests, the book deals mostly with JBoss AS 5 specific tuning recommendations. That doesn't mean that's all you get, though. Nearly everyone should benefit from the O/S advice, and Java users will benefit from a whole chapter on JVM tuning. Tomcat and Apache users will find many good tips in the latter chapters.

The book is sliced into layers, as code hosted on an application server would be. There are sections on the web layer, EJBs, JMS, ORM (including some good parts about Hibernate, with cache tuning) and cluster tuning. There are separate sections for web frameworks and web service based applications, too. Each of these sections tells you enough about that particular domain to let you know what you want to optimize and how to optimize it. Don't get me wrong-- there's not enough here to make you a clustering expert, for instance-- but there is enough here to let you know how to tune clustering once you've referred to other doc (i.e. the app server doc) and have something ready to run.

Basically, the book addresses nearly every aspect of what can be tuned and optimized, including in-line recommendations about how the application code should be written.

So, who would I recommend this book for? Here's my list:

- Anyone running JBoss AS 5 (Strongly recommend.)
- Developers writing JEE applications (Recommend. The JVM and O/S sections alone will be good, and other sections lend insites into how JEE application servers work. Tomcat users would benefit, too.)
- Java developers (Weakly recommend. The O/S and JVM sections are worthwhile, though.)

As for me, I work with JBoss every day, so I'm going to give this one a second read immediately. That's some of the strongest praise I've got to give.

The book can be found here.

Happy reading, and happy tuning!

Rick


Thursday, December 9, 2010

JBoss Performance Tuning Book is out!


The much-anticipated JBoss Tuning book is available now, and my copy is in the mail.

The book is authored by the same guy who brought us the JBoss 5 Development book, which I liked, so I look forward to reading this one.

Watch here for a review soon, else buy your copy today here.

Happy Reading!

Training Review: JB325, JBoss for Advanced Developers

Disclaimer: I work for JBoss, but I do not work for the training department, nor am I trying to sell you training. I'm just trying to let you know about a worthwhile class you can attend.

I've just finished JB325, a four day live-instructor class. It was an intense 4 days. Roughly, here's what was presented:

JBoss architecture
The inside scoop on how the JMX microkernel and POJO microcontainer act as the framework upon which all the running parts of JBoss are placed. (Hint: you can change it all, through configuration files!) We learned the startup procedure and main abstractions involved, as well as important stuff like classpath isolation techniques. (Experienced JEE developers will probably recognize the need for these.)

AOP, Invokers, Interceptor stacks
Several times we discussed AOP in JBoss and the way chain-of-command is used to build stacks of interceptors used throughout the architecture. The 'Invoker' concept was also thoroughly explained.

JCA, DataSources, and Transactions
Valuable especially in preparing databases and JMS providers for use.

JBoss Cache, Clustering, and JGroups
Clustering is easy with JBoss, right out of the box. This section of the class showed us how it all works and how you can exploit the individual parts if you'd like.

Performance Tuning
This part alone made the class worth attending. Java performance tuning knowledge is always useful, we got some great tips here. (By the way, have a look at the blog post about the new JBoss tuning book.)

Security
As it applies across all the tiers.

Messaging
JBoss Messaging, how it's configured, and how it's used.

Student workstations were provided. Students were given the software (including the IDE) and were required to configure their own environments. Labs were challenging-- sometimes there were some easy parts, sometimes there were significant challenges.

Lunch was provided and was delicious every day. (Not relevant, I know. But if I were shopping around for a class, I'd want to know!)

The bottom line: I recommend this class to anyone using JBoss that's got a handle on application basics already. If you're not sure what goes into a .ear, you're probably not ready yet. But if you've done your share of development on the 'Boss already, you'd probably like this one.

Happy learning!

Saturday, December 4, 2010

The 'Other' Erlang book

Manning has just released a new Erlang title, called 'Erlang and OTP in Action' (available here). For quite some time now, there's been a definitive guide to Erlang-- Joe Armstrong's excellent book 'Programming Erlang'. Well, guess what-- it's time to make a little extra room on the bookshelf, because the Erlang book-o-sphere has just shifted. There are now two must-have resources for an Erlang programmer.

The book is divided into three sections. The first one deals with the basics of Erlang and details about the OTP application framework. Part two shows how to build a production-worthy application in Erlang. The third part of the book is about integration and tuning.

Section 1 has chapters that covers the following: basics of Erlang and OTP, Erlang language fundamentals, writing a TCP-based RPC server, OTP and the supervisor model, and graphical tools to help your development efforts. In my opinion, chapter 1 had some slow spots, but not unbearably slow. The language chapter is good, in some places better than Joe's book. The rest of the section is informative and well written. Section 1 alone would make a decent book on Erlang, but there is much more here.

Section 2 covers building a production application. The example given is a caching application, designed to increase throughput of a web application. Topics like logging and event handling are given a chapter, as is the topic of distributed computing in Erlang. The final chapters of the section cover Mnesia (the Erlang distributed database) and packaging considerations.

Chapters in section 2 generally introduce some high level concepts at the start of the chapter, then weave use of these mechanisms into the application-building storyline, finally providing code that brings the desired functionality into the ever growing demonstration application.

The third section of the book shows how to integrate with external users via HTTP, how to allow programs written in other languages to communicate with your Erlang code, and how to tune your environment. It's notable that Java gets a whole chapter on integration, through JInterface (in comparison, Joe's book offers about 4 lines on this topic. In fairness, that's a much older book, though.)

Throughout the book, simple illustrations are used to demonstrate key concepts. I found these to be extremely helpful, as Erlang in general is considerably different than most programming languages. The delta between Erlang application development and other-language development is an order of magnitude different than something like the difference between Java and Ruby or Python and .Net. It's got different characteristics and different concepts. Given these large differences, I really appreciated the illustrations.

The book is written with easy-to-understand anecdotes that help the reader grasp the finer points of Erlang craftsmanship. You definitely get the impression the authors have written 'real' code, and they offer strong direction to guide the reader through constructing application code. There is a big difference between understanding language syntax and understanding best practices in application construction. Section 2 in particular is loaded with best practices, and this alone makes this book a worthwhile read for Erlang coders writing production applications.

Probably the best thing I can say about this book is that the authors seem to put the advancement of Erlang above all else. To bolster that statement, I'd point out that they refer the reader to other Erlang books they may wish to read, and include several mentions of Joe Armstrong, author of what has been the most popular Erlang book. In my opinion, the authors can afford this indulgence, as this book is strong enough to merit inclusion on the Erlang programmer's bookshelf. I would recommend this book to any Erlang programmer.

"Erlang and OTP in Action" can be found here.

Happy Reading!

Tuesday, November 16, 2010

Prestashop wins Open Source Award

Another open source award-- congratulations to the winners!

Packt Publishing is pleased to announce that PrestaShop has won the inaugural Open Source E-Commerce Applications Award category in the 2010 Open Source Awards. Open Source E-Commerce Applications Award is a new category introduced to the Award this year, featuring various different types of type of web applications that simplify buying and selling of products on the Internet.

“This award is a great recognition for PrestaShop's hardworking team and, of course, the contributors who help us enrich our software every day,” said Bruno Lévêque, PrestaShop Co-Founder.

“We are glad to have received this award from both a panel of expert judges and our growing Community -whose members increased threefold in the past year! They have really mobilized to support our project,” adds Sabrina Maréchal, Head of Marketing & Communications for PrestaShop.

“PrestaShop have achieved a lot in a short period of time considering that it is a community driven project, with the product maturing steadily and in a way that will stand the test of time.” Added Paul Anthony, bespoke e-commerce solutions developer and one of the judges for the 2010 Open Source E-Commerce Applications category. “The structure of the product has also given rise to numerous creative implementations, and the community is large enough and responsive enough to cope with these requests for improvement.”

“Every day more than 40,000 merchants use PrestaShop to manage their online activity and we want to continually improve our software for them, as well as our future users and developers,” concludes Bruno Lévêque.

While PrestaShop occupied the top spot in the 2010 Open Source E-Commerce Applications category, popular shopping cart system OpenCart came in at the first runners up position, while the second runners up position was secured by TomatoCart.

With this announcement, the 2010 Open Source Awards has four more categories left, including the Open Source CMS category, for which results will be announced from November 17th through to November 19th.
For detailed results on each category and more information about the Award, please visit: https://www.packtpub.com/open-source-awards-home.


Happy Open Sourcing!

Monday, November 15, 2010

Pimcore Wins the 2010 Most Promising Open Source Project Award

As a service to the open source community, I'll post awards from the 2010 Open Source Awards this week. Here's the first winner, as seen in Packt's Press Release:

Packt Publishing is pleased to announce that Pimcore has won the Most Promising Open Source Project Award category in the 2010 Open Source Awards. The Most Promising Open Source Project Award, sponsored by OpenCandy, is a revamped category for the Award this year, featuring Open Source projects, whose first release date is less than two years from 9 August, 2010.

Winning this Award is a huge boost”, said Dietmar Rietsch, the founding member of Pimcore. “It’s not simply about the money either, it’s the recognition of a year of hard work and dedication from the team and Pimcore’s community.”

Pimcore is an exciting content management system framework which has great long-term prospects. The project is growing at a fast rate and has good support from its community.” Added Marc Delisle, system administrator and one of the judges for the 2010 Most Promising Open Source Project category. “Pimcore is an easy to use new solution and a high sense of professionalism can be found in everything from the project website to the documentation.”

While Pimcore occupied the top spot in the 2010 Most Promising Open Source Project category, TomatoCMS came in at the first runners up position, while the second runners up position was secured by social networking software package BuddyPress.

With this announcement, the 2010 Open Source Awards has five more categories left, including the Open Source Graphics Software category, for which results will be announced from November 16th through to November 19th.

For detailed results on each category and more information about the Award, please visit: https://www.packtpub.com/open-source-awards-home

Saturday, November 13, 2010

Book Review: "NHibernate 3.0 Cookbook"

Are you a .Net developer looking for a way to persist complicated object graphs in your applications? If so, I've got a book you might want to take a look at: Packt's "NHibernate 3.0 Cookbook".

The book is written in Packt's 'Cookbook' style, which means it's really a series of short sections that guide you through achieving some goal you want to accomplish with NHibernate. Each section follows a template, with sub-sections "Getting Ready", "How to do it", "How it works", "There's More".

Let's take an example, say "Configuring the Cache". You may not yet know why you would want to configure cache for NHibernate, but you have a look at that section in the book.

- 'Getting Ready' tells you which artifacts you have to download and how to set up your machine

- 'How to do it' tells you which files to open and what to edit, which buttons in your IDE to click, and which scripts need to be run.

- 'How it Works' at last tells you why the actions you have been taking will be effective. This is the 'theory' that tells you how NHibernate works and why you might want to undertake the task you're currently engaged in.

- 'There's More' is yet more material related to the task in some way. In the cache example, this might be some text about how the cache fits in NHibernate, how you can read it or externally affect it, and other material that's a tangent to your task.

So what exactly is covered, in this decidedly hands-on style? Plenty. You get:

- Models and Mapping (sort of basic Hibernate theory)

- How to manage your schema and the parts that reference it

- Sessions and Transactions-- very important for enterprise applications!

- Queries using NHibernate

- Testing with NHibernate

- Data Access Layer concerns

- Extending NHibernate

- Other NHibernate related projects

Embedded in each of those topics (mostly within the 'How it Works' sections) is a lot of valuable advice about transactional applications in general. Any reader can gain some insights from those.

All things considered, I'd recommend this book to any .Net developer who's interested in using NHibernate. There is much good advice here that can be applied in a variety of situations.

The book can be viewed here.

By the way, the folks at Packt have passed along a couple of other items that might be of interest:

1) The results of the 2010 Open Source Awards are nearly in, they will be announced daily by category starting next Monday. As a professional open source advocate, I'll be happy to pass those results along as they are announced.

2) As a SOA practitioner, I have a respect for the IBM suite of products. (Though I do have to admit I'm partial to JBoss' offerings, as they pay my salary!) But if you're an IBM fan, Packt has a special deal this month on their products. See the details here.

Happy Reading!

Book Review: "Spring Dynamic Modules in Action"

Book Review: "Spring Dynamic Modules in Action"

First, let me start with a strong statement: This book is going to be the definitive book on Spring DM, period. Users of Spring DM need to rush out and buy a copy, for this book is a reference that will save countless hours and loads of headaches. The authors (there are 3) have clearly travelled many miles with Spring DM, and their experience is laid out plainly for you to purchase for the measly price of a book. My only caveat: be sure Spring DM is the right tool for the problem you want to solve, for there is some work ahead of you. If you are certain it's the right technology, then this is without question the book you need.

Quick explanation for those unfamiliar with Spring DM and OSGi:
OSGi is a specification meant to help Java be more 'modular' and to help solve classpath issues. OSGi lets you specify, via properties in a manifest file, exactly which versions of which library you want your library to use. (You can even have two versions of the same library in use at the same time in your container!) Spring DM is a framework for integrating OSGi with Spring and a selection of it's sub-projects.

Roughly, here's what you can expect from the book:
- An introduction to OSGi and an explanation of its purpose
- Explanation of how Spring can be used within an OSGi container, review of the currently available containers
- Details about how Spring DM works, and the parts you need to understand
- Details about OSGi services, and how they relate to Spring DM
- In depth best practices for data access, enterprise Java projects, and web applications (includes specific advice for popular web application frameworks)
- Testing practices
- Extended uses of OSGi, including likely future direction
- 500+ pages of advice that will keep your journey with Spring DM clear of potential pitfalls

A big part of what makes this book valuable are the many pieces of advice from the authors as they explain best practices for using various tools. So you want to use Eclipse, Ant or Maven? No problem, these are all covered. About to use MyFaces, Wicket, or DWR? All covered. Are you a Tomcat user or Jetty? Check and check. I'm sure you get the picture-- if you use these tools, the path ahead of you is already blazed and you can avoid some headaches by leveraging the author's experience.

So, a final wrap-up: Spring DM users need to buy this book. It will be worth the cost many times over!

The book can be found here.

Happy OSGi-enabled development!

Saturday, October 30, 2010

4 tips to get your support ticket worked pronto!

Isn't software support great? It's one of the few ways possible to make your problem someone else's! But when you've got one of those problems, you usually want it to be worked ASAP. Here are 4 tips to help your ticket go through as quickly as possible.

1) Have your artifacts handy
By 'artifacts', I mean logs, core dumps, mangled transaction prints, etc. If these things are not attached with your original ticket, there's a pretty good chance your first contact from the support engineer will be a request for you to go get them. Meanwhile, while you're off gathering those things your engineer isn't idly standing by-- he's off working another ticket! When your artifacts finally come in, the engineer may or may not be ready to put down that second ticket, you may have to wait. Avoid the asynchronous wait time associated with this first exchange-- provide them in the first place.

2) Open the ticket at the appropriate level of severity
Most ticketing processes involve a user-defined 'level' that indicates how important the ticket is to the holder. (Usually severity 1, or 'sev one', is the highest.) It's tempting to mark every ticket you enter as a sev one, but guess what happens if your development-environment problem isn't really the production-crash that sev one defines? (Check your support agreement to see what the definitions are.) Your ticket will be examined, re-prioritised, and put in a lesser queue. So you lose time 'till that first evaluation, your ticket is delayed going into the proper queue, and you may establish a reputation as a less-than-honorable ticket opener. (That last one is a bad one. Read on....)

3) Playing nice pays off
Often times there are more tickets than support engineers available, which means sometimes the engineer gets to decide which ticket to work first (all other things, like severity, being equal). In situations like these, the 'tone' of the ticket can make a difference. A polite and professional ticket tells the reader that the sender is a savvy user that's ready to collaborate and address the issue. On the other hand a defensive or accusatory note might signal an uncooperative sender. Which would you rather work first?

4) If at all possible, replicate the problem in a minimal environment
This is a big one-- if at all possible, encapsulate the problem in a minimal environment and attach it to the ticket. If your problem lies in a Spring application, isolate the offending components and attach them with an application context to run them. If it's a problem with JSF, build the smallest .war possible that shows the problem and attach the artifacts necessary to build it. It's not always possible, but when it is possible this really helps the engineer! Your ticket will be promptly picked up, and the problem will be put under the best microscopes the engineer has available.

That's it-- follow those 4 steps and your ticket will proceed at max speed.

Happy ticketing!



Thursday, October 28, 2010

ORM the Hibernate way -- on .Net!

I've been a casual user of Hibernate in my Java applications for a long time, but have never gotten around to using it's .Net cousin, NHibernate. Now I've got a reason to finally give NHibernate a look!

Packt has just released a new book, "NHibernate 3.0 Cookbook", described here. The book promises to teach the full range of features available and looks to be an easy read. It's a Packt "Cookbook", which means the book will be presented in a series of 'How To' episodes written in a consistent format. These books emphasize practical application over deep theory, so I have high hopes I'll be rapidly developing database-backed applications in .Net not long after cracking the cover. (Time will tell. I'm waiting for my copy to arrive in the mail.)

Watch these pages for a review sometime soon.


Meanwhile,

Happy Coding!

Saturday, October 23, 2010

How to find which .jar a class is in (easily)

Along with the many blessings a high level language brings you are a few curses. In Java's case, one of the biggest downfalls is the dependency graph your code becomes part of as you develop applications. This is especially noticeable when you're using frameworks like JEE or Spring.

A Java developer feels this pain in a couple of ways:

- Compile time, manifested with errors such as "(ClassName) cannot be resolved to a Type" or "The import some.class.SoughtFor cannot be resolved".

- Runtime, where the errors will show themselves with messages like the all-time favorite "java.lang.ClassNotFoundException".

But what if you had a report like this? Wouldn't that be nice?












So what do you do then? Many coders start by trying to guess which .jars hold the missing classes, then add them to the classpath one by one. This can be an exercise in frustration, as often times .jar names give you little clue as to which classes are inside.

A second methodology developers sometimes use is the 'throw everything but the kitchen sink at it' approach, where they build huge classpaths loaded with every .jar they can find. This inexact coping mechanism obviously leads to bloat.

But wait! There is an exact way to cure the problem, and it's easy and open sourced! Here's how to do it:

1) Download and unzip JBoss Tattletale. It can be found here.
2) Make a run script for Tattletale.
3) Run the run script.
4) Read the report Tattletale makes for you. It's that easy!

The script is easy to write. It takes the form 'java -jar tattletale.jar DIRECTORY_TO_RECURSIVELY_SEARCH DIRECTORY_FOR_REPORTS.

Here's an example:
java -jar tattletale.jar /home/rick/Tools/JBoss/jboss-5.1.0.GA /home/rick/rpts

Then you just go to the reports directory and view the index. To find your classes in .jars, have a look at the 'Class Location' report. It'll tell you which jar holds the missing classes!















Tattletale has many more capabilities, which are well documented in the packaged docs. I hope you'll find this tool useful in your day-to-day development work.

Happy Coding!

Saturday, October 9, 2010

Solve your Java runtime mysteries easily with Byteman

Update February 2012

Use the following to easily use Byteman on AS7, using the HelloWorld quickstart:

-- Script to attach, check, and submit rule -----
#!/bin/bash
export JBOSS_HOME=/home/rick/Tools/JBoss_Org/jboss-as-7.0.2.Final
echo $JBOSS_HOME
export BYTEMAN_HOME=/home/rick/Tools/MISC_TOOLS/byteman-2.0/byteman-download-2.0.0
export BYTEMAN_BIN=$BYTEMAN_HOME/bin
# Only install once.....
# $BYTEMAN_BIN/bminstall.sh -b -Dorg.jboss.byteman.transform.all $JBOSS_HOME/jboss-modules.jar

export QS_HELLOWORLD_TGT=/home/rick/Tools/JBoss_Org/jboss-as-quickstarts-7.0.2.CR1/helloworld/target/classes
# check it
$BYTEMAN_BIN/bmcheck.sh -cp $QS_HELLOWORLD_TGT RicksScript.btm

# add the rule
$BYTEMAN_BIN/bmsubmit.sh RicksScript.btm

-------The Rule. Check the arbitrary Java code used! --------------

RULE trace main entry
CLASS org.jboss.as.quickstarts.helloworld.HelloService
METHOD createHelloMessage
AT ENTRY
IF true
#DO traceln("entering createHelloMessage")
#DO traceStack("found the caller!\n", 100)
DO System.out.println("Hey, I'm random java code!");
ENDRULE

-------------

Have you heard of Byteman? It's sort of like AOP-lite. With a small script and a lightly doctored startup command, you can have x-ray vision into your Java applications. You don't even have to alter your source code, and it's easy to use.

Here's a quick example. Let's say we have a Java application where some method is called at some point, and you want to know when that method is called and what's being passed to it.

So let's say we have an application that provides this output. (I'll show you the source code in a bit.)
-----------------------------------------------------------------
Suspects about to do stuff!
Thump! A murder happens!
Suspects done moving around!
-----------------------------------------------------------------

Well, we don't know much about who committed the crime, do we? (In fairness, we don't even know who the suspects are yet.) But how about if you had the source code? Then could you tell? I doubt it. Here's the source:

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Clue {
private void makeMystery(){
List suspects = new ArrayList();
suspects.add("Colonel Mustard");
suspects.add("Mr. Green");
suspects.add("Miss Scarlet");
Random gen = new Random();
// determine the killer!
int theKiller = gen.nextInt(3);
System.out.println("Suspects about to do stuff!");
for (String suspect : suspects){
walkThroughKitchen(suspect);
// maybe commit the crime!
if (suspect.equals(suspects.get(theKiller))){
commitCrime(suspect);
}
walkThroughLibrary(suspect);
}
System.out.println("Suspects done moving around!");
}

private void walkThroughLibrary(String suspect) {
// walks through...
}

private void commitCrime(String suspect) {
System.out.println("Thump! A murder happens!");
}

private void walkThroughKitchen(String suspect) {
// walks through
}

public static void main(String[] args) {
Clue clue = new Clue();
clue.makeMystery();
}

}

I defy you to tell me who committed the crime! But with Byteman you can tell!

So let's set things up. Aside from downloading Byteman (found here), you need to do a few things.
  1. Make your application into a jar (using jar -cvf someJar.jar *.class, perhaps). This is done as a convenience to make it easier to put on a classpath.
  2. Make a Byteman script, telling it what you want to see.
  3. Make a command-line script to invoke your application.
Step 1 should be familiar to most Java coders.

Step 2. For the above class, let's make a script like this:

 #

# clue_script.txt - A simple script to intercept calls to a method
#
RULE Simple byteman example - watch a method
CLASS Clue
METHOD commitCrime(String)
AT EXIT
BIND THE_MURDERER = $1
IF TRUE
DO traceln("Caught the murderer! It was " + $1)
ENDRULE

Step 3. Add the necessary agent to your startup shell script.
java -javaagent:/home/rick/Tools/Examples/Byteman/byteman-1.3.0/lib/byteman.jar=script:clue_script.txt -classpath clue.jar Clue


Now when we run the script, we see this:
---------------------------------------------------------------
Suspects about to do stuff!
Thump! A murder happens!
Caught the murderer! It was Colonel Mustard
Suspects done moving around!
---------------------------------------------------------------

There we have it! Byteman has let us find out which arguments were being passed to that method, and we did it without altering the source for the application, without attaching a remote debugger, and without much trouble.

Byteman can do much more, though. It can provide stack traces on demand, it can inject faults for testing and other neat tricks. You can add an arbitrary Java helper .jar to help you do things-- just bind it with a "-b" option.  Best of all, it doesn't cost anything. Check it out today, here.

Happy Inspecting!

Saturday, October 2, 2010

Voting now open for 2010 Open Source Awards

The nomination stage is now closed and voting has begun in the 2010 Open Source Awards.

Your vote could reward an open source project with cash awards (I know the developers will appreciate that!) Registering to vote will require your name and email, and it's a single button click to cast your vote.

Here are the finalists, in categories:

Open Source CMS Award

Every Content Management System (CMS) that is based on one of the Open Source licenses is eligible to participate for this category. Vote for your favorite Open Source CMS here.

Finalists:

  • CMS Made Simple
  • MODx
  • mojoPortal
  • SilverStripe
  • XOOPS

Hall of Fame CMS

This category is reserved for those CMSes that have won the Overall Open Source CMS Award at least once in the past. Since the launch of the award in 2006, only Joomla!, Drupal and WordPress have won the Overall Open Source CMS Award, therefore, this category will feature only those three participants in 2010. Vote for your favorite Hall of Fame CMS here.

Finalists

  • Drupal
  • Joomla!
  • WordPress

      Most Promising Open Source Project

      This category is for all Open Source projects, whose first release date is less than two years from 9 August, 2010. Vote for your favorite Most Promising Open Source Project here.

      Finalists

      • BuddyPress
      • LiveStreet CMS
      • Pimcore
      • Tomato CMS
      • WolfCMS

        Open Source E-Commerce Applications

        This category is reserved for the type of web applications that simplify buying and selling of products on the Internet. This will include complete e-commerce applications or frameworks designed for e-commerce. E-commerce modules or extensions to other systems can also be nominated. If a system is general purpose (like a CMS such as Drupal or Joomla!) the specific e-commerce functionality should be nominated, not the base system.Vote for your favorite Open Source E-Commerce Applications here.

        Finalists

        • Magento
        • nopCommerce
        • OpenCart
        • PrestaShop
        • Tomatocart

        Open Source JavaScript Libraries

        This category is reserved for JavaScript libraries, libraries of pre-written JavaScript controls which allow for easier development of RIAs (Rich Internet Applications), visually enhanced applications or smoother server-side JavaScript functionalities.Vote for your favorite Open Source JavaScript Libraries here.

        Finalists

        • Dojo ToolKit
        • Ext JS
        • jQuery
        • Mootools
        • Raphaël

        Open Source Graphics Software

        This category, as the name suggests, is for all Graphic Application Software that is used for graphic design, multimedia development, specialized image development, general image editing, or simply to access graphic files. It can also include graphics libraries, which use command line references or programming language inputs to design or edit graphics.Vote for your favorite Open Source Graphics Software here.

        Finalists

        • Blender
        • Gimp
        • InkScape
        • jMonkeyEngine
        • Scribus

        Happy Voting!

        Monday, September 13, 2010

        Book Review: "Drools JBoss Rules 5.0: Developer's Guide"

        Business Rules Engines are a curious thing. For years they've been promising to ease the burden of writing and maintaining business logic, yet they never quite seem to live up to the promise. Want to give one a try? Let's have a look at a prominent Open Source BRE (Drools) as guided by this book from Packt.

        The book starts out simply enough, with the first chapter introducing the idea of a BRE and the second covering rule authoring basics. From there, the author launches into building a banking application.

        Chapter 3 is the 'Validation' chapter. This is a natural strong suit for a BRE, as they favor 'if/then' (or, as this author writes, 'when/then' logic). The author does a good job of introducing necessary parts of the Drools infrastructure, i.e. the 'rule context' which is useful in taking action when some condition exists.

        Chapter 4 is about data transformation, it's not a far leap from Chapter 3. I think this was somewhat imaginitive on the author's part, as XSLT or a tool like Smooks tends is probably a better choice for transformation than a BRE would be. This book is all about Drools, though, so it makes more sense to do it this way.

        Chapter 5 is the 'DSL' chapter. Rules tend to look a little awkward to coders unaccustomed to seeing them. A good example might look like this:

        when
        $customer : Customer (balance <>
        then
        $customer.setMinBalanceWarning();
        warning (kcontext)
        end

        Instead of dealing with that kind of stuff, it's possible for some rules (if they fit a pattern) to be written something like this:

        when
        There is a Customer with a balance less than $200.00
        then
        Set the Minimum Balance Warning
        Report this
        end

        Isn't that cool? It's really not all that mysterious, chapter 5 shows you how to do it. Warning: When managers see BRE marketing presentations, they sometimes watch something like this demonstrated and get all kinds of ideas about firing all the programmers and replacing them with business analysts. Rest assured, there is a programmer behind it all. (And a very skilled programmer at that. But this is for the rule practitioner to see....)

        Chapter 6 covers stateful sessions, something that can be handy when your application doesn't experience big swings in the data it's crunching on. The author does his usual good job of providing an implementation, then some tests to prove the code. Once again, technical tidbits are introduced to the reader as they are needed.

        Chapter 7 is about Complex Event Processing, somewhat a hot topic in today's Developer landscape. It's an interesting use case for Drools, so I was glad to see it.

        Chapter 8 covers 'Drools Flow', which is one of the ways you can influence the order in which your rules are executed. To a garden-variety Java coder, this might seem like a strange statement-- how can you NOT influence the order in which your rules are executed? But that's the BRE way, and the author shows you one way to productively manage this 'feature' of the BRE.

        Chapter 9 builds the Sample Application, which is the app that houses all the work done previously. It suffers a little scope creep, as the reader is expected to enclose their Drools work in Spring, Tomcat, etc. but I expect this won't be too much to ask of the type of reader who picks up this book.

        The next chapter is about testing, always something nice to understand in whatever language or framework you're dealing with. Chapter 11 follows, that one covers integration issues. (Roughly, how do you take all your useful Drools code and apply it somewhere?) It's another nice thing to have spelled out.

        The final chapter is on performance. It's a little funny because this final chapter enlightens the reader on the inner workings of the rule engine, something you might expect to see in the front of the book rather than the back. But it's good stuff, so I'm glad it was included.

        There are 3 appendices, focused on helping with preparations for running the code the book provides.

        So, what's the verdict? Here are the things I like:

        - Gives some expert insights into how to write an application with a BRE
        - Covers lots of the different facets offered by Drools
        - Provides good explanations for technical tid-bits

        Now for some dis-likes:

        - Not enough guidance on best practices. Some are here, buried in the text, but you have to realize what you're looking at. The market really cries out for a book that explicitly provides these.
        - Probably not enough to get a BRE newbie off the ground. Combined with the Drools user doc ('Cheese Shop'!) it may be enough.
        - The author does a good job of using Drools for several purposes, but does not give the reader much guidance on when it really is smart to use a BRE and when it isn't. (There are plenty of places where it isn't-- I guess it's up to you to decide!)

        All things considered, I liked the book. Next time I'm into Drools, I'm certain it'll be by my side!

        The book can be found here.

        ..........

        if
        you liked this article
        then
        come back again another time!
        end

        Rick

        Saturday, September 11, 2010

        New, less expensive Online Book Library available

        Are you familiar with online library services like Safari or Books 24 x 7? These are places where you can access large libraries of technical books online on a subscription basis. Now there's a new entry in the workspace for you to consider.

        The newcomer is Packt's online library, found here. I've signed up for the free trial and can offer the following assessment:

        • I like the cost, compared to Safari or Books 24 x 7. Packt is a little less than $200 a year, where the others are right at $500.
        • The catalog size is less than what the competitors offer. Both Safari and Books 24 x 7 host titles from a list of publishers, where Packt is offering books from their catalog only.
        • With the trial account, you get access to 9 free titles. I don't have an interest in most, but there is a Plone development title there and one on Microsoft Live Small Office, though. I think those would be interesting.

        Packt currently has over 400 titles available in the section you have to pay to see, and they do seem to include what I would consider the best books in Packt's arsenal. For those unfamiliar with Packt's publishing model, they are no longer focused entirely on up-to-the-minute open source topics. They've split their catalog into two sides, open source and 'Enterprise'. Enterprise includes things like Oracle's SOA suite, so you can see the distinction between the two.

        I always think it's better for consumers to have more choices in almost any arena. Viva la competencia! (Long live the competition!)

        'Till next time,

        Happy Online Reading!

        Monday, August 16, 2010

        Book Review for "Plone 3.3 Site Administration: Manage your site like a Plone professional" by Alex Clark

        Book Review for "Plone 3.3 Site Administration: Manage your site like a Plone professional" by Alex Clark.

        Are you a Plone administrator or content editor? If so, there's a new book from Packt that's worth your attention.

        "Plone 3.3 Site Administration: Manage your site like a Plone professional" guides the reader through site installation and configuration of many useful add-ons. The tool of choice for a modern Plone site is 'zc.Buildout', and this book makes extensive use of buildout in each chapter as the author guides the reader from a basic Plone site to one well adorned with add-ons to enhance the appearance, functionality, and scalability of the site.

        One thing I'd like to emphasize is that this book is all about configuration of these add-ons. As an example, the book will introduce the reader to some desirable non-standard bit-- let's say the Varnish HTTP accelerator-- and give step-by-step instructions on how to get Varnish downloaded and configured for your Plone site. What's missing is an overview of exactly what Varnish is. There are no diagrams and not much text explaining how it works. This pattern is repeated nearly everywhere-- you get the buildout configuration (and the response to expect when running buildout), but it's up to you to get your head wrapped around exactly what it is that you're adding to your site. I find this ok, given that the book is targeted to readers who are already site administrators and should recognize most of the products we're dealing with. (For the products that I didn't recognize, Google was able to round out my education, so I didn't feel slighted.) I did think this was an important thing to point out so a first-time reader of the book will recognize what's in store in this book.

        There's a lot of good advice that's not Plone specific. Best practices regarding version control of configurations, database maintenance, database packing, and more are covered. These are the sort of thing that an experienced administrator will see value in, and a new administrator will appreciate having spelled out for them. (One way or another, new administrators will adapt policies like these. Maybe after reading some text and realizing the value, maybe after getting burned once or twice and learning it the hard way.) In that regard, even one of these tips is probably worth the price of the book.

        I continue to be impressed by the Plone community and the effort they have put forth to build the impressive ecosystem around this impressive CMS. This one's for the admins, an audience that probably doesn't get as many books as they should.

        The book can be found here.

        Happy Administering!

        Rick

        Monday, August 9, 2010

        2010 Open Source Awards now open

        Do you have a favorite open source project? Would you like to thank an open source provider in a tangible way? How about nominating them for the 2010 Open Source Awards, a contest put on by Packt Publishing that offers US $24K in cash awards?

        Nominations are accepted this year for the following categories: Content Management Systems, E-Commerce Applications, Graphics Software, and JavaScript Libraries. On a side note, nominators are entered into a drawing for a free Kindle, so maybe your kindness will be rewarded as well.

        Happy Voting, and to ALL the open source coders-- Thanks!

        Rick

        P.S. For those interested, I'll include the Packt Press Release in it's entirety:

        Packt launch fifth annual Open Source Awards

        Birmingham, UK. 9th August 2010

        The 2010 Open Source Awards was launched today by Packt, inviting people to visit www.PacktPub.com and submit nominations for their favorite Open Source project. Now in its fifth year, the Award has been adapted from the established Open Source CMS Award with the wider aim of encouraging, supporting, recognizing and rewarding all Open Source projects.

        WordPress won the 2009 Open Source Content Management System (CMS) Award in what was a very close contest with MODx and SilverStripe. While MODx was the first runner up, SilverStripe, a Most Promising CMS Award winner in 2008, made its way to the second runner up position in its first year in the Open Source CMS Award final.

        The 2010 Award will feature a prize fund of $24,000 with several new categories introduced. While the Open Source CMS Award category will continue to recognize the best content management system, Packt is introducing categories for the Most Promising Open Source Project, Open Source E-Commerce Applications, Open Source JavaScript Libraries and Open Source Graphics Software. CMSes that won the Overall CMS Award in previous years will continue to compete against one another in the Hall of Fame CMS category.

        These new categories will ensure that the Open Source Awards is the ultimate platform to recognise excellence within the community while supporting projects both new and old. “We believe that the adaption of the Award and the new categories will provide a new level of accessibility, with the Award recognizing a wider range of Open Source projects; both previous winners while at the same time, encouraging new projects” said Julian Copes, organizer of this year’s Awards.

        Packt has opened up nominations for people to submit their favorite Open Source projects for each category at www.PacktPub.com/open-source-awards-home . The top five in each category will go through to the final, which begins in the last week of September. For more information on the categories, please visit Packt’s website www.PacktPub.com/blog/packt’s-2010-open-source-awards-announcement

        Contacts

        Julian Copes

        PR Executive, Packt Publishing

        julianc@packtpub.com | www.PacktPub.com



        About Packt

        Packt is a modern, unique publishing company with a focus on producing cutting-edge books for communities of developers, administrators, and newbies alike.

        Packt’s books and publications share the experiences of fellow IT professionals in adapting and customizing today's systems, applications, and frameworks. Their solutions-based books give readers the knowledge and power to customize the software and technologies they’re using to get the job done.

        For more information, please visit www.PacktPub.com

        3 Great (and Free!) Tools for Knowledge Workers

        Once in a while I happen across a tool that helps me in my work. Here are three.

        Spreeder
        This website helps me to read material at a much faster rate than I normally would. You can dial up the rate (in words per minute) so you can control how fast you read. You provide the text, via cut-n-paste. Sometimes I miss having the diagrams, and the structure of the words is lost, but all things considered this is a great tool.



        www.spreeder.com

        Freemind

        This desktop app is great for helping you round out your ideas. I'm not sure why it helps so much, but for me it does. You quickly get used to adding new ideas, prioritizing them, shuffling them around, etc. It's really very easy to get started.



        http://freemind.sourceforge.net/wiki/index.php/Main_Page

        jMemorize

        Here's another desktop application, this time one that helps me to remember things. As an example, I am just terrible at remembering people's names-- but jMemorize helps with that! By making electronic flashcards (yes, images can be put on one side!) you can use the provided 'Learn' mode to review all the cards in a group, removing the ones you get right. It's easy to use, you just run the java jar and away you go.



        http://sourceforge.net/projects/jmemorize/

        I hope these are as useful to you as they are to me.

        Happy Thinking!

        Rick

        Wednesday, July 28, 2010

        Book Review for "Plone 3 Multimedia"

        I've just finished "Plone 3 Multimedia", another Packt Plone title.

        If you're not experienced with Plone, you probably need not pick this one up for a while. But if you are running Plone and want to use video, audio, photos, etc. to snazz it up-- there's a lot here for you. Here's the full review:


        Plone 3 Multimedia

        This is a book for Plone power users and administrators. The focus of the book is on multimedia capabilities, the content type is a wide-ranging survey with details for each of the many mini-subtopics. For anyone with a need to add multimedia content to a Plone site, I would recommend this book.

        Chapter 1 is a brief chapter that defines Plone, ZCA (Zope Component Architecture), the excellent zc.buildout, and multimedia itself. The author gives us a brief introduction to Plone4Artists, which is an initiative that addresses many multimedia concerns.

        Chapter 2 is all about images. The author tells us how to organize, resize, and group images in ways that make the site more appealing to the user. You are taught how to produce thumbnail images (which can be clicked into larger images) and how to use gallery/slideshow products. This is the first chapter to use a recurring theme: The author first explains the capabilities of a basic Plone installation, then later explains what sort of add-ons you might use to gain further capabilities. This is a meaty chapter with lots of technical content. If you're a serious Plone admin, this chapter alone might make the book worth your while.

        Chapter 3 is the audio chapter. Audio formats are explained along with the advantages and disadvantages of the various types. A good explanation of audio metadata is included-- I found that part especially interesting. The author explains how to include audio players on your Plone site, and demonstrates writing a player view in HTML5. Like chapter 2, this chapter is a deeply technical one with plenty of specific advice to guide the reader.

        It seems only natural that video content should follow audio and images, and so it is. Chapter 4 tells us how to stream and embed videos in your Plone site, also how to leverage videos hosted on external sites like YouTube. By now you'll recognize the familiar chapter format: First the basic capabilities of Plone are covered, then fancier alternatives are introduced including the Plone4Artists parts that address this chapter's needs. Once you recognize the chapter layout pattern, it really makes the material easier to divide into logical sections.

        Chapter 5 concerns Flash in Plone. Several Flash helpers are covered, as well as some problem spots that can be avoided. As a special bonus, Silverlight is given coverage, too.

        The next chapter was really interesting to me-- it was all about content organization and control. The first part dealt with categorization, and ways to optimize flexibility in Plone's folder-centric way of doing things. This was followed by a good discussion on content metadata, and an explanation of the Dublin Core standard for metadata. Tagging and rating of content followed this, and geo-location and the use of maps was the ending of chapter 6. There was enough information here that I am going to read it again!

        Chapter 7 was all about Syndication, including RSS and Atom. As usual, the author outlined what a basic Plone installation can do, then suggests some add-ons that can further enhance your Plone site. Another common theme throughout the book is the suggestion of add-ons that will be helpful for the current problem set, then advice on how to configure the add-on for best usage.

        Chapter 8 covers advanced uploading techniques. Say you have a whole photo album you'd like to move onto Plone, but you'd really rather not do it one file at a time. This chapter is for you, then! The author discusses FTP, WebDAV, and a few external tools that can be of use in this case.

        The next chapter is all about persisting data. The author first covers the vanilla Plone default (ZODB, the object data base) then offers alternatives. The main concern is large binary files, which is natural since this book is all about multimedia data types. For these, Plone can be configured to use external sources (like YouTube) or file system mechanisms to hold the data outside of ZODB.

        Chapter 10 is the final chapter of the book, and it covers the important topic of performance optimization. Varnish, the reverse proxy cache server is explained as is the Red5 video server. CachFu, a commonly used content caching mechanism, is also explained.

        You might think 10 good technical chapters would be enough, but as they say on infomercials, that's not all! You also get not 1, not 2, but 3 appendices. Appendix A covers multimedia formats and licenses, including a nice explanation of various codecs you're likely to encounter. Appendix B is about Syndication formats, including RSS1, RSS2, and Atom. Appendix C covers links and places to find more information about Plone, it's build-out system, and more.

        All things considered, this book is just what it purports to be-- an excellent resource for anyone using Plone to host multimedia content. There is enough diversity and depth in this book that I'm sure nearly everyone will learn something new (and many of us will learn many new things!) I would not recommend this book for a Plone newbie, as there is no gentle introduction preceding the technical content-- the author assumes the reader is already a reasonably competent Plone integrator. (This is all spelled out on the book's back cover and in the introductory text, though. If you miss that and come away disappointed, shame on you.) I'm sure this book will soon become a go-to reference for Plone lovers everywhere.

        The book can be found here.

        Happy Reading!

        Free eBooks!

        Hi all,

        Once in a while, something really good comes along and you feel you just have to share it with people. That's what's going on today, I have some free eBooks to share.

        Packt Publishing has recently decided to give away some of it's eBooks, free of charge. Here are at least 5 titles:

        Building Online Communities with phpBB 2
        Upgrading to Lotus Notes and Domino 7
        Invision Power Board: A User Guide
        Building Websites with e107
        The PEAR Installer Manifesto

        The link that told me about these give-aways is here.

        Besides free eBooks, Packt is also converting their electronic books to the 'ePub' format, which promises superior display capabilities, flexibility in formatting, and a host of other benefits. There's a nice press release about it here.

        I hope you find something good there.

        Happy Reading!

        P.S. If you don't want to follow the above link to the ePub announcement, I'll include the announcement as it reads on their site. Here it is:

        by Julian Copes | July 2010 | Enterprise Articles Open Source
        Packt Publishing announced today that its eBooks will be available to download from www.PacktPub.com in ePub format with immediate effect. Following feedback from customers, the fast-growing publisher made the move to provide this popular format and expects it to be well received.

        ePub (short for electronic publication) is a free and open eBook standard by the International Digital Publishing Forum (IDPF). ePub allows greater flexibility with content. With an ePub-formatted book, the display of text can be optimized for the reader's device. Other ePub features include improved design and layout, Inline raster and vector images, better search functionality, while enabling DRM protection and embedded metadata.

        The company’s marketing manager Damian Carvill said “Packt listens to all feedback from customers and attempts to act on it accordingly. After receiving a number of requests, we made it a priority to convert all of our existing eBooks into the ePub format. All of our future books, and we hope to publish over 20 in July, will also be available in this popular eBook format.”

        Packt is inviting all customers, who have purchased an eBook, to download the ePub version of the book and enjoy its features and great flexibility. Alternatively, customers can sample the ePub format by accessing one of Packt’s free eBooks. All purchases of new eBooks from today will be made available to download as an ePub file, as well as the standard PDF.

        Packt ePub formatted eBooks are available from Tuesday 20th July 2010. To access your first Packt ePub eBook, either previously purchased or one of Packt’s free eBooks, please log into www.PacktPub.com and go to My account.

        Tuesday, July 27, 2010

        New Plone Admin book available




        I've been learning Plone lately, thanks mostly to LearnPlone.org and Packt's excellent library of new Plone titles.

        A site admin can always use a book of new tips, and sure enough, Packt has that one covered too. There's a brand new title available, "Plone 3.3 Site Administration". The book can be viewed here.

        There's a copy coming via mail, I promise to provide a review ASAP.

        Meanwhile, please try to stay cool in the summer heat.

        Happy coding!

        P.S. Check that chain on the book cover-- I guess they're plugging Plone's top-notch security. I read today on Slashdot that the CIA uses Plone-- it must be pretty secure!

        Monday, July 5, 2010

        Book Review for "Groovy for Domain-Specific Languages"




        Book Review of "Groovy for Domain-Specific Languages", or how to teach a Java guy Closures and Meta-Programming

        Are you an accomplished Java Coder, but not very experienced with the 'dynamic' languages like Python, Ruby or Groovy? I am.

        Sure, I know a little about all those languages, especially Python. For quite a while now, I've used Python for scripting and even for quick Hadoop jobs. But the way I used Python wasn't much different than how I'd use Java-- mostly plain Object Oriented technique at the fanciest, more likely just plain old procedural scripting for quick-n-dirty text manipulation jobs. I'd read the occasional article about dynamic language features (like closures, metaprogramming, and built-in builders) but I didn't really have a good idea what those meant.

        That all changed after I read "Groovy for Domain-Specific Languages" from Packt.

        Groovy, it turns out, is a language built on top of the JVM and it offers really easy integration with Java. (So much so that your Groovy code compiles to JVM bytecode, so all the current Java code you have available to you is also available to your Groovy code.) The book goes about introducing Groovy in terms a Java coder will easily understand, and I think the author did a good job in this respect.

        Groovy can be an easier Java. Language verbosity is relaxed, so coders can drop parenthesis, semi-colons, and variable types where it makes sense. This saves a few keystrokes at code-writing time, but more importantly it produces code that's a lot leaner so it can be much more readable. But that's not what helps in DSL construction.

        DSLs, for those of you impervious to the growing dev-space din, are "Domain Specific Languages", or little languages meant to serve a single purpose. Never heard of that, you say? How about 'Regular Expressions', 'Make', and 'Ant'? I'm sure you've heard of those! They're all examples of little language that are designed to perform some very specific task, and make the user's life easier than if they had to use a general purpose language like C or Java to accomplish something like compiling a .jar.

        This book goes about explaining some of the features a dynamic language like Groovy has that make DSL authoring an easier task. One such feature is the 'Closure' something Java doesn't have at this time. So what's a closure? I'd call it a method, except it's packed up in such a way that you can send it to other methods as a parameter. Confused? Check this example:

        def islanders = ["Skipper", "Gilligan"] // This is a List in Groovy
        def aClosure = { println "Hello, ${it}" }
        islanders.each (aClosure) // This will print "Hello, Skipper" "Hello, Gilligan"

        Another DSL-friendly feature of Groovy is Meta-Programming. Meta-Programming is writing code that can change it's behavior at runtime. One flavor of this is Reflection, which I knew from Java-- given the String name of a class, I could conjure up an instance of that class. I'd also seen in Python how you can add properties to an object 'on the fly'-- if that property wasn't there, the class just somehow put it there as soon as you accessed it, and the code went chugging along. But that's just the tip of the iceberg! In Groovy you can have your class respond to method calls that you didn't write at the time the class was authored. Weird! Yet very handy if you're writing a DSL, as the book explains.

        The book is really a double-whammy, covering both Groovy-for-the-Java-Coder and Best-Practices-in-Writing-a-DSL. IMHO, it covers the first topic in more detail than the second, but I liked what I got from both.

        The book can be found here.

        There have been several times in my career where I've written a little language, probably with mixed levels of effectiveness. The next time this topic arises, I have a new weapon to bring out, so I'm waiting on it now!

        'Till then,

        Happy Coding!