Summary

Suppose my linkable component uses init arguments to load a general scripting engine (or formula processor or something like that) which in turn needs to be initialised with arguments (e.g. to load a script from a given file). The second set of (valid) initialisation arguments is only known after the first initialization is done. Also this might be further nested, requiring some kind of iterative initialisation, like:

repeat
{
  args = linkableComponent.getInitArgs();
  ... fill in the args ...
} until (linkableComponent.init(args) == INIT_COMPLETE);

How to address in Version 1

...

How to address in Version 2

...

1 Comment

  1. Unknown User (don)

    Maybe the following example will solve it:

    interface IComponent
    {
       IList<IArgument> Arguments { get; }
    
       void Initialize();
    }
    
    ... tests ...
    void LateArgumentInitialization()
    {
       IComponent c1 = ...;
    
       c1.Arguments[0].Value = ...;
       c1.Arguments[2].Value = ...;
    
       // or 
    
       foreach(IArgument a in c1.Arguments)
       {
          ...
       }
    
       c1.Initialize();
    }