Saturday, December 20, 2008

"Doing It Public Domain"

I've put up another blog that will likely have the same fate as most of my other blogs: A slow death. :]

At any rate, here is the link if you are interested:
http://doingitpd.blogspot.com/

This blog will follow my efforts to help the public domain advocates among the Open Street Map community to put up (and collaborate on) a public domain date repository.

The Sunburned Surveyor
Posted on 10:31 AM | Categories:

Thursday, December 18, 2008

Google's Guide To Writing Testable Code

From Jon Aquino's blog comes this post about Google's guide to writing testable code. I skimmed over the first section "Flaw #1: Constructor Does Real Work" and it sounded logical to me.

I thought I would share it with others, in case you aren't reading Jon's blog (and you should be):

http://misko.hevery.com/code-reviewers-guide/

The Sunburned Surveyor
Posted on 3:57 PM | Categories:

Distributing GIS Data: Best Practices

My friends in the great white north (Canada) are really way ahead of the game when it comes to GIS. They did fund the development of JUMP, after all, and they are at it again. They've released a guide to the dissemenation (or distrubution) of GIS data. This is another document I hope to read when I get some time.

I wish the federal government in the United States would release such a comprehensive policy document.

Here is the link to the PDF:

http://www.geoconnections.org/publications/Best_practices_guide/Guide_to_Best_Practices_Summer_2008_Final_EN.pdf

The Sunburned Surveyor
Posted on 12:07 PM | Categories:

WGS84 Technical Report

Here is a link to a technical report from the National Imagery and Mapping Agency that talks all about WGS84. (World Geodetic System of 1984):

http://earth-info.nga.mil/GandG/publications/tr8350.2/wgs84fin.pdf

I hope to read trough this report on one of my upcoming vacations, since WGS84 is such an important part of what I do as a surveyor and GISer.

The report looks like it can be understood by most people, without a need for an advanced degree in mathematics or rocket science. :]

I hope others will find it useful.

The Sunburned Surveyor
Posted on 12:04 PM | Categories:

Rethinking The Refactoring (Incremental – Not Monumental)

I’ve been thinking a lot about my earlier idea for a major refactoring of OpenJUMP. I’d really like to accomplish all of the goals mentioned in my blog post on the idea, but I’m questioning my original approach.

I thought I would start with a blank slate, and then move code over from the OpenJUMP core as I refactored and cleaned it. There are two (2) problems with this approach:

- I wouldn’t have a running program while the refactoring was in progress.
- I’d have to lock myself in a closet for at least three (3) years to get this done.

I believe an incremental approach to this refactoring would be more productive. I can slowly perform my refactoring of the core, making sure that I have a running build each step of the way.

This would allow me to accomplish a couple of things:

- I get to stay out of that closet.
- I get immediate feedback on my refactoring efforts.
- I can’t mess things up so bad that the core never builds. (That is a definite possibility given my track record.) :]
- Other users and programmers can give the new core a spin if they wish.

I may think about this some more, but I feel like the incremental refactoring may be better than the monumental refactoring.

Stay tuned for more info.

The Sunburned Surveyor
Posted on 11:54 AM | Categories:

What I Learned From The Super Select Tool

One of the things I enjoy the most about being involved in an open source community is learning from the other programmers working on the software. Today was a great example of that, when Paolo suggested an alternative fix to a bug in the MultiClickTool class of OpenJUMP. His fix was much simpler and mind, and avoided throwing an exception to the user. His solution was also obvious, and one I completely missed. This is a very humbling experience, and one that helps you to appreciate why quality in open source software CAN be greater than that of commercial software.

I also find that I am getting better at learning from my own programming mistakes. Let’s consider for a moment, what I learned from my Super Select Tool plug-in for OpenJUMP, which really turned out to be quite a disaster.

The most valuable lesson I took away from my experiences with the Super Select Tool is that simpler is better. I realize now that I just tried to do too much with the tool. I wanted to enable the user create “sticky selections” and also send selected features to a designated layer with a single click. This was really two (2) tools in one. The worst part of this was that one of these tools already existed! It is quite easy to paste selected items into another layer in OpenJUMP, and no separate tool was needed to do that.

My second mistake was to over configure. I realize now that it is often better to create a tool with default behavior then it is to create a tool with behavior that can be configured by the user. This makes the tool design much simpler. Everyone, including the user and the programmer, knows what to expect.

For example: My original incarnation of the Super Select Tool allowed the user to choose if the selected features in the source layer(s) would be removed when sent to the destination layer. Why would I add this ability? The behavior is a little invasive/destructive after all. The user could have easily deleted the selected features by cutting them after selection and before pasting, instead of copying.

Here is another example: I allowed the user to decide if they wanted to copy attributes in addition to feature geometries. Why do that? If I copied the attributes by default the user could still delete them from the layer later.

All of this over-configuration led to more complicated code (can’t you smell all those switch statements) and the need for a configuration dialog.

I know there is a balance between default behavior/configuration. One end of the spectrum is incredibly rigid software, while on the other end is incredibly complex software that is hard to use and maintain. I’m still trying to figure out when it is good to allow configuration, and when you should instead stick to a good default behavior. For the time being, I think I’ll lean towards the default behavior end of the spectrum.

Had I chosen a simpler design for the Super Select Tool, it would have been finished months ago. It would have been easier to install, use, and maintain.

But the effort wasn’t a complete loss. I learned a lot about OpenJUMP’s selection mechanism, about cursor tools, tool boxes, and I wrote some nifty I18N code.

I’ll be reworking the Super Select Tool. This version of the plug-in will be much simpler. It will just enable “sticky selections” and will only have three buttons. No configuration dialogs, no configuration files, and only a single jar to drop in the /lib/ext folder.

Lesson learned.

The Sunburned Surveyor
Posted on 11:35 AM | Categories: