Design advice needed
I have a "main" class I call Sentinel which monitors all the threads that are created. If any of the threads dont finish on time or died, the Sentinel will be able to detect this and report to user.
Let's take an example. Suppose we are creating a sentry simulation application where our objective is to use 1) a dog 2) a human guard 3) a motion sensor detector to guard an area. The "main" class is going to be Sentinel that has all those objects. Each object requires something different for it to work. A dog needs a dog food object, human needs money object, and motion sensor needs electricity object. NOTE: Since dog, guard, and motion sensor are all independent, they all derive from the Thread class.
So without knowing any creational pattern, I basically would (naively) implement it like this:
Inside Sentinel's Init() method, I have
Dog* dog = new Dog( food );
Guard* human = new Guard( money );
MotionSensor* ms = new MotionSensor( electricity );
assert( dog != NULL );
assert( human != NULL );
assert( ms != NULL );
this->AddThreadToWatch( dog);
this->AddThreadToWatch( human );
this->AddThreadToWatch( ms );
dog->Start(); human->Start(); ms->Start();
As you can see, and the pattern for each thread creation is:
1) "new" a thread, and pass thread-specific constructor parameters to it.
2) Check if "new" failed
3) add the successfully created thread to Sentinel list to watch.
4) Start() the thread.
I wish I could have "something" (what?) that would generically create whatever abstract class I want, so to solve these problems:
1) Reduce having to manually type all that for each thread I want to create.
2) Have a single point of thread/class creation.
3) If we used some kind of creational pattern, how do we take care of different constructor parameter?
Thanks, I think response to this problem will be very interesting; I've been dying to know!

