Saturday, January 8, 2011

Grails, IDEs and productivity


The following opinion might do you harm, offend you or your colleagues or might seem like a talk of a crazy man. Below way of proceeding with daily job is just one of many, probably as many as there are developers out there.

You have been warned!

It all started a long time ago

A long time ago there was Turbo Pascal. It had (as for those old times) an amazing IDE where you could write and debug code and if you made a typo the IDE would tell you immediately that you made a mistake. It had yet another property: it was blazing fast even on those old PCs.

Microsoft VisualStudio, Delphi and Java IDEs

After some time the era of graphical user interfaces kicked in. Environment for programmers started to grow and grow and grow... Especially those for Java. What they brought to the table was supposedly productivity enhancements. One would code faster by use of wizards, code completion, squiggly lines and other "gooye" goodness...

Everything comes for a price

Since those IDEs at the very beginning were quite simple they started fast. PCs were getting faster and faster every year so even if the startup time was around 20 seconds it'd still not be a problem because the next year it'd be down to 3-4 seconds and life would be good again.
The only problem with that was that the next year's release had even longer startup time and this tendency didn't seem to stop until today.

Rational developer point of view

Imagine a situation where all you need is to change 2 lines of code, run the tests and be done with it. What would it take to do this in an IDE like Eclipse or NetBeans and how would this look like when using a less sophisticated tool like let's say TextMate.


Ok, so let's start Eclipse. It's actually a good thing it starts so long because I can go and make myself a coffee before it's ready to work. Oh! but wait! Starting is not everything! Since those brainiacs that created Eclipse thought that it's actually better to delay loading stuff you don't need at first it is actually not only the startup time but you need to add to this a long long time for every window to pop up the first time. Not to mention that the PC I'm running on is quite a powerful one (2 64 bit cores @ 2.8GHz each, fast HDD, lots of ultra fast RAM) Well, most games (and those were the applications that demanded the most of hardware) work like a charm.
Code completion, the biggest hype of all the features in modern IDEs, seems to work only with dull, very formal languages. There's a reason for that: dynamic languages tend to change the behavior of existing code in runtime so there's no way to properly predict what will happen in this particular place in code.
Take Ruby or Groovy for example. Eclipse is doing a pretty good job in giving you hints on what's available but it still is not powerful enough to support some of the nice features like Mixins for example.

NetBeans 6.9.1

The story with that one is exactly the same as Eclipse but worse. Imagine to wait for over 40 seconds just for the list to appear so that you can choose what you want to call. NIGHTMARE!!!

Visual Web Developer 2010

One nice thing about this IDE is that it is focused on one task, and one task only: building web applications. To that end there's no Windows Forms designer built in to slow down the IDE when I don't need it. There's also this one and only (best of breed my friends) JavaScript editor that recognizes extension patterns in many libraries (like ExtJS or jQuery) and provides intelli-sense for them. Let me tell you: it's a F1 car to work with JS!
Unfortunately many of the other things from Eclipse and NetBeans still apply. Startup time is longer and longer with every version and PCs just don't catch up with it.

The worst nightmare: Delphi

Imagine saying that Eclipse, or even NetBeans, starts in no time by comparison. The Delphi 2009 startup time was around 1.5 minutes!!! I mean come on, guys! What were you thinking when you allowed such a piece of crap to see the light of the day?

TextMate to the rescue

These days it is very common for the actual tooling support to come together with a particular library. Take Ruby on Rails or Grails for example. All you need to do is to install the thing and have an editor with contextual text highlighting so that you can see better what's going on. Hell, you can even code directly in the browser!
I took TextMate as a general-purpose example but the same holds true for most of the other plain text editors. Vi, Vim, Emacs (ok, that one is a hardcore one :)), Gedit, Midnight Commander's editor, Far Manager 2 with Colorer plugin... You name it! And like I mentioned before, the code completion itself once you're productive in a platform will only slow you down.
You might say: and what about debugging? Well, as the good uncle Bob said "you don't! what you should do is to create unit tests to see if it all works as expected". But that's a topic for a completely different post...

Is it really all lost?

Ok, so let's give the IDEs some credit they deserve. I do use them, from time to time, when what I need is to do some refactoring, especially to rename classes in files. The process is just too cumbersome to do it manually. I've seen people do some pretty amazing things with Java code in Eclipse too. I guess at some point it becomes like a second skin for you... I prefer to go "naked" :)


When you go to see a doctor and tell him that when you bang your head against the wall then the head begins to hurt what he'll most probably say is "Don't do it". So if you'll ever find yourself complaining about the speed of your IDE try some alternate approach. You'll be amazed what productivity boost it will bring after just a few days of "getting used to". Remember: chemistry doesn't happen over night :)


Wanderson Santos said...

Just use IntelliJ IDEA 10 and be happy ;-)

You can get it for free (with all Groovy support) or you can pay for the best Grails IDE out there!

Matthias Hryniszak said...

Idea costs lots of money - the other options are for free. But you already know that :D

sit1way said...

Springsource Tool Suite 2.5.2 is excellent for Groovy & Grails and free.

Textmate, yuck, don't you want/need autocomplete? Any decent IDE will help you produce code far quicker than a text editor (yes, Textmate is king of the text editors). Also, for Grails devel, built-in console, commands (create domain, controller, etc.) plus refactoring and mix/match Java with Groovy, all without doing any custom setup.

Happy as a clam I ditched my Mac systems and picked up a quad core SSD laptop running Fedora, yahooooooo, no mo' Mcdonalds Linux ;--)

Matthias Hryniszak said...

I'd like autocomplete that works but due to the sole nature of dynamic languages it is plain impossible to do that as proper as it is with static languages like Java.

For Java you absolutely need an IDE - it's by far the most verbose language ever :( and without proper help from IDE it is just tough to do anything.

With Groovy and Grails it's more about the "what" than the "how" so I'm happy to code without an IDE like STS or the like :)