Tuesday, January 15. 2008
Cruise Control and Ant: OMG, XML DSLs... WTF?
I've been playing with Cruise Control and Ant, trying to get a reasonable Continuous Integration server up and running. For those that don't know, a Cruise Control is a server that takes your source code, and tries to build it until you hit the big red stop button, or the heat death of the universe. Ant is a piece of software that performs the actual building of other software.
And by the time the heat death of the universe arrives, I think I may have it all working, and in a semi intuitive way.
To set up Cruise Control, and Ant for that matter, you need to use XML. XML is an alright, if not exceedingly and outrageously verbose method for describing in excruciating detail data, as well as meta-data—which is to say—data about data. (Whew!) The thing with XML, is that it is a flaming shit sack of metric fail when it comes to describing processes. Processes like the building complex bases of source code, executing them on very finicky server software stacks, launching automated functional tests against them, with each process (build, execute, test) running in its own separate virtual machine are a royal pain in the ass to describe in XML. Again with the flaming sack of fail.
I find it very fitting that in the top 10 search results for fail, Ant documentation comes up.
Ant was built to fulfill a very specific need, which is, to help the process of compiling and bundling Java software together. It does an alright job at this, not stellar mind you, but alright. If you happen to be doing exactly what most other Java programmers are doing, deploying roughly what they are deploying, then you could do a lot worse then Ant. But the second you add any kind of complexity into the pile, it starts to show its warts. It's like playing with a plastic lightsaber; it looks great when you are just waving it around in the dark, but once you actually hit something, sparks don't fly, it just goes snap and it ceases to be any fun. Now you just have broken plastic.
The problem with Ant, Cruise Control and building software in general, is that the process is not linear. While it may be useful to have a descriptive language like XML to describe dependencies between Java files, it is absolutely horrific if you need to do things like conditions (if the build failed, then send a nasty gram to the developer and a 50K volt shock to his chair) or do complicated actions (munge this file to make it actually XML).
A lot of its complexity lies in its dependence on XML as a Domain Specific Language. To make a human languages analogy, it's like learning to speak Esperanto in order to practice Zen Buddhism—one perhaps feels that if they just took up Japanese instead, they might have gotten the job done a lot quicker, with less mucking about.
What strikes me as absolutely insane about Ant, is that when you have a reasonably hard job of working some behavior into your build script, solutions like "run XSL transformations on your Ant Script to give it behavior" are floated about, all with seemingly a straight face.
All in all these are good tools if you want to look like you are working, and enjoy tinkering around with XML, but if you are working towards the goal of building rock-solid, stable, testable software that in any way deviates from the norm, with the intent of releasing a maintainable, easily understood system in a reasonable amount of time, well, that tool isn't built yet (to my knowledge). Rake, being a ruby build tool written in ruby, might be close though.
A good Build Tool would be one that looks similar to, or is just an extension of the language you happen to work in, thus making the entire concept of a separate integration server redundant. Instead of having to bundle the build tool with the integration server, you end up allowing the user to write (in relatively few lines of easily abstracted code) the loop which is the crux of the Continuous Integration server inside of the build tool.
I bet it's built in Scheme.
And by the time the heat death of the universe arrives, I think I may have it all working, and in a semi intuitive way.
To set up Cruise Control, and Ant for that matter, you need to use XML. XML is an alright, if not exceedingly and outrageously verbose method for describing in excruciating detail data, as well as meta-data—which is to say—data about data. (Whew!) The thing with XML, is that it is a flaming shit sack of metric fail when it comes to describing processes. Processes like the building complex bases of source code, executing them on very finicky server software stacks, launching automated functional tests against them, with each process (build, execute, test) running in its own separate virtual machine are a royal pain in the ass to describe in XML. Again with the flaming sack of fail.
I find it very fitting that in the top 10 search results for fail, Ant documentation comes up.
Ant was built to fulfill a very specific need, which is, to help the process of compiling and bundling Java software together. It does an alright job at this, not stellar mind you, but alright. If you happen to be doing exactly what most other Java programmers are doing, deploying roughly what they are deploying, then you could do a lot worse then Ant. But the second you add any kind of complexity into the pile, it starts to show its warts. It's like playing with a plastic lightsaber; it looks great when you are just waving it around in the dark, but once you actually hit something, sparks don't fly, it just goes snap and it ceases to be any fun. Now you just have broken plastic.
The problem with Ant, Cruise Control and building software in general, is that the process is not linear. While it may be useful to have a descriptive language like XML to describe dependencies between Java files, it is absolutely horrific if you need to do things like conditions (if the build failed, then send a nasty gram to the developer and a 50K volt shock to his chair) or do complicated actions (munge this file to make it actually XML).
A lot of its complexity lies in its dependence on XML as a Domain Specific Language. To make a human languages analogy, it's like learning to speak Esperanto in order to practice Zen Buddhism—one perhaps feels that if they just took up Japanese instead, they might have gotten the job done a lot quicker, with less mucking about.
What strikes me as absolutely insane about Ant, is that when you have a reasonably hard job of working some behavior into your build script, solutions like "run XSL transformations on your Ant Script to give it behavior" are floated about, all with seemingly a straight face.
All in all these are good tools if you want to look like you are working, and enjoy tinkering around with XML, but if you are working towards the goal of building rock-solid, stable, testable software that in any way deviates from the norm, with the intent of releasing a maintainable, easily understood system in a reasonable amount of time, well, that tool isn't built yet (to my knowledge). Rake, being a ruby build tool written in ruby, might be close though.
A good Build Tool would be one that looks similar to, or is just an extension of the language you happen to work in, thus making the entire concept of a separate integration server redundant. Instead of having to bundle the build tool with the integration server, you end up allowing the user to write (in relatively few lines of easily abstracted code) the loop which is the crux of the Continuous Integration server inside of the build tool.
I bet it's built in Scheme.
Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
Ant is indeed a failure, as the author (James Duncan Davidson) admits. He has moved on to using rake, which is (as you surmise) an extension of a commonly-used general-purpose language. Ruby in this case.
I think the problem is that there's no way to extend the Java syntax to allow there to be a 'jake'. And Ant is probably at least better than make.
I think the problem is that there's no way to extend the Java syntax to allow there to be a 'jake'. And Ant is probably at least better than make.
I'm using callouts to java code to do the more complex things. ie
[java classname="org.benow.web.ResourceUtility"]
[classpath refid="compile.classpath"/]
[/java]
I am using ant for compilation, but only after the fact. Eclipse does everything during development. I also tend to do more things at runtime, rather than relying on building caches during compile time... ie lists of what files are where, what mappings are available, etc. This makes for a slower initial startup, but also means that there is nothing to get out of sync... new code changes are immediately seen, and the build scripts don't have to worry about doing the generation. This reduces the complexity of ant.
I see a similar problem with XSL. It's nice to have a language that manipulates XML well, but logical constructs (if then case variables, etc) are too verbose and difficult to work with. With XSL you can't even change a variable once it's been set... wtf. I still use it, tho, as it works well with XML.
[java classname="org.benow.web.ResourceUtility"]
[classpath refid="compile.classpath"/]
[/java]
I am using ant for compilation, but only after the fact. Eclipse does everything during development. I also tend to do more things at runtime, rather than relying on building caches during compile time... ie lists of what files are where, what mappings are available, etc. This makes for a slower initial startup, but also means that there is nothing to get out of sync... new code changes are immediately seen, and the build scripts don't have to worry about doing the generation. This reduces the complexity of ant.
I see a similar problem with XSL. It's nice to have a language that manipulates XML well, but logical constructs (if then case variables, etc) are too verbose and difficult to work with. With XSL you can't even change a variable once it's been set... wtf. I still use it, tho, as it works well with XML.
Add Comment




