Sunday
2 Apr 2006
Java vs. Python: XML-RPC
I am a happy programmer right now. Working at Humanized is fun for many reasons, but one thing that makes us programmers especially happy is having tools that do what we want instead of getting in our way. Over the past few months we’ve painstakingly set up an excellent development environment for ourselves, and now I think it’s really paying off. Since one of my titles is “toolsmith”, I’ll probably write quite a bit about development tools for this blog.
Before coming to Humanized, I worked at Argonne National Laboratory as a research assistant on “The Grid”. We did a lot of web-services development, and we had to use Java. The first time I tried to write a web service in Java (armed with a brand-new manual a foot thick), it took me like two weeks to make it work. I had to install Apache Jakarta Tomcat and then install Axis inside of Tomcat and then write WSDL and WSDD and learn SOAP and define data-type mappings and Java interfaces and generate stub code and link in .jars and write Ant tasks in XML to control build and deployment processes and grovel through cryptic stack traces trying to figure out what was going wrong and write posts to mailing lists asking for help because following the Apache Axis documentation wasn’t working. This was to write the most trivial, “Hello, World” level of web service, just a function to add two numbers together.
Yesterday, I tried to set up an XML-RPC server in Python. I need it for the automated test-farm (or “Test Pharm”) I’m working on. No need to install anything — the xmlrpc module is part of the Python standard library. You can write an XML-RPC server in less than eight lines of Python. You just define the function you want to make available, pass it to the the SimpleXMLRPCServer class, and give the server a port to start running on. The client is six lines, including error handling. You run the server, you run the client, they talk to each other. I looked up “Python XML-RPC” yesterday morning, knowing nothing about it, and I had a fully functional XML-RPC system for my Test Pharm about half an hour later.
I wanted to cry.
In summary: choosing Python as our primary development language was the best decision we ever made.
COMMENTS
9 Voices Add yours below.