Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,125 | Comments: 45,490

filter by tags archive


Peter Ritchie

I would avoid IIgnoreFilesSpecification to avoid confusing it with a Specification pattern implementation.


How about "IIgnorable"?


I'd go with the first one, seeing the 2 I's next to each other gives me a headache. :)


public interface IFileFilter{

bool ShouldProcess(bool file);



Rik Hemsley

Using the 'I' at the beginning of an interface name as the first person singular personal pronoun is not a naming convention I recognise so I'd prefer the latter.


What about 'public interface IIgnoredFilesRecognizer'?

Rik Hemsley

Oh and I agree with jonnii - that's a much better name.

Tuna Toksoz

Both sounded weird to me.

IIgnorableFileSpecifier? maybe?

Mike D

IFileFilter gets my vote

Julian Birch

I agree naming is important, but how about Predicate?

Ayende Rahien

Predicate is useless, it doesn't tell me what it does.


We are trapped in the world of having to name a method and a class to get it right. Wonderful. There are days when I wonder whether we should bring back pure functions and maybe namespaces.

Without more context, this is difficult, but the first one seems to provide information and the second is simply a mystery (requiring far more context to be sensible).

IFileFilter seems too broad and IIgnorable seems even more so.

What I don't get about this interface is (1) that it is an interface but (2) we have to provide a file name. So what kind of object has that interface?

Juliano Nunes

IFileFilter or IFileContract

Ayende Rahien

public class OldSvnBridgeFilesSpecification : IIgnoreFilesSpecification


public bool ShouldBeIgnored(string file)


    return Path.GetExtension(file) == ".svnbridge";



Julian Birch

Well, you still get to name the variable...

Predicate ignoreFilesSpecification = new OldSvnBridgeFilesSpecification().ShouldBeIgnored;

For instance.

But it really depends on how you're using the class, which I guess has always been the point.


+1 for jonnii


I like descriptive names, even if longer.


I like prefer ending with 'Specification' for naming standard purposes...It helps too if I need to do a resharper Ctl+N with "*Specification" .

I would actually use IDisregardFilesSpecification or IIneligibleFilesSpecification naming.


I like IFileFilter

Keith Elder

This reminds me of ICanLayEggs and IEggable! :)


David Buksbaum

+1 for the IFileFilter by jonnii

I think this makes it specific enough for the meaning to be understood, and general enough to promote reuse beyond the current context.

One other thing, is to possibly make this work in a chain, such that a series of IFileFilter's could be applied to jointly decide if the file should be ignored.


Shawn Neal

Why do we love to talk about naming conventions/names so much?

Tobin Harris

public interface Ignorant


bool Ignores(string test);



Raja Nadar

how about IIgnoreFiles? [IVerbNoun since IAdjective (IIgnorable) doesn't sound good]

Alex Simkin

IDisregarding or IDisregardable or IPayingNoAttentionTo


If that interfaces is only used to recognize the SCM's meta-files (or whatever you call the .svnbridge folders), call it by that name and use it in that way:

IMetaFileLocator.IsMetaFile(string filename)

If it's supposed to be used to identify all files that should be ignored (during what? that's a key question), then I think the notion of an "excluder" -- that is, something that excludes files from general filespecs -- will work better:

IFileExcluder.ShouldExclude(string filename)

This suits the scenario where it makes sense to combine several of these, for example the default one that excludes meta-files, another one that excludes files based on svn:ignore properties, etc.

If there's no need to combine exclusions, then jonnii's FileFilter suggestion -- making the interface say which files should be processed, rather than which files should not be processed -- is slightly more intuitive IMO.

Alex Simkin

One more:

IPicky with method Refuse

Kenneth LeFebvre

For what it's worth, I like your idea of using the "I" as a first-person pronoun!

I tend to not use an "I" at all on my interfaces, rather ending my interface names with "Interface" or "Contract". But, I am also a big fan of active voice in my names (actually, in all of my writing, really) so if I used the Hungarian Eye naming convention for interfaces, I would probably go with your first proposal...

John Rayner

I prefer method names to be verbs in the present tense. So I'd be similar to jonnii:

public interface IFileFilter


bool ShouldIgnore( string filename );



IAmWhateverYouAndYourTeam can understand and agree on is good enough. I wouldn't stress over some name. Some XML documentation wouldn't hurt either.

Ken Egozi

Started my comment here, moved it to my blog:


In short - be specific. Either of Ayende's offers are good, IFileFilter is not my preference.

Sidar Ok

ICanIgnoreFiles :)


Depending on where this is used there's a good chance that I'd go with something like this:

public delegate bool FileFilter(string fileName);

If not that I'd go with the IFileFilter-interface.

Alessandro Riolo

I agree with Ken about the name of the interface.

That said, in English "should" doesn't convey the meaning of absolute necessity. In example, as per RFT 2119, "SHOULD .. mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.", while "MUST .. " ( or "REQUIRED" or "SHALL") ".. mean that the definition is an absolute requirement of the specification.", thus I would advice care also on the naming of the method. In layman's terms, is really ShouldBeIgnored or should be MustBeIgnored?.

Jeff Tucker

So should the chicken class implement ILayable or ICanLayEggs then?

Mats Helander



Marc Wrobel

The first one, since IIgnoreFileSpecification doesn't talk to me very much.

Steve Freeman

Surely it depends on the context in which the interface is to be used?

  • using the 'I' wart to refer to the object just seems wrong to me. We should do everything we can to ignore this unnecessary noise.

  • since it's a string, that's a "filename" or "pathname", not a "file".

Steve Campbell

An interface with a single method is generally part of a strategy pattern. Given that, I would choose option 1, because it is indicative of what the strategy is for (recognizing files that need to be ignored). I can use the name of the option 1 interface in a conversation and its purpose will be clear.

Option 2 has a more concrete (implementation) feel to it (FileSpecification). It also uses "Ignore" as a verb, which in my interpretation is not what it does (it does not actually do the ignoring, only the recognition).


IIgnorantFile :-)

Back on a serious note, I think IFileIgnore is best suggested name. Altho, I prefer Exclude instead of Ignore.

Kirill Osenkov

I agree with Julian, a delegate can be nicer than an interface here. Just think of all the benefits you can get with lambdas.

If you don't like that Predicate is too generic (sic!), you can define your own:

public delegate bool FileFilter(string fileName);

Also, let us know what was your final decision. I'd be curious :)

Daniel Kolman

+1 for the IFileFilter by jonnii

But IMHO this discussion is great example of a fact that solving any problem without context is waste of time.

Ohad Aston

The class that implement this interface should RECOGNIZE IF A FILE SHOULD BE IGNORED why calling it IFileFilter?

Call it IDoSomething and you solve the problem

Comment preview

Comments have been closed on this topic.


  1. RavenDB 3.5 Whirlwind tour: I need to be free to explore my data - one day from now
  2. RavenDB 3.5 whirl wind tour: I'll have the 3+1 goodies to go, please - 4 days from now
  3. The design of RavenDB 4.0: Voron has a one track mind - 5 days from now
  4. RavenDB 3.5 whirl wind tour: Digging deep into the internals - 6 days from now
  5. The design of RavenDB 4.0: Separation of indexes and documents - 7 days from now

And 11 more posts are pending...

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    05 May 2016 - Physically segregating collections
  2. RavenDB 3.5 whirl wind tour (14):
    04 May 2016 - I’ll find who is taking my I/O bandwidth and they SHALL pay
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats