1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | <html> |
---|
3 | |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> |
---|
6 | <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> |
---|
7 | <meta name="ProgId" content="FrontPage.Editor.Document"> |
---|
8 | <title>Feature Model Diagrams</title> |
---|
9 | </head> |
---|
10 | |
---|
11 | <body bgcolor="#FFFFFF" text="#000000"> |
---|
12 | |
---|
13 | <p><img border="0" src="../boost.png" alt="Boost logo" width="277" height="86"></p> |
---|
14 | <h1>Feature Model Diagrams in text and HTML</h1> |
---|
15 | <p>By <a href="../people/beman_dawes.html">Beman Dawes</a></p> |
---|
16 | <h2>Introduction</h2> |
---|
17 | <p>In their seminal book, Generative Programming, Czarnecki and Eisenecker (<a href="#Generative%20Programming">C&E</a>)) |
---|
18 | describe how to build feature models [C&E 4.4] consisting of a feature |
---|
19 | diagram plus semantic, rationale, and other attributes. Feature models are |
---|
20 | then used to drive design cycles which eventually lead to manual or automatic |
---|
21 | assembly of configurations.</p> |
---|
22 | <p>Feature models provide a language to describe the library variability that is |
---|
23 | often such an issue in boost.org discussions. The Whorf hypothesis that |
---|
24 | "Language shapes the way we think, and determines what we can think |
---|
25 | about" seems to apply. In discussion of library variability issues, |
---|
26 | we have been crippled by lack of a good language. With feature models we now |
---|
27 | have a language to carry on the dialog.</p> |
---|
28 | <p>The graphical feature diagrams presented by C&E are not in a suitable |
---|
29 | form for the email discussions boost.org depends upon. The hierarchical nature |
---|
30 | of feature diagrams can be represented by a simple text-based feature diagram |
---|
31 | language. A feature model can also take advantage of the hyperlinks |
---|
32 | inherent in HTML.</p> |
---|
33 | <h2><a name="Grammar">Grammar</a></h2> |
---|
34 | <p>The grammar for the feature diagram language is expressed in Extended |
---|
35 | Bakus-Naur Form; ::= represents productions, [...] represents options, {...} |
---|
36 | represents zero or more instances, and represents | alternatives.</p> |
---|
37 | <blockquote> |
---|
38 | <pre>feature-model ::= concept-name details { feature }</pre> |
---|
39 | <pre>feature ::= feature-name [details]</pre> |
---|
40 | <pre>details ::= "(" feature-list ")" // required features |
---|
41 | | "[" feature-list "]" // optional features</pre> |
---|
42 | <pre>feature-list ::= element { "|" element } // one only |
---|
43 | | element { "+" element } // one or more |
---|
44 | | element { "," element } // all |
---|
45 | // [a+b] equivalent to [a,b]</pre> |
---|
46 | <pre>element ::= feature |
---|
47 | | details</pre> |
---|
48 | <pre>concept-name ::= name</pre> |
---|
49 | <pre>feature-name ::= name</pre> |
---|
50 | </blockquote> |
---|
51 | <p>The usual lexical conventions apply. Names are case-insensitive and consist |
---|
52 | of a leading letter, followed by letters, digits, underscores or hyphens, with |
---|
53 | no spaces allowed.</p> |
---|
54 | <p>At least one instance of each name should be hyperlinked to the corresponding |
---|
55 | <a href="#FeatureDescriptions">Feature Description</a>.</p> |
---|
56 | <p>While the grammar is intended for written communication between people, it |
---|
57 | may also be trivially machine parsed for use by automatic tools.</p> |
---|
58 | <h2><a id="FeatureDescriptions" name="FeatureDescriptions"></a></h2> |
---|
59 | <p>Descriptive information is associated with each concept or feature. According |
---|
60 | to [C&E 4.4.2] this includes:</p> |
---|
61 | <ul> |
---|
62 | <li>Semantic descriptions.</li> |
---|
63 | <li>Rationale.</li> |
---|
64 | <li>Stakeholders and client programs.</li> |
---|
65 | <li>Exemplar systems.</li> |
---|
66 | <li>Constraints and default dependency rules.</li> |
---|
67 | <li>Availability sites, binding sites, and binding mode.</li> |
---|
68 | <li>Open/Closed attribute.</li> |
---|
69 | </ul> |
---|
70 | <h2>What is a Feature?</h2> |
---|
71 | <p>A feature [C&E 4.9.1] is "anything users or client programs might |
---|
72 | want to control about a concept. Thus, during feature modeling, we |
---|
73 | document no only functional features ... but also implementation features, ..., |
---|
74 | various optimizations, alternative implementation techniques, and so on."</p> |
---|
75 | <h2>Example</h2> |
---|
76 | <blockquote> |
---|
77 | <pre>special-container ( organization, |
---|
78 | performance, |
---|
79 | interface ) // all required</pre> |
---|
80 | <pre>organization [ ordered + indexed ] // zero or more (4 configurations)</pre> |
---|
81 | <pre>indexed [ hash-function ] // zero or one (2 configurations)</pre> |
---|
82 | <pre>performance ( fast | small | balanced ) // exactly one (3 configurations)</pre> |
---|
83 | <pre>interface ( STL-style + cursor-style ) // one or more (3 configurations)</pre> |
---|
84 | </blockquote> |
---|
85 | <p>There should be feature descriptions for <code>some-container, organization, |
---|
86 | ordered, indexed, hash-function, performance, fast, small, balanced, interface, |
---|
87 | STL-style, and cursor-style</code>.</p> |
---|
88 | <p>The number of possible configurations is (2 + 2*2) * 3 * 3 = 54, |
---|
89 | assuming no constraints.</p> |
---|
90 | <p>There are equivalent representations. For example:</p> |
---|
91 | <blockquote> |
---|
92 | <pre>special-container ( organization[ ordered+indexed[ hash-function ]], |
---|
93 | performance( fast|small|balanced ), |
---|
94 | interface( STL-style+cursor-style ) )</pre> |
---|
95 | </blockquote> |
---|
96 | <h2>References</h2> |
---|
97 | <p>Krzysztof Czarnecki and Ulrich W. Eisenecker, <a href="http://www.generative-programming.org">Generative |
---|
98 | Programming</a>, Addison-Wesley, 2000, ISBN 0-201-30977-7</p> |
---|
99 | <hr> |
---|
100 | <p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B %Y" startspan -->26 August 2004<!--webbot bot="Timestamp" endspan i-checksum="32277" --></p> |
---|
101 | <p>© Copyright Beman Dawes, 2000</p> |
---|
102 | |
---|
103 | <p> |
---|
104 | Distributed under the Boost Software License, Version 1.0. (See |
---|
105 | accompanying file <a href="../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy |
---|
106 | at <a href= |
---|
107 | "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>) |
---|
108 | </p> |
---|
109 | |
---|
110 | </body> |
---|
111 | |
---|
112 | </html> |
---|