While I'm as IoC and design pattern savvy as the next developer, I'm also highly pragmatic. I've not been convinced by any of the examples thus far. If a unit test needs to detect if a document has been added, you can check the size of the index before and after for example, rather than doing some mock trickery to hook the addDocument call. Or you could use AspectJ to do this if you really wanted to get fancy. The unit test example shown is really a unit test appropriate to Lucene itself, and not to a project using Lucene, it seems. Pragmatically, have you ever had addDocument fail? If not, then what peace of mind are you getting from such a test?
Ultimately, though, the decision to refactor the codebase to use interfaces more pervasively lies with Doug.
Erik
On Mar 17, 2005, at 2:40 AM, Konstantin Priblouda wrote:
--- Robert Engels <[EMAIL PROTECTED]> wrote:
I've been pushing for making IndexReader and IndexWriter interfaces for a long time (and changing lucene core to use them), but there seems a reluctance to do so (although I am not sure why). The current factory methods could be easily moved to a IndexReaderWriter factory class. Probably a top-level interface IndexReaderWriter with methods like isWritable() for "read only" indices, and methods getReader(), getWriter().
Hi guys, what about making lucene a bit more IoC Friendly? ( I speak of providing objects that can be created wia constructor, and not by factory )
I'm tired of writing adapter classes...
regards,
----[ Konstantin Pribluda ( ko5tik ) ]---------------- Plugins for xdoclet-2 are released. check it out at: http://www.sourceforge.net/projects/xdoclet-plugins/ ----[ http://www.pribluda.de ]------------------------
__________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/
--------------------------------------------------------------------- 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]