Sometimes software programmers get too cute. Every time I turn around, they exercise a technique called “Information Hiding” where supposedly all those nitty-gritty details that you don’t need to worry about are tucked away in a far away method that you either don’t have access to or will take a week to discover. The problem is, when I’m debugging, I want access to everything. I don’t want to have to go read up on your little API and sort through 60 methods to find the one I’m interested and how to use it before I can continue my debugging session. I want to be able to “see” what’s happening on the other side when I invoke a method. Such is the case with Java.
I’m using an Open Source Continuous Integration Build tool called Jenkins to deploy some WAR files to Tomcat containers. All I need to do is setup Jenkins to pull in a dynamic list. To get my list in true dynamic fashion I have to go through 3 layers of programming interfaces before I can actually think in terms of one of the simplest data structures, a List.
Jenkins employs something called “Scriptler” which is a fancy name for calling a “Groovy” script. Groovy is a dynamic language that is basically a layer on top of Java with some additional features. Oh, and there are other Java plugins involved just to throw in a few more variables about what could be different between systems.
The problem I’m having is that on Apache Tomcat, with a specific version of Java under the hood, I can get my list to display properly in Jenkins. For some reason under SpringSource Tomcat, it doesn’t want to work. This line:
def line = new File(prefix + appServerType + “/” + envType + “/jvms_by_server”).readLines()
On Apache, “line” results in an array of lines snarfed in from my file “jvms_by_server”:
- mxp1 server1.mycompany.com
- mxp2 server2.mycompany.com
On SpringSource, “line” results in [big-long-line-of-all-tye-lines-in-my-file-as-a-single-element]
So it doesn’t display right.
In both situations I’m passing the exact same array back to the caller, up through Java, Groovy, Scriptler, and finally back to Jenkins — none of which I can “see”. So how do you explain how it works? In Software-speak, we call that “Fucking Magic”, aka FM.
I have no way to trace the flow of execution because everything is just a little too cute.
I miss strcat, strlen, strcmp, and strcpy and being able to visualize every character in an array from main() to the lowest level subroutine with good old fashioned gdb. Got an extra “\n” in there? Chop off your char *ptr by a character and be done with it already!
Screw FM, I want me some good old fashioned C code so I can see what the hell I’m doing!