Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

2016-august-recap.html 8.2KB

2 månader sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <link rel="stylesheet" href="../../style.css">
  6. </head>
  7. <body>
  8. <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
  9. <div id="header">
  10. <div class="header2">
  11. <div class="menu">
  12. <a href="../../en/news/index.html">News</a>
  13. <a href="../../en/game/index.html">Games</a>
  14. <a href="../../en/tool/index.html">Tools</a>
  15. <a href="../../en/page/about.html">About</a>
  16. </div>
  17. <div id="lang">
  18. <a href="../../en/news/2016-august-recap.html">EN</a>
  19. <a href="../../ru/news/2016-august-recap.html">RU</a>
  20. </div>
  21. <div class="clear"></div>
  22. </div>
  23. </div>
  24. <h3 class="left_item_title">In the news...</h3>
  25. <center>
  26. <div class="news_item">
  27. <h2 class="news_item_title">
  28. <a href="2016-august-recap.html">August 2016 recap</a>
  29. </h2>
  30. <p class="news_item_date">
  31. 2016-09-03 00:00
  32. </p>
  33. <div class="news_item_contents">
  34. <p><img src="../../images/2016-09-03_august-recap.png" alt="OGS Editor with a spherical scene node" /></p>
  35. <p>This article explains the most important technical details about development in August: UIQt module, its refactoring, a new feature based development approach, and its benefits.</p>
  36. <p><strong>UIQt module</strong> is a collection of UI components backed by Qt. We only use it for Editor UI at the moment.</p>
  37. <p>Here is a list of UIQt module components with their description and current code size:<table>
  38. <tr>
  39. <th><strong>№</strong></th>
  40. <th><strong>Component</strong></th>
  41. <th><strong>Description</strong></th>
  42. <th><strong>Size (B)</strong></th>
  43. <th><strong>Size (%)</strong></th>
  44. </tr>
  45. <tr>
  46. <td>1</td>
  47. <td>UIQtAction</td>
  48. <td>Actions (events) for menus</td>
  49. <td>11224</td>
  50. <td>9</td>
  51. </tr>
  52. <tr>
  53. <td>2</td>
  54. <td>UIQtAux</td>
  55. <td>Initializes Qt and main window. Provides widget resolution by name to other components</td>
  56. <td>15518</td>
  57. <td>12</td>
  58. </tr>
  59. <tr>
  60. <td>3</td>
  61. <td>UIQtDock</td>
  62. <td>Widget docks</td>
  63. <td>5273</td>
  64. <td>4</td>
  65. </tr>
  66. <tr>
  67. <td>4</td>
  68. <td>UIQtFileDialog</td>
  69. <td>File selection dialogs</td>
  70. <td>8960</td>
  71. <td>7</td>
  72. </tr>
  73. <tr>
  74. <td>5</td>
  75. <td>UIQtMenu</td>
  76. <td>Menus for main window and pop-ups (like node's add/copy/paste/delete menu)</td>
  77. <td>4566</td>
  78. <td>3</td>
  79. </tr>
  80. <tr>
  81. <td>6</td>
  82. <td>UIQtMenuBar</td>
  83. <td>Menu bar for main window</td>
  84. <td>4222</td>
  85. <td>3</td>
  86. </tr>
  87. <tr>
  88. <td>7</td>
  89. <td>UIQtRunner</td>
  90. <td>Allows to start QApplication</td>
  91. <td>2450</td>
  92. <td>2</td>
  93. </tr>
  94. <tr>
  95. <td>8</td>
  96. <td>UIQtThumbnailDialog</td>
  97. <td>Dialog with thumbnail images</td>
  98. <td>18615</td>
  99. <td>14</td>
  100. </tr>
  101. <tr>
  102. <td>9</td>
  103. <td>UIQtToolBar</td>
  104. <td>Tool bar for main window</td>
  105. <td>4276</td>
  106. <td>3</td>
  107. </tr>
  108. <tr>
  109. <td>10</td>
  110. <td>UIQtTree</td>
  111. <td>Provides complex widgets like Scene tree and Property browser</td>
  112. <td>51216</td>
  113. <td>39</td>
  114. </tr>
  115. <tr>
  116. <td>11</td>
  117. <td>UIQtWidget</td>
  118. <td>Common widget properties like focus and visibility</td>
  119. <td>5465</td>
  120. <td>4</td>
  121. </tr>
  122. </table></p>
  123. <p><strong>UIQt module refactoring</strong> purpose was to replace old State API with new Environment API, which allows to achieve the same functionality with less code, i.e., makes development easier and faster.</p>
  124. <p>Refactoring started in July and should have been done the same month. However, we only finished the work in August. Initial plan assumed 28 hours would be enough, but we spent 65 instead. We estimated planned time by relying on the number of public API calls of each component. That worked fine for small components, because the number of their public API calls was roughly equal to the number of their features, and features themselves were very small. However, it totally failed for UIQtTree, which contains 39% of UIQt module code, because there was no direct connection between public API and features.</p>
  125. <p><strong>Feature based development approach</strong> was born as a result of UIQtTree refactoring struggle. Since Qt uses MVC, UIQtTree component consists of several classes. By the time UIQtTree could display and manage a hierarchy of items, the component was already 27K in size. We noticed UIQtTree started to require abnormal amount of development time even for tiny features. This was an obvious <a href="http://kornerr.blogspot.com/2012/04/complexity-conservation-law-complexity.html">quantitative complexity</a> manifestation.</p>
  126. <p>We decided to separate UIQtTree into base part and additional ones. Base would only contain minimal code required by all features. Addition would contain specific feature code and could be safely modified. In the case of UIQtTree, item hierarchy display and modification is the minimal functionality, while item renaming is an addition.</p>
  127. <p>Here is a list of current UIQtTree features:</p>
  128. <table>
  129. <tr>
  130. <th>**№**</th>
  131. <th>**Feature**</th>
  132. <th>**Description**</th>
  133. <th>**Size (B)**</th>
  134. <th>**Size (%)**</th>
  135. </tr>
  136. <tr>
  137. <td>1</td>
  138. <td>Base</td>
  139. <td>Allows to construct item hierarchy, modify it, and display it</td>
  140. <td>26966</td>
  141. <td>52</td>
  142. </tr>
  143. <tr>
  144. <td>2</td>
  145. <td>Item open state</td>
  146. <td>Keeps track of collapsed/expanded item properties</td>
  147. <td>3094</td>
  148. <td>6</td>
  149. </tr>
  150. <tr>
  151. <td>3</td>
  152. <td>Item renaming</td>
  153. <td>Allows to rename an item</td>
  154. <td>3471</td>
  155. <td>7</td>
  156. </tr>
  157. <tr>
  158. <td>4</td>
  159. <td>Item selection</td>
  160. <td>Allows to get/set selected item</td>
  161. <td>2338</td>
  162. <td>5</td>
  163. </tr>
  164. <tr>
  165. <td>5</td>
  166. <td>Item value</td>
  167. <td>Provides 2nd and the rest columns for items, used by Property browser</td>
  168. <td>1307</td>
  169. <td>3</td>
  170. </tr>
  171. <tr>
  172. <td>6</td>
  173. <td>Item value editing</td>
  174. <td>Allows to edit item values with a default editor widget</td>
  175. <td>1996</td>
  176. <td>4</td>
  177. </tr>
  178. <tr>
  179. <td>7</td>
  180. <td>Item value editing with combobox</td>
  181. <td>Provides combobox editor</td>
  182. <td>5819</td>
  183. <td>11</td>
  184. </tr>
  185. <tr>
  186. <td>8</td>
  187. <td>Item value editing with spinner</td>
  188. <td>Provides spinbox editor</td>
  189. <td>5290</td>
  190. <td>10</td>
  191. </tr>
  192. <tr>
  193. <td>9</td>
  194. <td>Menu</td>
  195. <td>Provides pop-up menu</td>
  196. <td>1248</td>
  197. <td>2</td>
  198. </tr>
  199. </table>
  200. <p>Here's an example of UIQtTree Menu feature file: <a href="https://bitbucket.org/ogstudio-history/mjin-pre-pre/src/0c4cc3c3213f4687c0f3bd6a5426a6054cadd79b/f/TREE_MENU.cpp?at=Studio+0.10&fileviewer=file-view-default">TREE_MENU</a>.</p>
  201. <p><strong>Benefits of the approach</strong> include:</p>
  202. <ol>
  203. <li>Faster code reading/understanding due to small size</li>
  204. <li>Easier and safer modification due to isolated code</li>
  205. </ol>
  206. <p>There's a drawback, too: new approach requires learning.</p>
  207. <p>That's it for the most important technical details about development in August: UIQt module, its refactoring, a new feature based development approach, and its benefits.</p>
  208. </div>
  209. </div>
  210. <div id="disqus_thread"></div>
  211. <script>
  212. var disqus_config = function () {
  213. this.page.url = "https://opengamestudio.org/en/news/2016-august-recap.html";
  214. this.page.identifier = "2016-august-recap.html";
  215. };
  216. (function() { // DON'T EDIT BELOW THIS LINE
  217. var d = document, s = d.createElement('script');
  218. s.src = 'https://opengamestudio.disqus.com/embed.js';
  219. s.setAttribute('data-timestamp', +new Date());
  220. (d.head || d.body).appendChild(s);
  221. })();
  222. </script>
  223. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  224. <div id="footer">
  225. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  226. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  227. </div>
  228. </center>
  229. </body>
  230. </html>