Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a program where one thread creates a work queue and a bunch of workers that pull from it, and occasionally does some cleanup work for the workers. If the workers are all instances of FooWorker, what would I name the other class? One idea I've had so far is a FooManager, but maybe there's a better one?

share|improve this question
    
Sounds good to me. Naming is hard so if you've got something that works go with it. –  ChrisF May 2 '11 at 22:24

5 Answers 5

up vote 1 down vote accepted

There are some common names used for classes doing some expected logic:

  • xxxManager - managing something, delegating something, coordinating something
  • xxxWorker - doing some job, processing something
  • xxxService - exposing logic functions in more meaningful / less granular way
  • xxxContext - storing some processing state, data
  • etc.

So FooManager in your case is a good choice. I also heard that once developer don't know how to name his class he uses xxxManager but I don't agree with that.

share|improve this answer
    
Service might actually make more sense in my case. Thanks. –  Brendan Long May 2 '11 at 22:47

The worker threads are called FooComrade. The thread that controls the worker threads is also called FooComrade.

share|improve this answer
    
If the controller does different work than the workers, a different name helps. Otherwise all classes could be named Foo. –  user1249 May 3 '11 at 5:40
5  
And I suppose a good name for a context object would be TheParty :) –  user1041 May 3 '11 at 7:23
6  
Some comrades are more == than others. –  Mike Baranczak May 3 '11 at 19:09

Dispatcher?

Manager is another alternative

share|improve this answer
    
I prefer manager, for me, dispatcher sounds like something used for dispatching events. –  JD Isaacks May 3 '11 at 3:06
    
Erlang/OTP calls them "Supervisor", manager would also work –  Zachary K May 3 '11 at 13:32

According to Pattern-Oriented Software Architecture this is called the "Master Slave" pattern. So the worker threads could be FooSlaves and the master thread could be FooMaster.

share|improve this answer
8  
How about Foominatrix? –  Joel Etherton May 3 '11 at 13:15

How about Manager + Slave ?

Or maybe RudeManagerThread and HarriedWorkerWhoIsASlaveThread just for getting that kick. Make sure though who reviews your code.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.