Pragmatic Project Automation

In a previous post, I wrote a review of Pragmatic Version Control Using Subversion which covers effectively using version control systems on software development projects. This entry covers another book by the Pragmatic Programmers in their Pragmatic Starter Series.

Pragmatic Project Automation: How to Build, Deploy, and Monitor Java Apps

Pragmatic Project Automation by Mike Clark


  1. Introduction
  2. One-Step Builds
  3. Scheduled Builds
  4. Push-Button Releases
  5. Installation and Deployment
  6. Monitoring

Pragmatic Project Automation shares a lot with the rest of the Pragmatic Starter Series. As the name implies these books are intended to get you started down the path without necessarily showing you the entire way. The book is relatively short coming in at a slim 152 pages. This makes it a quick read and allows it to cover the topic from a high level. It sells the idea of automation and shows how to do automation in all aspects of software development. It shows examples everything from the simplest scripts using Unix shell and Windows tools all the way up to purpose-build programs that will make automation very easy for larger and more complex projects.

Chapter 1 – Introduction

The introduction lays the groundwork for automation. It categorizes automation into 3 types:

  • Scheduled Automation
  • Triggered Automation
  • Commanded Automation

Commanded Automation is probably the most familiar to most Java developers. This is the idea that you run a small script or an Ant build. This kind of automation is user driven and run when they want to do a certain task. Scheduled Automation, as it’s name implies, is something that is run based on time while Triggered Automation is automation that happens in response to a change in environment such as checking in code to a version control system. This groudwork is built upon during the rest of the book.

Chapter 2 – One-Step Builds

This is the most common kind of automation from what I’ve seen. This chapter covers building source code using a script. Being a Pragmatic book, it starts with a simple example using a shell script. It then does a good job of building a good template for an Ant build. One of the interesting things in this chapter is that it discusses using Groovy, a Java based scripting language, that has built-in support for Ant scripting. In many ways this Groovy example is very interesting because it’s a real scripting language so you can easily create your own custom code without the overhead of creating an Ant task. Maybe JRuby will catch on here (hint, hint JRuby folks) as I like the Ruby syntax a lot more than Groovy.

Chapter 3 – Scheduled Builds

Chapter 3 starts with the easiest way of doing a scheduled build, using cron on Unix or at on Windows to periodically run a build script. I really like the fact that the authors mentioned this because I really think it lowers the barrier to people getting into automation. There’s no need to over engineer a solution if you have simple needs. Of course this simple technique is fairly limited so they don’t stop there.

This chapter also covers using CruiseControl for doing both Scheduled and Triggered builds. It walks through the setup of your first project in CruiseControl. I’m a huge fan of Continuous Integration because it’s an always on backup for the processes that your team wants to enforce.

Chapter 4 – Push-Button Releases

Doing a build which you do everyday, hopefully multiple times a day, is one thing, but how do you move code from source control to QA, a staging server or a production server? Well you automate it of course! This chapter covers creating a script that you can use to turn your code into a form you can send to a customer. The simple examples are just creating the proper artifacts and creating archives like Zip or Tar files. It also talks about a number of processes including using automation to manage branching and tagging in your version control system. The branching and tagging automation not only makes the “release manager’s” life easier, it really helps to create a consistent process that means you’ll always be able to find and recreate any version in the future.

Chapter 5 – Installation and Deployment

This chapter covers 2 slightly unrelated (to me) but interesting ideas. The most obvious based on the name is creating an installer. It discusses everything from a simple Zip file “install” to using a full-blown installation system. The book uses the Open Source Nullsoft Scripted Installer (NSIS) as an example of building a Windows install. I’ve never used NSIS before so I can’t speak for its strengths or weaknesses, but it is used in a lot of Open Source projects. The introduction is very brief, so plan on doing some other reading if you want to use Nullsoft.

Chapter 6 – Monitoring

To wrap the book up, we get the Make chapter of the book. Now that you have triggered and scheduled builds running and applications in production, how do you know when there is a problem? This chapter talks about a number of good ideas starting with the easy ones of email and cell phones but taking some unanticipated turns into things like RSS feeds as well.

Some of the more interesting ideas where using custom applications to drive visual feedback monitors. Two of the more interesting examples where using Lava Lamps and Ambient Orbs to signal when a build is broken. The Lava Lamps would sit in the office and turn on/off red or green Lava Lamps based on the build status. Even more interesting is the Ambient Orb. It can glow in multiple colors. It communicates over a national wireless network like the pager network. So now you can take your magic orb with you and it will notify you when there’s a problem with the build.

The only problem with this chapter is that it really doesn’t have any implementations for these cool ideas. It leaves a lot up to the imagination.


The book is 152 pages, as I said above, which means that it is by no means a comprehensive reference to any of the topics covered. If you are already sold on the idea of automation, this would be good ammunition to convince other people on a team or in management to support the idea. If you are completely unfamiliar with the topic, then this book will offer you a good basis for getting started. If you are already familiar with the topic and are looking to expand on what you know or get ideas for more ways to automate then you probably won’t get a lot out of this book and should probably look elsewhere.

Pragmatic Project Automation: How to Build, Deploy, and Monitor Java Apps

Other Related

Cruise Control
Java Development with Ant

RJS Templates for Rails

I recently got a free copy of RJS Templates for Rails from the Milwaukee Ruby User’s Group. O’Reilly has a program that makes books available for free to Users Groups, which is a really nice thing (of course they bank on the word-of-mouth advertising that comes from it. Hi O’Reilly! ).

RJS Templates for Rails is an O’Reilly “Short Cut” which is basically a small book released as a PDF only. It offers a brief look into some of the things that you can do with RJS templates that were added in Ruby on Rails 1.1. RJS is a way to write client-side JavaScript using the Ruby language and JavaScriptGenerator API. This allows you to do complex, multi-step processing to modify different parts of the page in a single request.

The JavaScriptGenerator API is accessible from within a Controller and from RJS Templates. Which you use is part style and part pragmatic. For one-liners it is often just easier to write the code inline, reserving the RJS templates for more complex scripts.

Inline code would look like:

def hide_details
render :update do |page|

Where an RJS template is automatically wrapped with the render :update block.

page.insert_html :bottom, 'list', '

  • New Item At Bottom
  • '

    Both of these are simple examples of course, but they give you an idea of what’s going on. Each of these would generate JavaScript and send it back to the client where it would be executed in the browser. You can see that you do not have to write any JavaScript to use these techniques. The only thing that you have to do is to include the Prototype library in your pages using:

    <%= javascript_include_tag :defaults %>

    RJS Templates for Rails is a really quick read that does a good job of getting you started with using RJS and the JavaScriptGenerator API. It starts with a very simple example program that you can have up and running in a matter of minutes. It continues with a slightly more in-depth example of an application that really uses some of the more interesting aspects of RJS including multi-element page updates with a single request.

    The book offers a reference to the API that gives you a quick reference to the methods that you can use to program JavaScript in Ruby. Being a short book, it does not offer a slew of recipes that you would want from a more comprehensive book. This feels like an appetizer to me, giving me a taste of what’s available, whetting my appetite for more.

    In the abstract, RJS Templates for Rails actually offers some really good insight into how some people are doing AJAX with code generation techniques. Instead of writing JavaScript, they are creating APIs in their programming language of choice and then using code generation techniques to output the client-side code. While this style requires that the toolkit creator knows a great deal about the language being generated (JavaScript), it can encapsulate that knowledge so that others can leverage it without getting into the details. This is how the Google Web Toolkit (GWT) works as well for the Java camp. Prior to reading this book I don’t think I quite got what the big deal was, but now I see these frameworks really can do some incredible things for people who don’t want to “get their hands dirty” doing client-side development.

    If you’re an AJAX whiz, I’d doubt that this would offer a lot unless you just wanted to see another implementation and didn’t know a lot about Rails. But if you want to see how easy it could be to add some really interesting AJAX features to a Rails application, this can help you get started. You’ll almost definitely want to get a more comprehensive book to give you some more ideas on how to handle a broader range of situations.

    RJS Templates for Rails – Cody Fauser – ISBN: 0-596-52809-4

    The October 2006 issue of MacTech has a really good article on RJS as well. It covers some of the same basics that the PDF covers, using a few different examples.

    Pragmatic Version Control Using Subversion

    When I was in grade school I had to do a biographical book review every year. Probably 5 years, from 2nd grade to 7th grade we would be required to do book reviews and inevitably we’d have to do a biography. We’ll, I hated biographies, so every year I would do the same person: Jacque Cousteau. So, I’m not going to do any biographies, but I will review some technical books that I read.

    Pragmatic Version Control Using Subversion

    Pragmatic Version Control Using Subversion by Mike Mason


    1. Introduction
    2. What is Version Control?
    3. Getting Started with Subversion
    4. How To…
    5. Common Subversion Commands
    6. File Locking and Binary Files
    7. Organizing Your Repository
    8. Using Tags and Branches
    9. Creating a Project
    10. Third-Party Code

    This book is not written as an exhaustive reference of of all of the Subversion commands. For that you can use the Subversion Red Bean book. Instead, this book is written as a series of scripts and best practices that you can use on your project. It’s more of a manual on how to use Subversion on an average project. I found this very helpful because it tackled the problems from a solution-oriented “why” approach, as opposed to merely a how approach.

    Chapters 1 – 3

    As would be expected, the early chapters offer a general introduction to the topic of the book. In the style of many of the Extreme Programming and Pragmatic Programmers books, these introduction include stories to illustrate the reasons and techniques that are outlined in more detail throughout the book. I find these stories to be very helpful because I think many people can identify with them.

    Chapters 4 – 6

    These chapters do a good job of covering the basics of source control. If you’ve been using source control such as Subversion or CVS, these chapters will likely not offer you a lot of new information. If you are new to using version control systems, then these chapters will give you a great overview of the basic day-to-day operations that you need to be an effective version control user.

    Chapter 7

    Chapter 7 is entirely devoted to file locking and binary files. While file locking is interesting in certain situations, I’ve never personally found the need for it. I guess this is a good chapter to skim just to know the possibilities in case you ever run across a situation where you need to lock binary files. If you’re in a hurry, skip this one I guess.

    Chapters 8 – 10

    These chapters constituted some of the more interesting information in the book for me. They deal with the aspects of of source control that make it truly powerful. Branching, tagging and general project organization. Often people avoid using branching and tagging because it can be confusing. But this book lays out some really good strategies for leveraging these features.

    I really liked the covering of using branching and tagging. In Subversion both of these operations are are performed using the same “svn copy” command. If both of these logical operations are performed using the same actual Subversion command, then why would you need to use both? Well these chapters answer this question well, for example, by laying out the use of tags to demarcate longer-running bug fix session for easy merging into the trunk or a release branch. I found these chapters to be the most interesting by far to someone who has used Subversion for a long time, but maybe hasn’t utilized it to it’s fullest extent (*ahem* that would be me probably).


    Pragmatic Version Control does a great job of walking through the day-to-day tasks of using Subversion on a project. It covers the basics of updating, merging, committing, etc. It also offers some really good advice on branching and tagging (and the reasons to use both) for releases as well as for development reasons such as bug fixing. It also covers things such as dealing with vendor branches and dealing with shared projects by using svn:externals references to import other projects into your main subversion project.

    There is also a version of this book written for CVS users. I’m a big fan of Subversion and so I would recommend any CVS users to seriously consider moving to Subversion. There is a great script cvs2svn that handles converting a CVS repository into a Subversion repository. It does a great job of collecting individual CVS file revisions into Subversion atomic commits. It also handles creating branches and tags for you so you won’t lose any of your version history.

    Pragmatic Version Control using Subversion – Mike Mason – ISBN: 0-9776166-5-7