Yes, there is in a way some overhead, since obviously in version B the anonymous object is created again and again compared to version A where an object of type A already exists. How substantial this overhead is, depends on many factors, e.g. how often this code is called or how much information is contained (internally) in an observer.

Markus


Michiel van der Wulp wrote:
Hi All,

Is there any overhead in using class B instead of class A?
And if so, how substantial is it?

This could influence the architecture of the Notation architecture...


class A implements Observer{
    public someFunction(){
        callSomeFunction(this);
    }

    public void update(Observable o, Object arg) {
        doSomething();
    }
}


class B {
    public someFunction(){
        callSomeFunction(new Observer() {
            public void update(Observable o, Object arg) {
                doSomething();
            }
        });
    }
}



Regards,
Michiel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to