Friday, 18 July 2008

Linked, linked in and general networking.

Back to the blog after a nice family holiday at Bosinver Farm Cottages. A week in the west country 'on the farm' my eldest learnt to eat eggs, feed ducks, chickens and Chalky the Goat!

Getting back to the office, we're ramping up the design work on the new eBilling system. It's looking great. So much simpler than the existing system.

I've been evaluating charting tools for Java web apps. I've got a bit of a problem though. What ever we choose has to be used by the old struts I app. and the new JSF system. Hmmm that says mashup to me. use an ajax plugin. I found a java project that wraps flash - handy. Flash interactive animated charts inside a java web app. really though I should wait for JavaFX or maybe I could do something in Flex with a webservice.

Also I've finally got around to updating my web site to link into this blog. A bit of joined up thinking!

I found LinkedIn too not sure how useful it is - a sort of Facebook for grownups. I thought I'd take a look and then I found most of the people I work with on it and all this time I didn't know. How left out do I feel? Erm not much really.

I signed up for an Oracle BI hands on day in London and then got a call from a nice lady at Oracle saying we've over subscribed and could we bump you to a later date. 'Yes' I said, because it clashed with a family commitment. We'll contact you at a later date with a new date. I've still not heard anything. Hey guys if you can't do it don't advertise it. Now maybe I'm wondering what else Oracle says it can do that it can't really!

Wednesday, 18 June 2008

Ext Javascript tools

I've always avoided using javascript. I truely hate javascript. Having said that I recenlty found myself having to add a tabbed section to a web page and I really could not be bothered to mess about. So I turned to Ext javascript tools library. It really made a nasty job actually quite easy. I was using the TabPanel, a couple of lines of code from the very good api example got me up and running and the resulting table showed good browser compatability.

write the javascript, include the required library files and stylesheets in the html page and off you go....

Here's my create tab javascript code:

/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/

Ext.onReady(function(){
  // basic tabs 1, built from existing content
  var tabs = new Ext.TabPanel({
    renderTo: 'tabs1',
    width:620,
    activeTab: 0,
    frame:true,
    border:true,
    defaults:{autoHeight: true},
    items:[
      {contentEl:'tab1', title: 'Originating Number(s)'},
      {contentEl:'tab2', title: 'Recurring Charges'},
      {contentEl:'tab3', title: 'Cost Centre(s)'}
    ]]
  });


  function handleActivate(tab){
    alert(tab.title + ' was activated.');
  }
});


Then in my HTML page....

<div id="tabs1">
    <div id="tab1" class="x-hide-display">
    <p>
        tab1 text here...
    </p>
    </div>
    <div id="tab2" class="x-hide-display">
    <p>
        tab2 text here...
    </p>
    </div>
    <div id="tab3" class="x-hide-display">
    <p>
        tab3 text here...
    </p>
    </div>
</div>



Job done. comes all styled up and looks great.


You can mess with the options available in the API and take it from there.

Monday, 2 June 2008

Enterprise Web Apps with JSF, EJB3.0 and JPA

Just got back from a training course on the above. Very cool. I really enjoyed it. Having used Struts for years I've always been irritated that MVC architecture was a complicated as it was. It never really felt as though it had been given the attention it required. JSF on the other hand feels like MVC the way it should be. Navigation rules are simple and obvious. Some people suggest that there's little difference between Struts MVC and JSF. At first glance I agree it does seem that the difference isn't very great. You really notice it when you develop in JSF in production.

I have to say that so far JSF promises a lot but seems under developed, however I'm not sure if this is just my lack of knowledge. So I went out and bought the book "Core Java Server Faces" Prentice hall. Which basically says how to do all the good stuff that wasn't in the course!

Now JSF is officially part of JEE it's popularity is sure to increase faster than ever.

EJB3.0 was a vast improvement on previous EJB versions. I took a look EJB 2.0 a while ago but the overhead was so vast that we deemed it too heavy for our requirements. Now I think that's changed. Although I don't have need of most of it's attributes. If/when I start dealing with more distributed transactional systems I'll certainly re-evaluate EJB as a possible solution.

JPA - great as ever really simplifies the persistence process

Tuesday, 22 April 2008

JWUG BOF36 JBoss SEAM & JSF

Last Wednesday (16th April) saw the 36th London Java Web User Group get together. The subject for discussion was JBoss SEAM described admirably by Sebastien Degardin, his English being much better than my French!

The upshot of the evening was that SEAM a framework for developing web applications can quickly produce usable web applications - the API being open source, the dev environment might cost if you go to JBoss and get their dev IDE.

The best thing Sebastien demonstrated was that SEAM could automatically reverse engineer a CRUD web application from an existing database schema pointing the IDE at a database resource the application then generates all the necessary pages and persistence architecture based on Hibernate. Although SEAM has it's own it was written by the same guy who did Hibernate. The web interface is built using JSF which, in this version, now hides all JSP and simply uses tags in a similar way to wicket. It effectively means that you're using web components instead of coding HTML.

One nice feature of SEAM is the way it manages session data, we all know about the application context and the session context in web applications. SEAM however, introduces the concept of a "Conversation", such that if you need to store session data across multiple interactive sessions that can be done. Think of an application such as an online auction, you might want to share bid information across a number of sessions spanning a much longer period that a single user session. The "Conversation" concept allows this. I thought that's nice if I have some processing that the user starts but that is completed by an administrator such as signing up a customer and provisioning a service of some kind.

Finally an interesting comment was that, apparently, you can run EJB3.0 in Tomcat. How, when it's not an EJB container? JBoss have an embedded EJB3.0 container. I'm going to look into this further, it's a good one to trick people with but with so many EJB compliant Application Servers I'm not sure why you'd want to. Maybe a phased scaling up of an existing application? There's another one called easybeans which works with java 1.5+ and tomcat 5.5+.

Anyway many thanks to Sebastien for his presentation and to Peter and Evans for organising the event, and "Hi" to Dave Snowdon at ecube who I enjoyed chatting to until I had to dash off for a train.

Tuesday, 8 April 2008

Unit Testing Getters and Setters

Interesting one this. I'm sitting here wondering whether to test all my getter and setter methods. Since I let Eclipse do all the work should I test them all? Two theories here. One, Test everything that can go wrong. Two, don't explicitly test them because you'll test them implicitly in the tests for more complex application testing. Further more if I don't use the get/setter in my test code do I need the get/setter in the first place? That's just a bonus.

It seems to me that Scott Leberknight has the right idea. I'd like to see his solution incorporated in JUnit. Then I surfed around and saw that there was some question as to whether get/setters were in fact OO or not. Interesting comments, brighter people than me are suggesting not always. I can see the point. Read the "Why Getter and Setter Methods are Evil" on JavaWorld by Allen Holub and have a think about it.

Now I'm thinking I should revisit the whole thing.