feature_model_diagrams.htm 5.8 KB

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