Page 1 of 1

A simple question of terminology

Posted: Sat Apr 26, 2008 7:07 pm
by georgeoc
I need some help to find a simple descriptive word for a set of classes.

My app defines Chains, which may have any number of Elements. Elements come in different types: they may be Channels (which either import messages to, or export messages from the Chain), Routers (which modify the chain behaviour depending on the properties of each message), or ????? (which parse/transform/modify all the messages in the Chain).

????? is the class type I want to give a good name! They will do things like convert between BBCode, HTML, RSS, etc., strip headers, footers, and adverts, add subject tags - that kind of thing. What would be a good name for this set of classes? Transformer? Converter? I originally used Filter, but that is not the correct terminology, as I'm sure you will agree.

Re: A simple question of terminology

Posted: Sat Apr 26, 2008 9:04 pm
by Christopher
Filter is the common term for such things. You might want to look at the Intercepting Filter pattern as well.

Re: A simple question of terminology

Posted: Sat Apr 26, 2008 10:59 pm
by Chris Corbyn
++filter

Re: A simple question of terminology

Posted: Sun Apr 27, 2008 4:15 am
by georgeoc
Strange - I had it in my head that a filter was only for removing unwanted portions of a message, rather than converting or adding to a message. Still, as Filter is what they're called at the moment, I guess I'm a genius. Just a bit confused.

Thanks guys!

Re: A simple question of terminology

Posted: Sun Apr 27, 2008 5:26 am
by matthijs
I would think Filter is something that lets only certain stuff through and thereby removing some parts.

I would say that if you convert, say XML to HTML you aren't filtering but converting. Isn't a Converter a better name then?

Re: A simple question of terminology

Posted: Sun Apr 27, 2008 1:02 pm
by Christopher
georgeoc wrote:Strange - I had it in my head that a filter was only for removing unwanted portions of a message, rather than converting or adding to a message. Still, as Filter is what they're called at the moment, I guess I'm a genius. Just a bit confused.
I current usage, I believe that Filter means anything that changes the thing passed to it and then passes it on. So it is not just reducing, but any sort of modification of a value.

I would say that it is better to be a confused genius than just confused... ;)

Re: A simple question of terminology

Posted: Wed Apr 30, 2008 2:12 am
by alex.barylski
I would say that if you convert, say XML to HTML you aren't filtering but converting. Isn't a Converter a better name then?
I would have to agree. A filter certainly does not add anything to the result in the physical world...so why would the definition be any different in the cirtual world.

Water that percolates through rock is filtered of any impurities.

I would certainly agree that "converting" XML to XHTML is indeed converting...but you would be filtering invalid XHTML attributes and returning a filtered (not converted) W3C compliant source.

Converting can probably be used to describe filtering as a whole, but filtering cannot be used to describe converting. For example, removing invalid attributes in XHTML and making the document valid might be described as converting the document but more precisely defined as filtering the document. Whereas taking a XML source and converting it to XHTML could not nessecarily be described as "filtering" the document the process is to involved. I suppose I just feel that filtering is a terse process whereas conversion can mean "loosely" terse or verbose.

Re: A simple question of terminology

Posted: Wed Apr 30, 2008 2:22 am
by VladSun
Maybe "Handler"?

Re: A simple question of terminology

Posted: Wed Apr 30, 2008 3:00 am
by Christopher
I think the difference between a Filter and a Converter is that with a Converter you put in an A and get out a B. With a Filter you put in an A and get out a modified A. It is a subtle difference, but a real one. The problem is that the list in the OP has examples of both conversions and filtering. I would still use Filter as the general term to cover both. I don't think it is analogous to physical filters.

Re: A simple question of terminology

Posted: Wed Apr 30, 2008 4:29 am
by georgeoc
Hi guys.

Many thanks for all your comments. I think I agree with what both Hockey and arborint write: I too was thinking of a physical filter which only removes impurities. However, it's quite important to me that I find a generic umbrella term for these objects, and Converter is just too limiting. We will always have the same message before and after the operation, so I'm going to stick with Filter as it seems to just about fit!

Re: A simple question of terminology

Posted: Wed Apr 30, 2008 6:55 am
by Chris Corbyn
I think the word filter has an instant meaning to most programmers who are familiar with common OO patterns too. That's enough reason to use the word as any for me :) If I see a collections of classes named ***Filter I don't feel the need to waste time looking closer at the source to find out what they do.