Hey Jeppe,

Eeek, I didn't mean to start an argument about DI ;) In my humble opinion it's a pretty direct equivalent of a service locator for most custom applications (which is what most of us build). I prefer the service locator because I find it simpler/less magic. Others prefer DI and that's fine too.

How would you else do it? Lookup methods?
Either way (push or pull) you're committing to a level of dependency. A constructor argument or a setter is better than depndency on some lookup class IMO. What I like is that I can see my dependencies (those that matter) and I can easely mock them when unit testing.
Perhaps I wasn't clear in what I was saying. I don't like that the dependencies are public for everyone to see because in the normal operation of the class those methods should not be called except by the thing injecting the dependencies. The "hard" dependency on a lookup class doesn't really bother me because it's usually my own class. And mocking is easy enough because I can wire test impls into the lookup.

Using private makes unit testing almost impossible (you need to supply a dependency somehow) and protected makes it harder (subclassing is needed), so IMO public is the right access level.
Are you still coding C++ ;) I always forget that protected is *weaker* than package access, but both allow access to all classes in the same package. That's one of the reasons I always have my unit tests in the same package (though different source tree) as the production code.

        - support for public/protected/package/private *field* access (if
you annotate the field)

I like that I can specify it on the field, but I would still like to keep my public setter.
All the new stuff is additional. If you want to continue to use the setter, you will need to annotate the setter though.

I will try it out tomorrow and get back to you with feedback.
Did you get a change to try it yet? With all the mailing list flakiness I can't tell if you emailed again or not :/

-t


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to