After 18 years of programming, I was considering a job switch. I know some who started their own businesses; anything from running a used car lot, to carpentry.
My job at GE in 2003 went the way of the dodo; it became extinct. Meanwhile the same job mysteriously appeared in one of the GE subsidiaries located in India. I don’t blame India, it’s part of our economic evolution. The key to survival is the lowest price… or is it?
Now it is different. I have my pick of jobs, we are looking for good developers and it is hard to find any. That is to say: the job market for programmers appears to be back.
I remember when I worked for GE, at one meeting the CTO was bragging how it was such a great market for talent and “we should buy low”. Referring to salaries.
I don’t know if he bought any loyalty. Buying low even when it seems like an economically sound theory, may cost more in the long run when your programmers, dissatisfied after a long bout of salary abuse, decide to leave.
That leaves the managers holding the bag. After all the hardest resource to replace is the one with the brains.
So next time the market is ripe for hiring developers at some fraction of their value, try looking at loyalty as part of the package. Pay them enough to keep them when the market inevitably rebounds.
I’ve been using Castor for the last 3 years as my Java/XML Binding tool of choice. I’ve been able to use Castor’s Ant SourceGen task to generate POJOs that I can marshall/unmarshall to/from XML. So far, the Source Generator can handle complex XSDs that include other XSDs, type substition, extension (inheritance), and so on. Overall, the validation works pretty well. The Source Generator creates all my POJOs that use XML, so this layer of my application is completely automated.
On my current project, I can receive an XML request document that hase multiple possible root elements, so I can’t know ahead of time which type of object to use for unmarshalling. But Castor lets meconfigure the Unmarshaller ahead of time with the Java classes I’m expecting. Then, I can just do an unmarshall, check the request type, and process appropriately.
My code runs inside a Servlet that takes an XML Request, unmarshalls it into POJOs, invokes a backend service, and marshalls an XML Response in the HttpResponse. I had some trouble with the Servlet until I remembered to close() the PrintWriter (which wrote the XML text to the HttpResponse) and to set output to text/html and use UTF-8 encoding.
I use HttpUnit to send XML requests over HTTP and check the response (also in XML). HttpUnit works as if you were entering requests using a brower. But HttpUnit fits in nicely with an automated build environment and Continous Integration.
I’ve only had a couple of problems with Castor. Castor’s validation works reasonably well, but it lets me use an invalid date format for an xsd:dateTime. I also can’t use Spring XML Bean files to populate Castor objects because the Castor-generated objects don’t follow the JavaBean rules for collections.
Despite these minor drawbacks, Castor is easy to use and its code generator saved me a lot of time when I had to change my XSD schema.
What’s been your experience with Castor XML?