title: How can I pass arguments to commands known by interface?
body: <p>Following is the state I want to achieve in a clean way:
  <img src="https://i.stack.imgur.com/0dDVg.png" alt="The wish state"></p>
  
  <p>As you can see, I have the problem that the <code>Invoker</code> only knows the <code>Command</code> interface, but want to invoke the <code>ConcreteCommand</code>. This implementation again needs some arguments from the <code>Invoker</code>.</p>
  
  <p>Here is now the dirty solution I have used so far:
  <img src="https://i.stack.imgur.com/f4ugy.png" alt="The current state"></p>
  
  <p>There are several problems I have with this solution:</p>
  
  <ul>
  <li>The <code>Invoker</code> has meta knowledge about the count and the types of the arguments of the commands.</li>
  <li>The <code>Invoker</code> uses magic strings to get the desired command.</li>
  <li>When the <code>Invoker</code> do not pass the correct arguments I get a runtime error. I would prefer compile errors.</li>
  </ul>
  
  <p>What is the common approach to pass arguments to concrete commands, without breaking the loose coupling (e.g. the <code>Invoker</code> needs to know the <code>ConcreteCommand</code>)?</p>
  
  <p>Regards, Yggdrasil</p>