Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a dictionary about common programming vocabulary?

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.

like image 294
sventevit Avatar asked Apr 25 '10 15:04

sventevit


Video Answer


1 Answers

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.

like image 187
Potatoswatter Avatar answered Nov 17 '22 00:11

Potatoswatter