This project is read-only.
Creating your first Feature Model using the Feature Model DSL

This tutorial explains the basic functionality of the Feature Model DSL.

1. Right-click any C# project and select Add -> New Item. Choose FeatureModel from the items list and give your feature model a name. In the example below, I'm going to create an Arcade Game Feature Model to model features belonging to the arcade games domain.


3. Notice that a .fm and a .tt file were added to the solution. The .fm file is the one containing the feature model diagram. The .tt file is a text transformator that generates a HTML report from your modeled diagram.


4. Your diagram will start with a single Root Feature.


5. You can click once in a feature text to change its name, or change the name and other properties using the Properties Window.


6. Use the Toolbox to model your feature model diagram. You can drag and drop new features and alternative feature sets. You can also connect diagram elements using ordinary or constraint connections.


7. Whenever you save your feature model diagram, the Visual Studio Error List will tell you if there are any errors. Double-clicking an item in the Error List moves the focus to the diagram element causing the error. You can also invoke such a validation explicitly by right-clicking the diagram and selecting Validate All.


8. To generate a HTML report of your feature model, click in the Transform All Templates button in the Solution Explorer.


9. The HTML file containing the report will be just under the .tt file in Solution Explorer. You can right-click it and then click in View in browser.


10. Let's suppose now that you'd like to detail the Non-Playable Character in its own feature model diagram. To do that, you should add a new feature model diagram to your solution. Then, in the first feature model, mark the Non-Playable Character feature as a reference, by setting its IsReference property to true. Then, we should point the Definition Feature Model File property to the .fm where that feature is detailed. A property editor dialog will help us to search for that. Finally, you'll notice that an arrow decorator tells us that the Non-Playable Character feature is now a reference, and we can now double-click it to navigate to its definition feature model file (or right-click -> Go to definition feature model).


11. In the second feature model diagram, click in any blank area and set the diagram's Parent Feature Model File property to the original feature model diagram. Now we can right-click any blank area in the second diagram and navigate back to the parent diagram. All of such back and forth diagram links are also reflected in the generated HTML reports as well.


12. At anytime, you can export a diaram to a .png image file. Just right-click -> Export diagram... to do that.


A final remark: If you rename your .fm file, ensure rename the .tt as well and open it to edit the requires attribute appropriately, making such attribute to point to the new feature model file name. Otherwise, it'll not be possible to generate the HTML report.

Last edited Apr 30, 2012 at 4:36 AM by AFurtado, version 9


No comments yet.