Wednesday, November 9th, 2005


I was looking for a way to sort data in a JTable today and I very soon came upon this section in Sun’s docs. TableSorter.java is so easy to use that all I had to do was literally this:

  • press the new class button in Eclipse,
  • choose javax.swing.table.AbstractTableModel as the superclass (parent),
  • fill in TableSorter as the class name
  • click Finish
  • replace everything but the package statement at the top of the new java file with the contents of TableSorter.java

Voila. Took way longer to type this description than it did to actually do the work.
After that I changed the few lines of code as they describe. I ran it and tested it out, then I went back to figure out what I’d done. If you read the Sun documentation you’ll get a lot of what I did. I also had the GoF (Design Patterns: Elements of Reusable Object-Oriented Software) next to me though. So I looked up the Decorator Pattern.
To paraphrase (I don’t have it next to me now), the Decorator Pattern allows the developer to add functionality to a class without subclassing. Instead you write a sort of intermediary that exposes the same interface as the class you want to augment but with a couple extra features or methods.
Read the rest of “The Decorator Pattern and the JTable”…

Very insightful piece by Kurt Cagle on the long tail. Great read even if you think you’ve got the general idea of the long tail already.

Here’s an interesting statement he makes on applying standards:

What this points to then is a point that standards developers themselves should take away with them - it is not necessary for a standard to be highly technically sophisticated, and indeed this may very well work against the adoption of the standard (which will take place first within the tail, not the head). It should rather be sufficient that it can be adopted (with some effort perhaps) by tail companies. It also points out that it is generally not in the best interest of tail projects to eschew those standards, as this effectively cuts them off from intercommunication with a “majority” of the tail.

It made me think, and it’s a great way to explain why I like XML and not YAML.
Read the rest of “Considering the Long Tail and Web Standards”…