Books

The Book of Lost Books

I recently finished with a library copy of this book and overall I found it quite good fun. There’s a strong emphasis on poetry but other than that it is well balanced between genre, author and reason for being lost. I learned some surprising things about Don Quixote and the Divine Comedy and the book offered a good insight into the weird Classical half-life of works that are only known to us via quotation.

With each entry being no more than six pages the book was also excellent commuting fodder being easy to pick up, put down and carry on with.

Standard
Blogging

Narcissism

One of WordPress’s really interesting features is the way it easily tells you what people were looking for when they came to your blog post. In some cases you feel rather sorry for the searcher, who, you suspect, would have been rather disappointed in your tangential views. In some cases (particularly on the technical posts) you think: “Christ, you just want to know that?”. Almost immediately you have a desire to blog the answer.

Which I guess ultimately the point. Since normally the only way to judge reaction is by comments the blog stats are another way of encouraging you to keep on writing and provide a bit of inspiration if you’re flagging.

Standard
Swing

MVC for Swing

Although I have tried to use MVC for Web applications (where to be frank I implemented a greatly simplified version of Struts without realising it) I have never been quite sure as to the benefit of doing so in a Swing application nor exactly how if I am honest.

Now though I have much more incentive to learn how to do it properly. The introduction of the excellent GUI builder Matisse in NetBeans means that it is incredibly easy to knock up a Swing GUI quickly. However to really get the maximum benefit I can see that it is important to separate the actual implementation of the underlying logic of the application from the generated code. This was exactly the problem that used to occur with Forte, JBuilder and Cafe. You would have a big wodge of generated GUI code and then an unrelated and unmanaged block of application code that often had to reside in the generated GUI code to make.

In addition I have also comes across an incredibly obtuse MVC implementation at work. This reminds me of my own attempts to implement MVC for web applications. You kind of know the principle but you’re not sure what that translates to in terms of the concrete classes and code you have to produce. I don’t personally believe in spending a lot of time bringing existing code up to scratch where you know the underpinnings are not strong. It is easier and probably better to look at what the code is meant to do and then implement that correctly rather than end up painting yourself into a corner by trying to reconcile the purpose of the code with its current implementation.

To help my understanding of MVC in a Swing application I therefore want to have a very simple reference application I can use to build up my understanding of how such an application should work and be implemented. I’ve chosen to do a very simple ToDo list application based on the Google ToDo list plugin for their Desktop app. This would be handy for me personally as I need such an application and also removes a lot of the issues with designing the application by providing a reference for the behaviour.

Next step then a few uses-cases/activity diagrams and a class diagram for the model.

Standard
Theatre

Market Boy

A trip to the National Theatre to see Market Boy (just before it closes). I always enjoy it when the NT puts on a bit of show and from the moment a Ford van is driven on stage I’m sold. The play itself is okay, standard themes set to a confused melange of 1980s moments that has nothing to do with actual history.

One thing that seems to cause perpetual problems for theatre companies is representing teenagers. In general what you get is some twenty-something hamming up a grotesque. No difference here, but this time the dialogue isn’t a help either. If you’re not 100% how teenagers talk then don’t try to write them. Shift the age five to seven years forward and save everyone the embarassment. Nothing in the script required a teenaged protagonist.

The supporting cast were great with good turns from Gary McDonald, Paul Moriarty and John Marquez; all of whom made the show for me.

Anyway aside from the show I’d just like to say NT and Tincan Ltd. congratulations on combining forces to produce a genuinely shit website. Now, having shown us that you can do it can you get something decent together that makes it is easy to find information on productions and, god forbid, buy tickets for them?

Standard
Java

Inter-Package Inheritance

Or rather Inter-Package Inheritance Part 2, as last time I got caught up in my circular dependency WSAD rant. So what does Inter-Package Inheritance allow? As far as I can see; bugger all. After all if a package in a collection of coherent functionality then how on earth can separating the implementation of something across multiple places be good?

But on the other hand what harm can it do? Well firstly it makes it bloody hard to find out what is happening with a given piece of code in the usual inheritance way. Namely which method is actually executing, which variable is getting updated and are those the methods and variables that should be getting touched. I also find it particularly hard to have to trace up a hierarchy of three classes just to find out what the full set of variables a particular object should have.

But the killer feature that Inter-Package Inheritance has over normal inheritance is that once you’ve made an unfinalised class with protected instance variables and methods accessible then practical refactoring is a nightmare. The root class can be in use anywhere and is effectively lava-flowed. The inheriting objects are similarly rooted as even though they may represent discrete functionality they always need to be able to read their parent objects.

This has had some weird implications in my current job (for example because there is a dependency on the GNU Regexp class somewhere in the “common” code all the projects need to import it into the classpath, even if they don’t use the class or the package anywhere else) but also lead to my circular build wreck. I moved the factory but the objects it served out had to stay in the lava flow because their parents were (incorrectly I may add) in the EJB layer. This lead to a dependency circle where the factory (in the business layer) depended on the EJB layer which depended on the factory. In addition the client layer (which resides in the shared object layer, natch) also depended on the factory and the EJB layer also depends on shared layer.

So what does this gibberish mean? Well everything basically bloody depends on everything else. and the most frustrating thing is that this has all arisen because someone wanted to inherit a few instance fields rather than encapsulating and compositing them like normal.

Actually I say like normal but this seems a relatively common kind of problem so I turn (by the power of Safari) to Fowler’s Refactoring for advice but he doesn’t seem to have a magic bullet. I can see the problem but collapsing the hierarchy is probably going to be major work because the package hierarchy is not just split between packages, it is also split between ClearCase/WSAD projects one of whom is read-only in the normal composite stream.

The answer perhaps lies in doing some selective duplication in the supporting business layer. Creating objects to represent the inherited instance values, one root class to provide the default class implementations that may be required for backwards compatibility and then switching the affected classes to use these new objects that exist in their own project space (or at least in their immediate project space). Still this is not a trivial change that you can skip past the management one Friday afternoon and that means some kind of detailed plan of action.

I always feel that if you present a correction plan and it gets turned down then you’ve done your professional duty (and covered your arse if you are so inclined) and you can carry on with a clear conscience. Here though there are so many things wrong in so many areas so corrective action may need to be taken sooner rather than later.

Standard
Blogging, Web Applications

WordPress versus Blogger

Blogger may be the original but even after a short period using WordPress I am starting to feel it is far from the best. The first thing to impress was that WordPress actually seems to generate decent HTML rather than Blogger’s colossal fudge of a single paragraph with line breaks in. This extends to the editor which I think is far easier to use than Blogger’s equivalent purely because it is closely linked to valid HTML which allows things like the Path bar to tell you exactly where you are from a syntax point of view and allowing to avoid formatting issues due to tag soup.

WordPress’s idea of using categories to divide a single blog rather than Blogger’s multiple blogs per account is a less clearcut idea. On the one hand it is really convenient because the tags serve multiple purposes as they help categorise but they also help publicise your posts. On the other hand I would like some threads to actually exist in a separate blog with different templates and settings (say) but which I could still control through the same dashboard.

One feature that really surprised me was that WordPress offers far better searching information both about people visiting your blog and which posts were popular. This is really Google’s bread and butter but Analytics is way overkill for just running a blog.

Another thing that surprised me is that far more people visit and read my WordPress blog than my blogspot ones. Checking with a few searches seemed to tell me why. The Categories first of all drive a certain amount of traffic but the real answer is that Google’s PageRank does not seem to do all that well with blogs at the moment. If you look at most of the blogging search sites then they tend to work on the basis of returning everything about the keywords you’re using, matching them as closely as possible rather than trying to make a judgement about how popular they are.

With the Blogspot searches going off how many links there are to a post it skews the searches to the more popular blogs or listings and not those that match your interest most closely. Until someone introduces a Digg style way of rating blog posts popularity in terms of linking does not seem a good judge of whether the posting is relevant or not. If I want to search for posts on say Tube station names then I want to see posts actually about names before, say, a popular blog about Tube Stations in general.

Anyway the upshot is that WordPress is currently my fave of the blogging tools and has a distinct edge on its rivals in all areas not just a couple. Google really needs to give Blogger a kick up the arse because as a company it is way behind the standard the other Google purchases are at.

Standard
Macbook

Faint Alarm at Myself

I accidentally switched on Photobooth while beavering away and was suddenly confronted at no less than myself. It’s kind of like a mirror but the sudden appearance just gives it a shock value. What’s that on my screen? My god it’s me.

Standard
Macbook

Where has all the WiFi gone?

Wandering around with the MacBook I have been disappointed at the lack of free WiFi to tap into. What’s going on when even in a community arts centre I can’t get no love and in the AnonymousBusinessHotel you have to pay a fiver a day for the internet connection and then when you do it comes via cable rather than over the glorious ether.

A lot of people don’t see the point of free internet access but I think Google has got the right idea by focussing on places like airports where there is an enforced idleness anyway. Once you’ve done the round of shops there is nothing to do but wait. The chance to jump on the web and be active again (in both mental and commercial meanings) is something I would really welcome and I can’t wait for free wifi to permeate all travel including trains.

I was reading in Computing something about constant connectivity on train carriages, but to be honest I’m not seriously interested in streaming material on the move just having the stateless web access would be a serious move in the right direction.

Standard
Java

Oh, The Hip Bone is connected to the Thigh Bone

Okay so we know that inheritance is bad and that inter-package inheiritance is even worse but just because you know that doesn’t mean that you don’t have to deal with it. The latest Gordian Knot at work is project dependencies within WSAD projects but the root cause is, I suspect, a dangerous infatuation with inheritance as a solution for everything.

The problem I had was trying to share functionality between an EJB client and server layer. Logical solution: introduce a new project that contains all the common functionality and simply make the existing projects use that as a dependancy. However the pervading view of “nothing new” that afflicts my workplace got to me and I decided instead to try and just massage the functionality of the existing projects.

When I merged my work in ClearCase the .classpath file blew up and wouldn’t parse. Since these files are “secret” Eclipse project files it can be bugger to get them back into a workable state. In this case I could get the file to be to be valid XML but it still wouldn’t work (probably because it couldn’t reconcile to something else in the Workspace like the Project Set or the project file). In these cases I’ve always just created an entirely new classpath file for the project. In fact having your project files blow up can be a good chance to see what exactly your code does and doesn’t need.

Having the classpath blow up can be a huge warning sign as well. The project I work on has about 5000 to 20000 warnings depending on the level of concern you want to set. Usually I like to work with very strict warning levels but in this case it did me no favours because after I reconstructed my class path I completely failed to notice the significance of the circular build warnings that appeared.

Visually this is a major flaw in WSAD, a circular build dependency is actually a bigger issue than an unused method parameter but visually they are identical in the WSAD Task pane. I am also a little surprised that it is only a warning.

WSAD can resolve the dependency by stacking build requests; building one project until it gets a dependency then building the dependent project until it gets another dependency then asking the original project to be built and then unwinding the stack of building requests. It adds a little extra time to the full build time but compared to the huge amount of time required by a full enterprise build it is very hard to notice any change and in fact it seamlessly resolves most project linking issues allowing you to be very generous in creating project dependencies and using larger workspaces.

My problem is that there is a headless build script that is used during the construction of an application from a given ClearCase baseline and this headless build (despite being nominally an identical process to the WSAD GUI build) cannot seem to stack build requests in the same way and thus the circular dependency kills the build script. The pain of WSAD headless builds is a topic for another post but the script’s failure introduces yet another dependency as the build script is now defining the structure of the projects in the application. If the build script cannot work with the changes you make in WSAD then the code overall is deemed to fail.

This is more process than technology but it still adds to the general sensation of being more of a magician spinning plates when working with large, legacy EJB apps in WSAD than any kind of professional programmer.

Standard