ga

Saturday, August 9, 2008

I knew I was right... I think

I had a phone "chat" on Wednesday and it went fairly well I thought (couldn't have went too well because they chose to go no further). Ok, I was going to start complaining and what not, but I decided it will gain me nothing. But, here is where we kind of butted heads during the interview. He asked me about the disadvantages of Spring IOC (Inversion of Control), I guess my answer should have been overhead, but instead I talked about debugging. I stated that it was harder to debug, because you wouldn't get a good stack trace. He asked me if I was sure and I restated to say that during development if you wanted to get a call hierarchy it would work in a IOC container. Really when I think of it that wasn't a good answer either, but what got me is he was saying that that was wrong. I was like "No, it isn't" and he was like "Yes, it is". So this blog is to point out I am right.

So here is a simple controller defined in my xml:
<bean class="org.brh.ctrl.LoginFrmCtrl" name="/login.htm">
<property name="user" ref="user"/>
</bean>


So, what is going to happen here Spring will inject the user bean into the controller when it is created. Here is a snipped of the controller code:
public class LoginFrmCtrl extends SimpleFormController
{
private IUser user = null;
...
public void setUser( IUser u ){ user = u;}

...


So, what he is saying, is that you can right click on the setUser method and it should tell me that it is being called by some class in Spring. But here is what I get:


This is with Eclipse 3.4 and the latest version of Spring IDE.

Is there something that I am missing? What are some other disadvantages of IOC?

0 comments: