Are there any other well-known systems which have this dual mode behavior?
Here's how Spring does it: users can either implement certain interfaces
(InitializingBean, DisposapleBean), and Spring will automatically call
the init and destroy method. Or they can add attributes to their bean
definition: <bean class="MyClass" init-methd="myInit" 
destroy-method="myDestroy">.

I think that's a pretty good compromise:
- if you're ok with tying your classes to the framework - use the interfaces.
- if you can't or don't want to do that, reflection will only be used to
 look for methods that you said exist, so there's no useless searching.

http://www.springframework.org/docs/reference/beans.html#beans-factory-lifecycle

Christopher.

Sanjiva Weerawarana wrote:

On Mon, 2006-09-18 at 13:49 +0530, Deepal Jayasinghe wrote:
Hi dims;
This is what we have right now , I mean one can implement Service
interface or just have session related method in the service impl class.
 - if he has implement the interface , then we check the instance of the
service impl class , then call method accordingly
 - else we check to see whether those method are there in the service
impl class , and if there are there we call them using java reflection.

So I am +1 to have that.

I didn't realize that this is the behavior we have now. What's the
purpose of having the interface if we don't require people to implement
it? IMO that makes no sense.
Either do the interface or don't. Doing both is hacky.

[Are there any other well-known systems which have this dual mode
behavior? Maybe that'll help convince me. Otherwise I'm against keeping
both. (I'll refrain from using negative numbers for now ;-)).]

Sanjiva.



---------------------------------------------------------------------
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