When I need a name for a new class that extends behaviour of an existing class, I usually have hard time to come up with a name for it.
For example, if I have a class MyClass, then the new class could be named something like MyClassAdapter, MyClassCalculator, MyClassDispatcher, MyClassParser,...
This new name should of course represent the behaviour of the class and would ideally be same as the design pattern in which it is used (Adapter, Decorator, Factory,...). But since we don't overuse design patterns, this is not always the solution :)
So, do you know for a dictionary or a list of common words, that we can use to represent the behaviour of the class, containing a short description of the expected behaviour? Some examples: replicator, shadow, token, acceptor, worker, mapper, driver, bucket, socket, validator, wrapper, parser, verifier,...
You could also look at this list as a cheat sheet for metaphors, with which you can better understand your problem domain.
I'd recommend against using design patterns in names. You started with the name MyClass and extended it to MyClassAdapter, MyClassCalculator, MyClassDispatcher, MyClassParser, etc.
But since you know these are classes, and they are yours, why not Adapter, Calculator, Dispatcher, Parser.
But does Adapter universally do what it says? Does Calculator calculate absolutely anything, or is there a specific job?
Good names might be WindowToCommProtocol (name what it adapts), Payroll (calculation is but one task), UICentral (sounds like a dispatcher to me), etc. Calculators and parsers typically shouldn't retain state once their job is done, so those sound more like functions, not classes, to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With