Diving into the Deep End with Python

Where I Stand with Java

Most of my professional experience in software development has centered around Java.  That should be no surprise as I learnt Java in university, and all the trappings that go with it: Javadoc, the Java Standard API, Eclipse and JUnit.  My professional work exposed me to JSP, Servlets, SpringMVC, Struts, JDBC, TestNG, Ant and the Android SDK.  Sure I’ve used other languages such as PHP, Perl, Scheme (mmm… functional programming…), C and Prolog.  The mainstay of my experience is still Java.

All that said, even as I include more and more exotic features of Java as language (i.e. enumeration, annotations, reflection, etc.) and as a platform, I find myself more and more constrained by the language itself.  Sure I feel comfortable with it, and I’ve written code personally that spans tens of thousands of lines.  However I find a lot of the code is boilerplate code.  Heck thanks to JAXB, I can quickly describe a series of classes using a XML schema.  That is right, a XML schema, one of those awfully obscure XML trappings that only enterprise application developers really should ever care about (or those working with complex document-style data).  Also a large Java codebase is nearly unapproachable with anything less than a powerful IDE.  Thank goodness for Eclipse!  (I write this wearing an Eclipse branded fleece jacket.)

Java is a wonderful and powerful language with great tooling.  However it just seems so wrong to have so much complexity.  I fear that this has more to do with the design decisions in the language itself than anything else.

Enter the Competitor: Python

I also learnt Python in university but I ended up using it largely for building system administration scripts rather than a general programming tool.  Instead of fighting with unwieldly BASH or Batch scripts for admin work, I use Python.  And I have created some powerful scripts using Python for tools for hunting down empty directories and rogue files for automated renaming.  After fighting with Java to do my bidding, I felt the need to look for some better language when building my new hobby project.  Also my recent attempts at learning Qt and C++ at the same time, have made me want to first learn the platform and then the language.  This is where Python seemed to hit a sweet spot.

While talking with one of my old university friends, Dan D’Alimonte, the topic of learning Qt came up.  Instead of using C++ for his Qt apps, Dan used PyQt.  After looking at his code, I decided to experiment with PySide and lo and behold I made a Qt app myself!  On the web side of things I heard a lot of good things about the Django web framework.  Hence I started experimenting with and investigating Python, PySide and Django.  In addition to the simple can-I-do-this-with-that experiments, and playing around with the tutorials, I researched the tooling and performance of Python based applications.

I am impressed so far with what I have found out about Python.  Coding in Python is a breeze and enjoyable.  I can comfortably use any text editor to program in Python.  I found that PyDev makes Python development while using Eclipse easy.  Getting new packages for Python is simple, and I do not have to rely on a package maintainer.  The standard libraries in Python are on par with Java’s.  You can always extend Python with a C or Java binding.  Building a desktop app using PySide turned out incredibly easy, compared to the standard C++ way of doing things.  Django is proving to be a very capable, and apparently *gasp* fast web framework especially when run on the optimized PyPy version of Python.  There is even mention of Python being able to build web frontends, at least in the documentation.  And importantly for me, Python has various XML, database layer, testing, and other enterprise and mobile capable libraries that I can potentially use in my day-to-day work.

Now naturally the quirks of a language become more readily visible once you actually start working on a real-life project.  That is my next step.  Then I can figure out if Python could really replace Java as my go-to language.  I will keep you posted once I get further in the project I am working on.  In the meantime, I’ve collected a bunch of links related to my investigation with Python.  Enjoy!

Python Related Links