Language Choices

Scripting: Groovy, Python or Ruby

I work with these three languages all the time, along with their Web Frameworks (Grails and Rails – I haven’t yet picked up Django.) Quite often I start a project and wonder, “which language should I use?”

For me each language has it’s perks and set backs….

Groovy/Grails

Groovy is actually very fast… and static typing in Groovy doesn’t make it faster… meaning you can keep the benefit of dynamic typing and reap the rewards of a very fast scripting language.  While it isn’t the same speed as Java or C, it is quite fast.   In my previous post, I compared some test scores on my Macbook laptop… The same program ran 50% faster in Groovy then it did in Python.

What I like:

  • Grails is super easy to learn and pick up
  • Quick application development (perhaps prototyping if you want to convert it later to Java)
  • It can easily import Java Jar’s and Libraries!

What I don’t like:

  • Groovy has historically been marketed towards a Java scene, excluding new programmers.
  • Groovy has a low adoption rate by developers (try and find Grails/Groovy developers.)
  • Because the community is small, Grails specific plugins lag behind Grails changes.
  • Finding private hosting for Grails apps is difficult (as it generally needs more heap size then a java app.)
  • Less faith in Grails updates

Python

I really love writing in Python.  I never thought I’d say that.  A few years ago I was introduced to Python, but I had a fear of it.  Recently I started picking it up and I found it very enjoyable.  It became the founding language to learn real programming from.  A lot of new coursework on learning to program starts with Python these days (at least from schools like MIT.)

What I like:

  • High adoption rate, can find tutorials on almost anything.
  • Lots of learning resources.
  • Language structure forces it to be “clean”
  • Great scientific community behind Python
  • Can be run on the C Compiler via Cython

What I don’t like:

  • Python 2.* vs 3.* are in separate branches (i.e. 2.* didn’t turn into 3.*) this has caused me much frustration when I find a library I want to use but it’s only written for 2.7, but the code I wrote was Python 3.  Then I have to either fix all the errors in the library, or change all my code.  It also happens vice versa.
  • I was sad to discover that Groovy and Ruby were performing faster then Python.  That was a bit of a shock to me.

Ruby

Ruby was an early language for me. I picked it up around the time I picked up Groovy.  Some of the best QA testing frameworks are written in Ruby (like Watir.)  Ruby is heavily influenced by QA and tools development, so it has a lot of community updates when 3rd party apps (like Firefox) change versions.   Rails, like Grails, is very easy to use and create applications.  Deployment options are also very prevalent (Heroku, etc.)

What I like:

  • The language is easy to pick up
  • Tons of training material on the market (like codecademy’s free training resources)
  • Lots of community support
  • Rails is pretty easy to learn and generate web applications quickly
  • Hosting is not a problem… many host choices – some free!
  • JRuby option for running java libraries
  • Ruby 2.1.2 scores really well in performance tests

What I don’t like:

  • For whatever reason, the market shows less respect to Ruby
  • Unlike Python and Groovy, there isn’t a faster compiling mechanism (i.e. Python has Cython and Groovy has Java)
  • Less scientific libraries available (which was the reason I went to learn Python)
  • Rails’ Active Record and DB:Migrations seem less intuitive then Grails’ Domain Model usages

 

While I prefer writing code in Python, after seeing Ruby and Groovy’s much better benchmarking… I’m torn.  Sure I could keep working with Python and if I need to convert it to Cython… but I already know Ruby and Groovy, so why not use a faster alternative?

Python does have some advantages with libraries.  Things like Wireshark are available in libraries like Pyshark.  I never was able to find a good mechanism to parse pcaps in Ruby, whereas Python had a library to handle it.

If libraries were not a factor, I’d probably opt to write in Ruby at this point.  Use Python where libraries are needed and Groovy as an alternative to Ruby.

Language Choices
User Rating: 0 (0 votes)