0

The term factory applies to objects that create and return objects.

Is there are term for classes that modify other objects and return that modified object? I looked for terms like 'Processers' and 'Modifiers' but didn't turn up much (other than access modifiers).

I have a lot of helper classes and I would like to use the proper terminology, if possible, to describe all these 'processing' classes. e.g. filterProcesser, layoutProcesser, etc.

Aggressor
  • 13,323
  • 24
  • 103
  • 182
  • 1
    'Processor' sounds fine to me. 'Transformer' or 'Converter' might work, depending on what they do. – Boann Oct 03 '14 at 16:27
  • Transform is so common with location I wanted to stay away from that. Converter sounds like it turns it into something else. – Aggressor Oct 03 '14 at 16:28
  • 1
    "Processer" is not a word, "processor" is. I would go as far as write down all the classes in a piece of paper and write underneath each, what changes they do. That might clear up things for you. – Pithikos Oct 03 '14 at 16:33

1 Answers1

1

If your method modifies an object, then it should not return a value. If your method returns a value, then it should not modify anything - That's what CQS is all about

When you modify another object you perform a command. There's already existing terminology for such methods - they are called Controllers

is there are term for classes that modify other objects and return that modified object?

So as you already know this breaks the CQS since they also return an object.

But if you still insists, there's nothing wrong with naming conventions until they don't break the POLS (Names should be saying exactly what they do)

Also, keep in mind, that good methods should be small and do only one thing

Yang
  • 8,580
  • 8
  • 33
  • 58