Tuesday, November 10, 2009

Getting dizzy using the Spec Explorer Modelling Guidance

While creating a sample Spec Explorer application, you have this feeling of being lost. The thing is if you follow the steps of the Modeling Guidance (using the "Author a model from scratch" option), you'll soon get lost since the steps and the sample code are not consistent and continuous.


For example, in Step 1, you have this code in the Example section:

config Main
{
    action abstract static void CalculatorAdapter.Add(int x, int y);
    action abstract event static void CalculatorAdapter.Show(int z);
}


then,  in Steps 2.2 "Declare a rule methods for actions in your config.", you'll be given assistance by the "Declare rule methods" wizard (the blue hyperlink when you expand the sub-step), which when you follow, will create these codes:

static class ModelProgram
{
     [Action("Add(x, y)")]
     static void Add(int x, int y)
     {
         throw new NotImplementedException();
     }

     [Action("Show(z)")]
     static void Show(int z)
     {
         throw new NotImplementedException();
     }
}


But then again, when you go to the bottom of that step, you have this example:

static class ModelProgram
{
    static bool b; //state variable
    [Action]
    static void Negate() //rule method
    { b = !b; }
}

So the question becomes: which are the correct codes, the one in the Example section or the one generated by the wizard?

4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete

What a line of code

I didn't know this line of code (in any language) will make sense but apparently it does: auto l = [](){}; Look at all those bracke...