feature_model_diagrams.htm 5.7 KB

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