Monthly Archives: November 2004

JUnit in your pocket

There are almost 2 weeks from the last post, but it seems that this end of year will be a very busy one, so I will have little time to write. I hope I’ll be back more active on the next year.
Now, getting away from this type of excuses and back to the topic.
Thanks to JavaRanch I had the opportunity to read the last Kent Beck’s book on JUnit: JUnit – Pocket Guide.
As the name states, it is indeed a pocket guide: 77 pages, from which almost 20 are about JUnit usage inside IDEs (if the editor would cut these full of images pages too and reduce a little bit the format, the book would enter your pocket without any problems [smile/]). Otherwise, the book contains a little of everything: history, reasoning behind creating and using JUnit, a short presentation of the framework architecture and implementation, reduced JUnit API comments and very few examples. Some short comments on possible extensions and that’s all. I think everything inside is in pocket suited format.
Concluding, I would say that JUnit – Pocket Guide is an (very) entry level reading for those wanting to have the first contact with JUnit. More infos are to be found on the JUnit site and other books.
Next reading: JUnit Recipes a book recommended everywhere and with great reviews.
Update: in the pocket review above I’ve forgot to pass the idea I loved the most:

[…]However, if I’m working by myself, I find it helpful to leave the last test broken at the end of the day. When I arrive in the morning, I know just what to do to get started: fix that test. That’s usually enough to get me started on my day

1 Comment

Filed under Uncategorized

QDox, xjavadoc and the alike… maybe one more

Some time ago I was investigating the possibility to have a light in-memory model of java sources. My research has gone mainly to QDox and xjavadoc, passing also through commons attributes.
Unfortunately, after following the mailing list for a long time, I am unable to say that the support for JDK 1.5 will be available soon (or at least at a specific moment in the future – even if the developers are already taking into account this).
So, I get back a little bit and evaluated the problem some other way:

  • how are they implementing these features?
  • why are they implementing this way?
  • which way should i go for?

Answering these will help me find (hopefully) the good way.

How are they implementing these features?
  • QDox: has its own model that is able to keep information about 5 elements: java types, java classes, java fields, java methods and tags. So in order to support JDK 1.5 features, they will need (in big lines) to improve the java type to support generics and add a model class for annotations. Another interesting point of QDox is that it is using its custom java source lexer/parser written in flex and yacc (i guess). They will need also to enhance this too.
  • xjavadoc: has its own model too. In big lines it supports the same elements as QDox does (which in fact represent their real working target). In the same direction, xjavadoc uses its own parser based on JavaCC. So, I would say that xjavadoc has to do the same enhancements as QDox.
Why are they implementing this way?
While the model used in both cases is very clear and I think that with the enhancement I was talking they will be stable for a long time, I am not very sure why both solutions have chosen to use custom parsers. I know that javadoc tool is memory expensive while working with large object graphs, I guess if it is used to parse only bunches of sources and than solve references in memory it would possibly be a viable solution. Here I would like to have some insights of the guys involved in QDox and xjavadoc
Which way should i go for?
I would say that imo QDox seems more alive than xjavadoc (even if the xdoclet guys are working hard). One solution would be to get involved into QDox dev and make/contribute with the enhancements. (But I don’t know if I have a place there as they are already many and I am not sure they are in need for my help). Another solution would be to reinvent half a wheel and go for a solution based only on javadoc parser. While I see some benefits in doing this (assuring the compatibility with the latest JDK available and independence for any custom parsers, and possible to offer access at the code level, without really parsing it), I think I must find out firstly the answer to the above question.

Update: there was an anonymous poster suggesting the solution with javadoc. I think if I choose this solution I must thank him [blink/].

2 Comments

Filed under Uncategorized

Eclipse trick: Custom getter-setter [UPDATED]

The trick I have found for custom getters/setters in Eclipse seemed very nice.
I would like to add more on this: the prefix and suffix accepts a comma separated list of strings that will be ignored by the generator. Wow … very very neat.

Leave a comment

Filed under Uncategorized

… the best ORM in the world (on Gavin’s interview)

I just finished reading the Gavin King‘s interview published on Javafree.com.br. I am using Hibernate for quite a while and I must say I am very happy with it. I have even taken a look (not so deep) to the upcomming Hibernate3, but I still found myself unable to say:

The Hibernate3 core (currently in alpha) is the most powerful ORM engine in the world – and it will take a little while for others to catch up.

, when I know that

Um, traditionally, no, we did not pay that much attention – I was much more comfortable being guided by request from users, than by “what the other guys got”.

Even if Gavin and Hibernate have always had their fanatics(*) [smile/], I am wondering if

However, more recently, we have done some feature-by-feature competitive evaluations of the two leading commercial ORM solutions, just to make sure we didn’t miss anything.

was done the same way the Microsoft vs IBM solution comparison was done. I haven’t seen the results published anywhere and I am wondering which are those 2 leading solutions that have been compaired. I have seen the same statements coming from the TopLink team so I will not jump to a conclusion so quickly and I will wait to read at least the comparison results.
On the same direction I have found out that the guys/companies developing non-RDBMS solutions would have to leave their business:

How do you see alternatives to relational databases, like XML and OO databases, or Prevayler?
We don’t see them 😉

I will give credit to the [blink/] in the end of the sentence and hope that not every other solution will stop their existance and just jump into the RDBMS field immediately.
When SUN has announced the initiative to create a common spec out of JDO and EJB3 I was wondering which will be the future of JDO. Gavin’s opinion is

We don’t see any future for JDO.

, but I am thinking that this future will be the same for Hibernate 2 users as for JDO users. Gavin’s feelings about JDO have been expressed also on some other occasions. What is Craig Russell’s opinion on this?
Finally, I find myself asking if Gavin expressed his true feelings on these or rather it was a somehow furious interview?

Disclaimer: do not consider the bad meaning of fanatic word.

13 Comments

Filed under personalog

Eclipse trick: Custom getter-setter

I don’t want to challenge R.J. but I feel this trick is quite interesting.
During the last weeks I have found quite annoying to use the conventions of the projects I am contributing to, because they impose the usage of m_ and s_ notations and for a long time I have considered that this is a killer for the getter/setter generation in Eclipse.
But no, it is not: you can configure Eclipse to consider some prefixes and suffixes and these will be removed from the generated getters and setters.
Step by step:
– Window -> Preferences -> Java -> Code Style
– Variable type: Fields and add the m_ prefix
– Variable type: Static fields and add the s_ prefix (if you really use getters/setters for static fields [blink/].
Congrats again to the guys developing Eclipse!

1 Comment

Filed under Uncategorized

AspectWerkz enters a new level

AspectWerkz guys (Alex Vasseur and Jonas Boner) have announced the 1.0 final version. I want to congratulate for the long way they have gone and wish them to keep up the good work!
Congrats!
You can read about the current features and release notes while you download it.

Leave a comment

Filed under Uncategorized

Old… but good

Here is an old link to a nice (good) list of Java – to – Relational solutions. Enjoy.

Leave a comment

Filed under Uncategorized