Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can u assure me :) :
I have implemented my version of the command pattern.
At this moment the commands do this:

JojoCommand() : ICommand
{
   private Jojo pJojo;
   private Color pColor;
   private JojoMaster pJojoMaster;

   public JojoCommand(JojoMaster jojoMaster,Jojo jojo, Color color)
   {   
      pJojoMaster = jojoMaster;
      pJojo = jojo;
      pColor = color;
   }

   public Execute()
   {
      pJojoMaster.Chris.DoSuperJojo(pJojo,pColor)
   }
}


So JojoMaster has some subclasses (chris,peter,harry).
Cause i was getting to many commands to Do.

At this moment ,in execute() : i hardcode subclassed chris,peter and harry in each command :
pJojoMaster.[SubClass].[DoSomething(argA,optionalArgB,optionalArgEtc)

But now i want to have a plugin model in pJojoMaster , meaning i could have a mila,millie,mathilda too , loaded at runtime.

So JojoMaster should have 1 single command : DoCommand(string CommandName , commandArgs args). And jojomaster would then delegate that to his plugins , that each would have a DoCommand too. Jojomaster would check each loaded subclass if it could take the command , and when found , execute it.

But after that , i get blinded by thoughts about how to implement the args object.

Anybody had the same problem , and solved it ?

Huggies !!

Whats best to do next ?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900