Encountering Tapestry

May 6, 2007 § 4 Comments

Recently I’ve been a on Java web app project, using the framework Tapestry. I see this as a good fortune; I’ve been wanting to add it to the list of Java frameworks I had used in anger (Webwork 1 & 2, Spring MVC, Struts 1.x, Turbine).

So what does a new end-user think of this tool? Well rocking into the team I could immediatley see there were pained faces of exasperation. I should point out I try not to condemn a tool/technology based on the opinions of the majority. I find that developers as a collective are often too quick to attack tools before investing an appropiate amount of effort into learning how to use them properly.

However, these faces were very pained. There seemed to be a consensus that Tapestry had a very steep learning curve, and once you tried to do something a little more challenging (for example editable / sortable / paging tables), things got tricky, and Tapestry, God bless its cotton socks would hinder rather than help. To be fair I should point out that none of us knew Tapestry inside out (although strangely people admitted to having 1-2 years experience with it).

Interestingly, Tapestry has a large community, some books out about it, and is still under development (unlike the peculiar framework Turbine, which some people actually think was an academic experiment). Tapestry even had a solitary advocate amongst our fairly large dev team (although to be fair I suspect he employs this role out of a good natured humour). Reading a blog such as this, you can clearly see the divide this framework can induce.

I will mention now I’m using Tapestry 4.0, and it’s moved on to Tapestry 5.x which I believe is heavily annotation based (a good thing IMO, if it reduces the amount of needed XML).

So, I’ll mentioned the niggles I experienced first. The first thing I noticed whilst at the foot of the learning curve, was ‘Wow, you have to modify a Java class, XML file, and a HTML-with-Tapestry-syntax file just to add something to the page?’ I found it odd that to see what’s going on you constantly had to switch between these three files. Then the Java Page and Component classes were all abstract, which had led to a lack of testing and more head scratching.

Later, I discovered that Page objects (the perhaps nearest equivalent of Struts, Webwork actions and Spring’s controllers), are pooled, and don’t get cleaned up by Tapestry when they are re-used for each request. A developer unknowing this put state in the page class, causing a bug where two people interfered with each others search results in production. Personally I think this is an accident waiting to happen with Tapestry. I appreciate the feature (or lack of) the other frameworks have where you get a nice new clean action-object to play around with each time.

Another problem I had was with the component libraries. Being a component based framework, the community has chucked in additional components than from what you get out the box (In Tapestry it’s called the Contrib library). There’s a fair bit of deprecated stuff, and you get a feel for the less restricted evolution of this contributed library. In our case we used these contrib components in order to add checkboxes to a table. This was a difficult feat in itself with Tapestry, with quite a few twists and turns, but made worse when there are two classes with almost the same name – IPrimaryKeyConverter and IPrimaryKeyConvertor. Unknowing this I spent a while trying to get the wrong one to work. Even the book and current codebase disagree on the spelling of ‘converter’. Strewth.

So there are a few problems, what about the benefits? Well, Tapestry’s big draw would be through its use of components. You could if you wanted not use components, and have the Page class (mixed with a heinous amount of XML) work with the view pages on a one-to-one basis. However this is an obvious antipattern, as quite simply everything gets quickly cluttered and difficult to understand, much more quickly that with the other frameworks. If you spend time coming up with a well-considered design for your components and pages, one can experience moments positivity. You may feel that the world is not such a bad place after all. In fact the book we have is called ‘Enjoying Web Development with Tapestry’ – but I think this may be a step too far.

I do suspect there is an elegance to be achieved. Tapestry forces you to think in terms of breaking your pages up into components, and provides the means of explicit wiring and state-passing. The trouble is that the learning curve is steep, having someone on the team with experience of the framework is crucial, and there are lots of quirks that can trip you up.

HIPs are drawing closer

May 5, 2007 § Leave a Comment

This June the Home Information Packs (HIPs) go live. HIPs were a substantial part of my work life for around a year and a half, as myself and others endeavored to build a system capable of delivering these big wedges of paperwork. I was very much excited about the prospect of seeing the first HIP roll of the production line and into some prospective home buyers’ hands. In my mind I had pictured champagne all round and a big party. I had imagined that all as one the team would be celebrating, congratulating and patting each other on the back, smoking cigars and repeatably exclaiming “a job well done”. Admittedly though, this vision probably ignores the more likely reality of worried frowns and a real sense of urgency, as subtle changes in requirements pop in at the last minute, causing us frantic development against the clock. Well, some might say the latter vision is just as romantic.

As I blogged a while back, I worked for a company that was to be at the forefront of HIP provisioning. Our estimates of at least a 50% market share to start with, were very much realistic (check out Rightmove’s dominance in the estate agency advertising market, coupled with estate agents desire to provide the HIPs over solicitors). Unfortunately (for some), the government ditched a key component of the pack, the home condition report HCR. Consequently the HIPs business of Rightmove was shut down. But hey, lets not tred over tired old ground. HIPs have once again aroused my interest because they’re due to go live. I’m interested to see what the current state of play is.

A thought nags at me while I witness the new leglislation’s struggling birth. If you mention to someone about “a major new law coming in this summer”, they immediately think about the new smoking law. Is the government attempting to sneak this new initiative under the nose of the mainstream public? I wouldn’t say so, but equally I’d enthuse it’s probably not a a bad idea of someone’s not to let HIPs be the centre of attention whilst it’s on stage. It’s probably analogous to the troubled kid who might do something unpredictable when everyone stares.

So what will happen this June? Well a factor steeped in ambiguity that troubled us, was of whether or not the government would enforce sellers to have the pack ready before the property can go on the market – instead of insisting the pack must be “under production”, which some may view as a potential loophole. It seems clearer now, the seller must have the pack in possession when the house is on the market, and if a buyer asks for it it must then be given to them in 14 days. I don’t think there’s any way of avoiding having a pack. Most sane buyers will ask to see the pack before getting serious about a purchase; they’re certainly not going to arrange to produce the documents themselves when under law they should be freely available. Nevertheless, it will be interesting to see if the market has a brief spasm as people attempt to market their properties before June; properties on the market without a HIP post-June will be OK as long as they’re marketed before the go-live date.

Back when Rightmove pulled out of HIPs, a major concern was that the profitability of the pack would be reduced as a result of losing the HCR. In other words, since the pack would now be cheaper, surely the corresponding profit margin would be too. So, the HCR was an expensive component largely due to the cost of getting a “Home Inspector” to come round and inspect the property. Interestingly though, the HIP still has the Energy Performance Certificate (EPC). And the production of this document requires an “Energy Assessor” to visit the property. Immediately it’s clear that the EPC will not be cheap. At the time of 2006 when the Government ditched the HCR, people were talking about the HIP costing 400 instead of approx 750. Now though, we’re back up to the 750 mark. I’m wondering if in retrospect Rightmove bailed too early.

The other issue that concerned my previous team following the HCR debacle, was our lack of faith in the government. Apparently, many people had begun expensive training to become home inspectors. For the government to abandon the HCR when so much had been invested in it – could they be trusted to maintain a straight course for the rest of the leglislation? This question gains validity amongst rumours that Gordon Brown wanted to clear the decks of unpopular policies before he stepped into power.

As ever, it’s not so simple. The EPC arises out of a EU directive, that EU citizens must have this document in place every time a building is sold or rented. For the government to ditch HIPs, they would have to find another way of meeting this mandatory requirement. This serves as a credible reason to believe HIPs will certainly be in place for June 2007.

Lastly with regards to the HCR, it should be pointed out that the HCR is still a component of the HIP, it’s just not mandatory. Contrary to common belief, there are people out there that will demand a HCR from the HIP suppliers from June onwards, in order to pursue a “quick sale”. If the industry is surprised, and the HCR becomes a regular member of the pack, it’s entirely possible to see the HCR becoming mandatory in the near future. Logically, this would have preserved Rightmove’s original business model. In their defense, predicting what may happen in the future is somewhat shakier ground to continue justifying the continuation of a 22 million pound investment.

There is I feel, another interesting developing strand in the furor of the oncoming wave. Back in 2006, those that opposed HIPs seemed a unified bunch, standing solidly against the changes. When talking to the general public, I felt people really wanted this new law. People had been needlessly burnt so many times, and craved this reform. It has seemed that until now the government has never really narrowed in on the minority collective opposing HIPs; those with vested interests. I refer to solicitors, unnerved estate agents and mortgage providers making a tidy sum on their own surveys. Now though there are suggestions estate agents are sensing an opportunity, putting them at odds with solicitors. Fascinatingly, as HIPs is becoming a reality the opposition is fracturing, and infighting. My personal opinion is that I have little sympathy, they’ve attacked a law for so long that the vast majority of people want, and it’s really their fault we need it in the first place.

Where Am I?

You are currently viewing the archives for May, 2007 at Pithering About.