10/27/2004

JBoss AOP - 10 out of 10

I looked into jboss-aop today and am delighted. It has
  • Great documentation and tutorials (not unusual any more in jboss projects).
  • Great examples (with brief explanation) covering all most all jboss-aop features. All the examples work out of the box. We dont need to do any thing special to run them.
  • Excellent eclipse ide plugin. This one rocks.
  • Works with jdk1.4 & jdk1.5 .

Over all I am able to get started in half an hour. JBoss team is living upto their "professional opensource" slogan.


10/23/2004

Cool Runnables

A frequent reason to implement Runnable is, a class already extends other class we want it's objects to be active objects.

Another important reason is runnable can be used as a generic call back.
We can have a method like below doCallback where it calls back run on given runnable.

  doCallback(Runnable r){
    ...;
    r.run();
    ...
  }

This idiom is used in SwingUtilities.invokeLater(Runnable r), and SwingUtilitie.invokeAndWait(r). In these runnable is posted to a event queue and AWTEvent thread reads it and calls run from event thread. This makes given runnable called execute in a particular thread.

Recently I have been using this idiom in our persistence framework, we do normal operations on our business objects and post persistence tasks to a set of database aware threads. These db aware threads call our runnable task and do pre/post processing(transaction, connection management etc). Isn't it cool?

10/11/2004

Why not JOnAS?

I am wondering why JOnAS is not as popular and as hip as JBoss?

JOnAS is also an open source (LGPL) project. It is J2EE certified for a while. Lot of developer/user documentation is freely available (Unusual for a open source project). According to study conducted by rice university JOnAS scales better than JBoss. Redhat officially supports JOnAS as part of redhat application server.

Is it because JOnAS doesn't have evangelists, entusiasts JBoss has? Is marketing/hype important for a free and open source project also?

10/10/2004

Linux desktop

I tried using a Linux desktop four years ago, it was a disaster. My dell PC had a winmodem and Linux didn't recognize it. It made me switch back to windows.

I tried again six months back. This time Linux recognized cable connection :). Over this period gnome/kde improved a lot. In many ways gnome looks and feels better than ms windows. All my favorite IDEs, tools are available on Linux also. In fact eclipse looks better on Linux. I am able to use samba file server, use vnc to control windows PC from Linux and vice versa. I feel p2p clients are perceivably faster on Linux. Open office is nice also. Open office can convert from open office format to PDF. Mail client evolution is great. Most importantly there is no worry of spyware.

On the -ve side multimedia tools are still lagging. XMMS doesn't have nice play list editor. Not many video players available and available ones are not that friendly.

Only big complaint this time is Firefox on Linux is not able to recognize telugu fonts. After some trouble I am able to install eenadu font and read it. I am not able to set up rest of the telugu news paper fonts.

I found tamil, bengali and hindi linux builds. I could not find telugu linux. Is it out there?

Overall this time I am very happy with Linux desktop.

I will post some screen shots soon :)


10/09/2004

Visitor thoughts

Riley white gives an excellent visitor example and explanation.

My 2 cents are
  • I prefer foreign method to visitor pattern. Foreign method can traverse Subject's hierarchy with out accept method in subject. In reily white's example I would have some thing like

    class CheckoutImpl extends Checkout{
       void checkout(ShoppintCart cart) {
         Collection items = cart.getItems();
         // traverse and add all items.
       }
    }

    Only advantage of Visitor is it's accept method can encapsulate traversing items in a Subject. In Most cases it tends to be very simple traversal.

    Use visitor only when there is a need to do special traversal. For example when traversing a closet an employee need to sort only items under $3.00 or need to remove expired items. Then Subject's accept method becomes

    void accept(Visitor v, Condition c){
       Collection = getItemsSatisfyingCondition(c);
       doNormalAccept...
    }



  • Java (my language choice) determines overloaded resolution at compile time, visitor need to have explicit visit methods for each sub type of Subject and an instance of checking method to resolve and call explicitly typed methods. Resolving these conditional type checks is some sort of ugly code.
    Changes in Subject hierarchy causes changing all visitor implementations.

    Beware of these problems and (as advised by GoF) use visitor only when subject hierarchy is stable(rarely/never changes).