Rubber duck debugging or Rubber Ducking, meet Captain Crunch!

IMG_4090How many of you do “rubber ducking“? How many even know what it is?

Rubber duck debuggingrubber ducking, and the rubber duckie test are informal terms used in software engineering to refer to a method of debugging code. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themself to explain it, line-by-line, to the duck. – wikipedia

For as long as I could remember I always had this little foam Linux penguin on my desk which provided me with answers to the worlds most difficult problems. Problems that could only be answered by the divine wisdom an inanimate object made in China could answer. This Christmas I got a new oracle of wisdom from one of my children – the Marine Corps Bobble head! I have named him Captain Crunch, those in the know will know while those that are not will not know the reference. (see, the wisdom is already coming out of him!). I am looking for a long and lasting relationship with the Captain.


Is Eclipse treating you badly, learn how to debug it!

I had an issue that was resolved in a strange way and I thought I would share it. I compile Eclipse update sites using the Eclipse IDE and the builder. I usually just delete the features and plugins directory of the site and do a Build All from the site manifest. Well, all of the sudden the site builder stopped generating the site and not to mention there were no errors. The builder progress just quickly disappeared – very frustrating.

I attempted a few basic things like clean all of the projects and nothing seemed to work. So I went into debug mode…

I set the command line to launch Eclipse to this:

D:Eclipsee-35eclipseeclipse.exe -debug -console -clean

This launched the console and put the client into debug mode. Unfortunately you don’t see much action because you need to enable some debugging on a few key plugins. You can reference this recently published article for how to enable this or you can just download this .options file and place it in your Eclipse directory – where eclipse.exe resides.

So what did I find? Well, one clue was this:

Wed May 18 19:58:41 EDT 2011 - [Worker-5] Invoking (INCREMENTAL_BUILD) on builder: FacetedProjectValidationBuilder(
Wed May 18 19:58:41 EDT 2011 - [Worker-5] Builder finished: FacetedProjectValidationBuilder( time: 2ms
Wed May 18 19:58:41 EDT 2011 - [Worker-5] Checking if need to build. Starting delta computation between: ElementTree(27) and ElementTree(32)
Wed May 18 19:58:41 EDT 2011 - [Worker-5] End delta computation. (1ms).
Wed May 18 19:58:41 EDT 2011 - [Worker-5] UpdateSiteBuilder( needs building because of changes in: org.openntf.attachmentviewe

It stated the site project needed rebuilding. So I am not sure if this directly pointed to the problem but what I did notice was the two files: artifacts.jar and contents.jar were still in the directory. I deleted those files, re-ran the build and viola – everything worked great. This seems like a problem in the site builder code, where when you do a clean it should really remove these jars – not sure about that yet.

This debug process works for any Eclipse RCP based application. You can essentially get the debug options for any plugin and put them in that one .options file to find out what’s going on.

Great tools for an Eclipse runtime

If you really want to get to know the Eclipse platform then these tools are for you.  The Preference Explorer and the Extension Explorer give you a good picture for how the system is configured.  You get a list of all the defined extensions in the Eclipse system – great for debugging.  You can also see all of the Eclipse preference store and what values and preferences the different plug-ins use.  This doesn’t mean any of this is really “public” information or documented by the component owners but it is a good way to see how other developers use extensions and preferences and what ones are available.

You also get the Property Broker Monitor and Topology Peek tools for assisting in debugging your composite applications and components.

You can download the tools from this wiki entry; which has a link to the GreenHouse place where the download lives.