Pages

Tuesday, April 13, 2010

Data encapsulation for tools

One of the nice things about java is a the abundance of additional libraries that are available.
I'm currently working on mapping software and thankfully, there is an open source library that handles most of the work.
The first task I've been given at my new job is to allow users to upload some files that puts an overlay on the map. Fortunately I just have to provide the glue between the app and the library that does the mapping.
Except...
I don't have complete control over the tools.
The tool provides an XML parser which has a private member for the handler. It is this handler that is given the contents of the file and passes around some values to construct geometries. Under some circumstances, this handler doesn't do what I would want it to do.
In the perfect DI world, I would just hand this parser the handler that I want it to use.
Because it is private, I have to use reflection to change the value of the handler in the parser after its construction.
If the member was protected, I could just extend the parser and change the value of the handler and I wouldn't feel so dirty.

I'm interested in input though, what is the value of "private" in a tool. Should the tool creator limit what can be achieved?

Saturday, April 10, 2010

SVN is stupid and so am I

Just want to have a quick rant about subversion. Most places you see the SVN is the replacement to CVS and does things better but I'm not entirely sure.
I was always suspicious when branching and tagging were copying the files around on the file system. If I wanted to make those sorts of copies, I'd just do it myself.

This bit me yesterday when I wanted to change what branch a particular directory was checked out as. I couldn't just say "This folder, be this branch" I had to say check out this location of SVN to this location on my disk. The first time I tried, I almost checked out the whole alternative branch into the particular folder (not what I wanted).

I know that flexibility = power.
But sometimes I like it when design stops you making mistakes like that.