On 7 August 2012 19:18, Simone Tripodi <[email protected]> wrote:
> Hi Peter,
>
>> I am looking in the short term to restructure the Maven modules inside
>> of Any23 so that the different facets can be reused, tested and
>> maintained easily, particularly with a view to using the RDF related
>> Tika enhancements that the Any23 MIME Detector provides. I made these
>> changes a few months ago in my GitHub fork [2], so feel free to review
>> them closely to suggest enhancements before I actually start. I am not
>> sure when I will next have time to clean up the patches. The first
>> step that I want to take is to split out the test resources into a
>> single module and switch from "src/test/resources/*" File based access
>> in tests to using this.getClass().getResourceAsStream("*"). I have
>> implemented those changes in my git repository but the patches may
>> need cleaning up as I have not gone back to review them yet. After
>> that is done, it will be relatively simple to split out both the
>> packages and tests into separate modules.
>
> You have my full support on this step, I would be more than glad to
> provide feedbacks - feel free to ping me when/if needed!
>
> I also think we could take advantage from this work to get rid of many
> builders-of-factories and switching the Any23 runtime environment to
> something more standard-ish, i.e. JSR-330
> <http://www.jcp.org/en/jsr/detail?id=330>

I have never seen or used JSR-330 before so I can't comment on whether
it is useful to us or not, although searching for it on the web seems
to show that most of the dependency injection libraries have support
for it, ie, Spring and Guice among others.

There is at least one statement in that code that I don't think is
true in my experience. The author of that JSR says that "Service
locators decouple even further but reduce compile time type safety". I
am not sure what service locators they have been using, but
java.util.ServiceLoader is definitely typesafe, especially if you use
it with a Factory interface instead of using reflection to instantiate
the object manually. In my experience using java.util.ServiceLoader on
my own projects and in my work with OWLAPI, I have found that you can
have a typesafe plugin system quite easily without relying on a
dependency injection system to do it for you.

However I don't mind if you want to put in JSR-330 annotations in the
apprpriate places. I am just wary of cases when a library forces you
to use dynamic dependency injection and either makes it very hard or
impossible to do it using a plain-old-java way. As long as the code
doesn't lock things down by doing things like creating private fields
with no accessors or mutators except for DI magic, I am fine with it.
Personally, I don't mind maintaining Factories as I am going to be
using them myself, since I don't generally use DI, and using Open
Source code I am free to create the factories if they don't exist.

Cheers,

Peter

Reply via email to