saeaadl / aadlv3

Public area for discussion of new AADL V3 concepts and minor improvements
4 stars 0 forks source link

Relax requirement for component type in subcomponent declaration #13

Open smithdtyler opened 7 years ago

smithdtyler commented 7 years ago

When declaring subcomponents, the type of each subcomponent is known a priori from its source. For example, in the process implementation below I declare a subcomponent called 'pizzaThread', which is taken from the Food package:

  process implementation pizzaProcess.impl
    subcomponents
      pizzaThread : thread Food::pizzaThread.impl;
  end pizzaProcess.impl;

The word 'thread' in the declaration of pizzaThread is unnecessary, as it's implied from the definition of Food::pizzaThread.impl.

yoogx commented 7 years ago

My view on that is that removing the "thread" in subcomponent would create a lot of issues in terms of readability.

When I read (as a human) the list of subcomponents, i do not want to venture across all the model space to check whether it is a data or a thread.

Furthermore, it forces some contracts: it I use pizzaThread.impl, I expect this one to be a thread, and stay a thread. If for some reasons the category of "pizzaThread.impl" is changed later, I want to be notifie through typing errors. and the fact that its name is Thread is by no way an indication of its actual category, but simply your modelling convention.

This is the least I would expect from an ADL for safety critical systems.: typing over naming conventions

If you do not want to type ": thread", then instruct the editor that in the context of a process, the list of expected subcomponents , and implement smart completion.

smithdtyler commented 7 years ago

When I read (as a human) the list of subcomponents, I do not want to venture across all the model space to check whether it is a data or a thread.

I'd hope that the IDE would allow me to CTRL+click or hover on the thread reference to see its type declaration, as is possible in most languages and most IDEs.

Furthermore, it forces some contracts: it I use pizzaThread.impl, I expect this one to be a thread, and stay a thread. If for some reasons the category of pizzaThread.impl is changed later, I want to be notified through typing errors. and the fact that its name is Thread is by no way an indication of its actual category, but simply your modelling convention.

I think requiring thread in the subcomponent reference results in spurious errors, not helpful ones.

I expect that in most models, changing the type of pizzaThread.impl from thread to data would cause a variety of compilation issues aside from references as a subcomponent (e.g., property assignment). The category of pizzaThread.impl is trivially known to the compiler and quickly discoverable by the modeler.

I have no objection to allowing explicit statement of the category, but I'd like it to be optional so I can make my models more concise and refactor them more easily.

buzden commented 7 years ago

Furthermore, it forces some contracts: it I use pizzaThread.impl, I expect this one to be a thread, and stay a thread.

The question is whether do you actually have such contract each time you add a subcomponent or not. What if I want to have any pizza.impl not depending on what is it -- thread or not -- and only thing I would want to know about it is that this subcomponent has a particular property.

This issue is related to the similar one in native languages. For instance, Chineese does not have a grammatic way to express the gender of a subject, it has special words to set gender and these words are used only when you need to specify it. English forces to specify gender each time when pronouns are used but if you do not have pronouns, you are not forced to express gender in a sentence. Russian forces to specify gender each time you use a verb, i.e. in almost every sentence. All three approaches give you way to express gender when you need it but some approaches are more flexible when you do not have particular information or when you do not need to express it.

The same in AADL. My interpretation is that Tyler says "Give me an ability to not to express category when I'm not aware of it". Jerome says "When category is expressed, this would give me automatic checks of correctness". I would say, both are right, but I agree with Tyler that I would like to be not so restricted each time I declare a subcomponent.