Saturday, October 29, 2005

Constructor Dependency Injection ...... eh?

I am about to start some serious J2EE stuff and plan to use the Spring framework to help me glue it all together.

To this end I am reading Pro Spring, which is a big fat book on the subject. In chapter four I came across the following paragraph.

Constructor Dependency Injection
Constructor Dependency Injection is Dependency Injection where a component's dependencies are provided to it in its constructor(s). The component declares a constructor or a set of constructors taking as arguments its dependencies, and the IoC container passes the dependencies to the component when it instantiates it as show in Listing 4-4.



Hmmmmmmmm ...

If I put the paragraph through the Babelfish translator into Greek it comes out like this:

Η έγχυση εξάρτησης κατασκευαστών είναι έγχυση εξάρτησης όπου οι εξαρτήσεις ενός συστατικού παρέχονται σε την στον κατασκευαστή της (σ). Το συστατικό δηλώνει έναν κατασκευαστή ή ένα σύνολο κατασκευαστών που παίρνουν ως επιχειρήματα τις εξαρτήσεις του, και το εμπορευματοκιβώτιο IoC περνούν τις εξαρτήσεις στο συστατικό όταν instantiates αυτό ως παρουσιάζει στη λίστα 4-4

I don't know about you but I feel a bit better now.

Thursday, October 27, 2005

Death by XML Confiuguration files

If a tree falls in an XML configuration file, does it make a sound?

Tuesday, October 25, 2005

Lessons

Today's lessons are:

All my relationships with women are essentially the same as that between Captain Manwaring and Pike; with me being Pike of course.

Stepping on Lego is the most painful thing that can happen to anyone, ever in the universe.

Saturday, October 22, 2005

eee that Shaft eee was a reet daft bugger

As part of next years festival uke preparations I was given the project of woofing up the noise on the stall. This was to help us draw the crowds and let people hear the ukes when things got noisy, as they often do at rock festivals.

To this end I have amp-ed up my Ukulele with a bug and plugged it thru my cry-baby wah-wah pedal into a small amplifier.

It sounds like this

As George Formby famoulsy said "Eee that Shaft ee was a reet daft bugger"

Here are some uke wah wah pics:



Friday, October 21, 2005

Mobile innovation ..

Crikey ... now this is an innovation in mobile. I would get Mrs Spug one but I think she would rather have the last Sopranos box set and a cup of tea.

Attribute Oriented Programming

I have been reading stuff about Attribute Oriented Programming. I realise this makes me Captain Spug, King of Dullness but I thought I would share my insights.

Appfuse is a j2ee acceleration thing that enables you to get up an running quickly using Hibernate, Spring, Xdoclet and test driven stuff. One groovy thing is that a lot of the code is generated for you via Xdoclet. For instance by adding the following order object (POJO!):



/*
* Created on 30-Sep-2005
*
* TODO get a life, play more uke, look out of the window
*/
package uk.co.bluetrail.demo.model;

import java.io.Serializable;

/**
* @author Spug-mola
* @hibernate.class table="morder"
* @struts.form include-all="true" extends="BaseForm"
**/
public class Order extends BaseObject implements Serializable {

private Long id ;
private String username;
private int orderNo ;
private int custNo ;
private int prodNo ;
private int quantity ;
private String Notes ;



/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
// TODO Auto-generated method stub
return "" + this.getOrderNo();
}

/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object o) {

Order order = (Order) o ;

return order.getOrderNo() == this.getOrderNo();
}

/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
// TODO Auto-generated method stub
return this.getOrderNo();
}

/**
* @return Returns the custNo.
* @hibernate.property
* @struts.validator type="required"
*/
public int getCustNo() {
return custNo;
}
/**
* @param custNo The custNo to set.
*/
public void setCustNo(int custNo) {
this.custNo = custNo;
}
/**
* @return Returns the id.
* @hibernate.id column="id"
* generator-class="increment" unsaved-value="null"
*/
public Long getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return Returns the notes.
* @hibernate.property length="255"
*/
public String getNotes() {
return Notes;
}
/**
* @param notes The notes to set.
*/
public void setNotes(String notes) {
Notes = notes;
}
/**
* @return Returns the orderNo.
* @hibernate.property
* @struts.validator type="required"
*/
public int getOrderNo() {
return orderNo;
}



/**
* @param orderNo The orderNo to set.
*/
public void setOrderNo(int orderNo) {
this.orderNo = orderNo;
}
/**
* @return Returns the prodNo.
* @hibernate.property
* @struts.validator type="required"
*/
public int getProdNo() {
return prodNo;
}
/**
* @param prodNo The prodNo to set.
*/
public void setProdNo(int prodNo) {
this.prodNo = prodNo;
}
/**
* @return Returns the quantity.
* @hibernate.property
* @struts.validator type="required"
*/
public int getQuantity() {
return quantity;
}
/**
* @param quantity The quantity to set.
*/
public void setQuantity(int quantity) {
this.quantity = quantity;
}
/**
* @return Returns the username.
* @hibernate.property length="20"
* @struts.validator type="required"
*/
public String getUsername() {
return username;
}
/**
* @param username The username to set.
*/
public void setUsername(String username) {
this.username = username;
}
}



I can run an ANT build target that generates

my database creation sql
my hibernate DAOs
the validation for struts
simple JSPs to add an order
simple JSPs to view orders
..... and many many more (said in Ronco voice)

This is all achieved by adding the xDoclet tags at the top of some of the functions and class declarations.

Clever ..

or maybe an indication of how looney-emporers-new-clothes-a-like j2EE has become, not sure which at the mo.

Wednesday, October 12, 2005

Groovy mobile things

ITV have done a groovy mobile thing, see: ITV groovy mobile thing

via Tom Hume

Tuesday, October 11, 2005

J2Me Development Environment

I hunted round for a while to find a decent j2me (or is it jMe now?) development environment. I had a go a netBeans and jBuilder but they were all either a bit expensensive or just bust ...

So this is what I use:

Eclipse: Mighty eclipse is fast becoming (if it hasn't already) the de facto java dev environment.

EclipseMe: This is an eclipse plug in that does "grunt work" of connecting Wireless Toolkits to the Eclipse development environment. This enables you to do emulator debugging with eclipse - most of the time ;-)

Antenna: Antenna is a set of Any tasks that enable you to compile, preverify, package, obfuscate, and run your MIDP applications (aka MIDlets), manipulate Java Application Descriptor (JAD) files and manay many more (ronco voice!)

j2MeUnit: J2MEUnit is a Java 2 Micro Edition (J2ME) library containing a unit testing framework for J2ME applications. Regular junit is no use a j2me does not support introspection. J2meunit is ace because you can set it up through ant to run a pile of tests on the emulator. Here's a pic:



FTP ant task: This lets me upload the JADs and JARs from ant.


Well what do you use?

Tuesday, October 04, 2005

No More Ronnie

Sad day.

I think I would like this quote translated into latin and put on my coat of arms:

"What have I learned, Mr Mackay? Three things. One - bide your time. Two - keep your nose clean. And three - don't let the bastards grind you down."

This page is powered by Blogger. Isn't yours?