According to this article by Ned Batcheleder python does destructuring bind by default. Well, I did not know that.
RvSnoop 1.6.1
A new stable build of RvSnoop is available for downloading (it was actually released back on the 12th, but I forgot to post about it here and have been away from the internet for a few days). New in this release:
-
Added an option to republish records to different connections.
-
Added actions to export and import records to a binary file format (the records are stored in a ZIP based file, they are stored as wire format messages with some additional metadata).
-
Added an action to remove connections from the list; also, added some options to the connection list context menu to access the recent connections list.
-
Added a dialog to allow the user to configure different record types. The underlying code to support this was present in the 1.5 release, but there was no way to access it short of editing the saved project file by hand.
-
The build system no longer strips out unused classes from the included libraries. This increases the size of the download but in some cases the licenses of included libraries require this, and it simplifies the build process, which is a Good Thing.
-
Started to use the Commons Lang and Commons IO libraries from Apache instead of the utility classes that I had written myself. The next step is to start using Commons Logging instead of my own custom logger.
Christmas Gift: PMD 3.9
Just in time for Christmas, Tom Copeland has announced a new release of PMD with some notable speed increases. Hopefully this will make it fast enough to use the Eclipse plug-in in regular development, rather than having a separate ‘analysis’ phase to clean up any warts before each release.
Oh, Such a Good Infrastructure
Now that the 1.6 release of RvSnoop is out of the door (OK, 1.6.1 ‘cause of a wart inthe original release), there are certain features that I’d like to see added, and for the 2.0 release I want to have in place a foundation that will make it easier to add these. A full list of features can be found in the plan file in the RvSnoop Subversion repository, but some of the big ones that will impact the overall architecture of RvSnoop are:
Pluggable Persistence
Mechanism I’m going to migrate the record ledger to being persistent, there are a couple of options here as to how this will be handled: flat files, a combination of flat files and Lucene based indexes, or some kind of JDBC backed store.
One option would be to make the
persistence mechanism plug-able, this would also ease the use of an
all-in-memory storage system, like the one that is currently used (which
is useful when you just want to use RvSnoop as a graphical replacement
for tibrvlisten
).
Able to Run Headless
I’d like to add the ability to run RvSnoop without the UI, this would be based on loading a pre-configured project. Combining this feature with a JDBC backed store this could be really useful for auditing and logging messages.
EMS Support
I registered the emssnoop.org domain at the same time as rvsnoop.org, and there has been a project on SourceForge for a while, even if it hasn’t had anything checked in to it yet! An open question is whether to try for generic JMS support or just work with EMS directly.
User Written Plug-ins
It would be nice to be able to cleanly extend RvSnoop if required, without going back and modifying the main code base.
So, What About 2.0?
All (well, most) of these features point to a need for an extensible plug-in system, Eclipse has shown that a good way of architecting a desktop application (or any application, for that matter) is to build it entirely from plug-ins wrapped around a small core. So, the upshot of this is that I’m planning on migrating to a managed runtime, probably OSGi, for the 2.0 release. I’ll talk about this more in another post. In particular, what’s the cost/benefit ratio of using this type of runtime; and which runtimes are good?
Factory Methods vs. Factory Classes in Java
There are a number of cases in Java where I find myself wanting to use a variant of the factory method pattern. For example:
-
To control the number of objects created, or to create a limited set of objects (one per value of an enumeration for example, this could use an backed map in J2SE 5);
-
To perform some checks before creating object. Like
init()
called before instantiating instead of after.
Often my instinct here is to add some static methods to the class and make the constructors private. I think that in part this comes from the pattern name: factory method, I think a better name would have been factory class, or maybe just factory. Anyway, doing this has some advantages in that it reduces the number of classes that need writing and keeps all of the code in one place. Like the image to the right.
But there are drawbacks as well. The main one being that I cannot then treat the factory like a bean, this makes it more difficult to display in UI (by preventing the use of common binding frameworks for example). So a better approach is more like the image to the left.
Note that this is still one class short of the pattern described in the Wikipedia article. The Creator interface is just unnecessary as far as I’m concerned (although there is a case for it’s existence in scenarios like the various Java SPI-style interfaces).