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

Hello Again Identi.ca!

It seems that all the cool kids are using Twitter nowadays.  Then again what passes as cool now sounds more like either being different for different sakes.  Or that you use or do things that are “cool” or trendy or interesting to the mass public at the moment.  Rarely the cool, trendy or different thing is actually interesting or innovative or world-changing as much as it something that is well marketed.

As for myself I’m on Twitter because there are a lot of people that are not on my favourite microblogging platform: Identi.ca!  With Twitter being a bit more accessible on my Android smartphone and the smaller crowd on Identi.ca, I sort of stopped using it for a bit.  However that will change.  I prefer Identi.ca because it is libre software and my data is not held hostage in some corporation’s database.  I’ve updated my Identi.ca handle, wired up my microblogging widgets back to Identi.ca (and Twitter).  Now I plan on using it more often, and pushing my blog updates through Identi.ca first and then on to the other three popular social media that I use.  If everything goes as planned y’all should be able to read this post in a few moments after I publish it… right now. 🙂

Does Complexity Necessarily Translate Into Capability?

Two months ago I started work as a Java developer at Bluerush Media Group.  Shifting gears back into Java EE/JSP/Servlet and mostly backend work from Android development definitely took a while.  On one hand my work now is hidden behind layers and layers of servers, middleware and other “businessy” systems.  I definitely miss being able to have my work appreciated by many people.  Now only my fellow developers can compliment or complain about my work.  But on the other hand, I enjoy working with tested and tried technologies and platforms.  No more worrying about inconsistencies between devices.  No more fretting about what systems I communicate with.  No more frustrating moments of dealing with performance and optimization issues.  Instead there is more than enough computational power lying around that automation and abstraction become powerful tools to approaching and solving problems.  I feel less guilty about using some crazy library to configure itself, gather the necessary data and build part of the system for me.  In short, as with everything in life there are pros and cons to my work.

Just recently I discovered the joy of using JAXB.  It is mindbogglingly convenient to build entire packages of Java model classes from a single XML schema, and having JAXB handle the serialization and deserialization of Java models into XML and back again.   Using JAXB, some XML configuration files, a TestNG suite and some result data in CSV form, I could build out a pretty sweet and rather involved automated testing setup.  This let me run real stress tests on the application I am working on and letting me flesh out the code much faster and with greater confidence.  Or take the use of dependency injection from Spring or Guice, to help a developer initialize a large number of objects with complicated dependencies without getting lost.  The amount of automation and abstraction in Java EE is simply overwhelming.  However it does come with a price: complexity.  So while using the full power of Java EE and various libraries gives my applications a lot of capability, they also make the applications terribly complex.  It only gets more complex, the more “enterprisey” the application becomes.  There is simply no way I could even build the applications that I do, without having lots of complex tools such as a full-on IDE like Eclipse.

This brings me to the point of my post.  At same time as I delved further into Java EE, I am getting more and more interested in Python and Django.  After playing around a tiny bit with PySide building Qt apps in Python, and looking into Django I am surprised by how terse yet functional Python is.  Yes, Python being a scripted language will never outperform a compiled program (or even byte-code compiled Java app) in terms of performance.  But looking at how much computing power is available and how many more steps it takes to write a Java or other compiled source app… I wonder if programming in something like Python can not be more efficient.  What I am especially curious to find out is if one can build and maintain a large complex web app as one can in Java EE, but in Django and Python.  Basically I am curious of the capability of an app is proportional to its complexity.  Or is this just an illusion from living with a language and platform that lets you easily craft monolithic monsters?  Can one get the same results with good architecture, some smart engineering and a flexible language?

Happy Easter! He is Risen!

I’m on vacation at the moment.  But I want to wish everyone a Happy and Blessed Easter!  For those of the Christian faith, this weekend is an incredible and potent reminder of God’s sacrifice for our sins, and the Resurrection: the reason why we believe what we believe.  Alleluia!  He is risen!  And for those who aren’t of the Christian faith, I hope you have a relaxing weekend with your family and friends.

When Penguins Can Fly… (An Exercise in Portfolio Building)

No, this is not an exercise in a delayed reaction for April Fool’s Day.  I am not that slow!  Rather I spent most of the weekend in a concerted effort to setup a portfolio and renewing my personal website.  I realize now the reason why I procrastinated to do so for years.  Setting everything up in a systematic manner is difficult and painful.  Digging through folders to find great examples of your work even more difficult.  However the effort was worth the pain.

The blog now has a unique title: “When Penguins Can Fly…”.  I think the title is appropriate considering how much of a Linux fan and of penguins I am.  At little bit of magic in Gimp and I replaced the background for the theme.  Anyone interested in using the theme for themselves, can find it here: Hacker Dreams WordPress theme version 0.1

After that and a bit of fun with the favicon, I started work on setting up the various pages and galleries in my portfolio.  It took a while to try out the various galleries, and I settled on the NEXGen Gallery plugin.  After some futzing around, I managed to setup quite a few nice galleries for the Draw section of my portfolio.  In the future I will need to either find even better art or create more artwork.  However this will have to do for now.  In addition I found an animation I did for a visual computing class that I uploaded to Youtube.

The most difficult aspect is the coding part of the portfolio.  I originally wanted to build a bunch of original apps with new source code.  Unfortunately that will take time that I do not have at the moment.  I will add those when I have a chance.  However for the moment downloads, brush ups of old work, screenshots and screencasts will have to do.

In a rare case, I am opening up the comments to take suggestions.  Please let me know what you think.