Paul Hammant wrote, On 03/04/2003 7.37:
Nicola

[...]


public interface Notifier{
    void notify(Object[] notifications);
}

[..]

setNotifier(myNotifier);

[..]

addObserver(java.util.Observer o);


> But... this would mean that we would need a notification.jar that has the above interface. Interfaces are bad for API coupling.

That last a bit sweeping. Interface/impl separation is a good thing in general. Premature publication of an interface model is a bad thing.

My point is that an interface like that is not in the JDK, and must thus be supplied. That couples a jar with another one.


My take is that the use of a simplified interface is neat in that it means that an evolving package will never cause compilation errors in user-community code. However, given it is a black-box, there would be nothing to stop it it breaking at /runtime/ if a slight difference occured on the arrays of objects being passed into the black-box.

Ok, but it still doesn't solve my use-case. I want to be able see what my bean is doing but I don't want to have to add *any* other jar apart from my bean.


I want just to have my bean, nothing else. And be able to have the bean report to something I give it when I need so.

If I need to see all that's happening, I just fire up the debugger.

The same thing another way - I'd like to be informed by the compiler that there is some subtle change in API. It helps me have high test coverage. Of course test coverage is irrelevant if your only view of monitoring is logging to a text file somewhere in a file system. My contention on testing and TDD is that logging (as a means to an ends) is not an API, thus not test-worthy.

Thus, I err towards a strong interface design and away from a loosely-coupled design like those above.

Which is what is getting us in trouble WRT logging now. If we use a strongly-typed thing for this we will have the same problems WRT the use cases I have, that are:


 1 - no logging if no logger is supplied
 2 - no other jar-class-interface with my bean
 3 - I want to put the "logging statements" in my bean to say
     what I want it to say where I want it to say it

--
Nicola Ken Barozzi                   [EMAIL PROTECTED]
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


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



Reply via email to