Too Cool for Internet Explorer

Sunday, December 9, 2007

My personal Ruby project

After working with java for a while, a problem came up to me.

Here at work we have an architecture checklist for all pre-production applications.

My recurrent problem is: lack of more descriptive comments on Javadoc for generated getters and setters on Database field’s value objects.

Unfortunately we access DB directly here no Hibernate, just some regular SQL on DAO, and associated VOs.

Here is an actual VO sample:

/**

* @return the cdNAT

*/

public java.math.BigDecimal getCdNAT() {

return cdNAT;

}

/**

* @return the cdSUCDESTPAG

*/

public java.math.BigDecimal getCdSUCDESTPAG() {

return cdSUCDESTPAG;

}

And here is a desired one:

/**

* @return the event’s nature from the payed indemnizations

*/

public java.math.BigDecimal getCdNAT() {

return cdNAT;

}

/**

* @return the office’s code from the payed indemnizations

*/

public java.math.BigDecimal getCdSUCDESTPAG() {

return cdSUCDESTPAG;

}

We have comments on all tables (and columns), on data base.

So my project is: create a Ruby application that will gather comments from database, join the terms: “return the” with the column comment and “from the” with the table comment, and create a really descriptive comment on Java source.

On the first version, will have to pass the java file and the table name.

On further versions, will try to do a deep analysis on corresponding DAO class, taking all table names, locating the child VOs and do the work there.

Current status:

  • I have all the SQL needed to the job tested using tiny Ruby programs;
  • I’m studying “active records” to use it on my Ruby programs;
  • Made some practical tests, and experiences to select a Ruby GUI, to get it done.

The future:

  • Extend this functionality to Ruby / Rails.
  • Try an open source project on that subject, or include this functionality on an open source project that already exists.
Any Help, suggestion, tip or reference Welcome

No comments: