You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
8.4KB

  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>
  11. <strong id="title">Open Game Studio</strong>
  12. <div id="lang">
  13. <a href="../../en/news/2016-august-recap.html">EN</a>
  14. <a href="../../ru/news/2016-august-recap.html">RU</a>
  15. </div>
  16. </div>
  17. <div class="header2">
  18. <div class="menu">
  19. <a href="../../en/news/index.html">News</a>
  20. <a href="../../en/game/index.html">Games</a>
  21. <a href="../../en/tool/index.html">Tools</a>
  22. <a href="../../en/page/about.html">About</a>
  23. </div>
  24. <a class="discord" href="https://discord.gg/3A6THQabNf">
  25. <img src="../../images/discord.png"></img>
  26. </a>
  27. <div class="clear"></div>
  28. </div>
  29. </div>
  30. <h3 class="left_item_title">In the news...</h3>
  31. <center>
  32. <div class="news_item">
  33. <h2 class="news_item_title">
  34. <a href="2016-august-recap.html">August 2016 recap</a>
  35. </h2>
  36. <p class="news_item_date">
  37. 2016-09-03 00:00
  38. </p>
  39. <div class="news_item_contents">
  40. <p><img src="../../images/2016-09-03_august-recap.png" alt="OGS Editor with a spherical scene node" /></p>
  41. <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>
  42. <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>
  43. <p>Here is a list of UIQt module components with their description and current code size:<table>
  44. <tr>
  45. <th><strong>№</strong></th>
  46. <th><strong>Component</strong></th>
  47. <th><strong>Description</strong></th>
  48. <th><strong>Size (B)</strong></th>
  49. <th><strong>Size (%)</strong></th>
  50. </tr>
  51. <tr>
  52. <td>1</td>
  53. <td>UIQtAction</td>
  54. <td>Actions (events) for menus</td>
  55. <td>11224</td>
  56. <td>9</td>
  57. </tr>
  58. <tr>
  59. <td>2</td>
  60. <td>UIQtAux</td>
  61. <td>Initializes Qt and main window. Provides widget resolution by name to other components</td>
  62. <td>15518</td>
  63. <td>12</td>
  64. </tr>
  65. <tr>
  66. <td>3</td>
  67. <td>UIQtDock</td>
  68. <td>Widget docks</td>
  69. <td>5273</td>
  70. <td>4</td>
  71. </tr>
  72. <tr>
  73. <td>4</td>
  74. <td>UIQtFileDialog</td>
  75. <td>File selection dialogs</td>
  76. <td>8960</td>
  77. <td>7</td>
  78. </tr>
  79. <tr>
  80. <td>5</td>
  81. <td>UIQtMenu</td>
  82. <td>Menus for main window and pop-ups (like node's add/copy/paste/delete menu)</td>
  83. <td>4566</td>
  84. <td>3</td>
  85. </tr>
  86. <tr>
  87. <td>6</td>
  88. <td>UIQtMenuBar</td>
  89. <td>Menu bar for main window</td>
  90. <td>4222</td>
  91. <td>3</td>
  92. </tr>
  93. <tr>
  94. <td>7</td>
  95. <td>UIQtRunner</td>
  96. <td>Allows to start QApplication</td>
  97. <td>2450</td>
  98. <td>2</td>
  99. </tr>
  100. <tr>
  101. <td>8</td>
  102. <td>UIQtThumbnailDialog</td>
  103. <td>Dialog with thumbnail images</td>
  104. <td>18615</td>
  105. <td>14</td>
  106. </tr>
  107. <tr>
  108. <td>9</td>
  109. <td>UIQtToolBar</td>
  110. <td>Tool bar for main window</td>
  111. <td>4276</td>
  112. <td>3</td>
  113. </tr>
  114. <tr>
  115. <td>10</td>
  116. <td>UIQtTree</td>
  117. <td>Provides complex widgets like Scene tree and Property browser</td>
  118. <td>51216</td>
  119. <td>39</td>
  120. </tr>
  121. <tr>
  122. <td>11</td>
  123. <td>UIQtWidget</td>
  124. <td>Common widget properties like focus and visibility</td>
  125. <td>5465</td>
  126. <td>4</td>
  127. </tr>
  128. </table></p>
  129. <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>
  130. <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>
  131. <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>
  132. <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>
  133. <p>Here is a list of current UIQtTree features:</p>
  134. <table>
  135. <tr>
  136. <th>**№**</th>
  137. <th>**Feature**</th>
  138. <th>**Description**</th>
  139. <th>**Size (B)**</th>
  140. <th>**Size (%)**</th>
  141. </tr>
  142. <tr>
  143. <td>1</td>
  144. <td>Base</td>
  145. <td>Allows to construct item hierarchy, modify it, and display it</td>
  146. <td>26966</td>
  147. <td>52</td>
  148. </tr>
  149. <tr>
  150. <td>2</td>
  151. <td>Item open state</td>
  152. <td>Keeps track of collapsed/expanded item properties</td>
  153. <td>3094</td>
  154. <td>6</td>
  155. </tr>
  156. <tr>
  157. <td>3</td>
  158. <td>Item renaming</td>
  159. <td>Allows to rename an item</td>
  160. <td>3471</td>
  161. <td>7</td>
  162. </tr>
  163. <tr>
  164. <td>4</td>
  165. <td>Item selection</td>
  166. <td>Allows to get/set selected item</td>
  167. <td>2338</td>
  168. <td>5</td>
  169. </tr>
  170. <tr>
  171. <td>5</td>
  172. <td>Item value</td>
  173. <td>Provides 2nd and the rest columns for items, used by Property browser</td>
  174. <td>1307</td>
  175. <td>3</td>
  176. </tr>
  177. <tr>
  178. <td>6</td>
  179. <td>Item value editing</td>
  180. <td>Allows to edit item values with a default editor widget</td>
  181. <td>1996</td>
  182. <td>4</td>
  183. </tr>
  184. <tr>
  185. <td>7</td>
  186. <td>Item value editing with combobox</td>
  187. <td>Provides combobox editor</td>
  188. <td>5819</td>
  189. <td>11</td>
  190. </tr>
  191. <tr>
  192. <td>8</td>
  193. <td>Item value editing with spinner</td>
  194. <td>Provides spinbox editor</td>
  195. <td>5290</td>
  196. <td>10</td>
  197. </tr>
  198. <tr>
  199. <td>9</td>
  200. <td>Menu</td>
  201. <td>Provides pop-up menu</td>
  202. <td>1248</td>
  203. <td>2</td>
  204. </tr>
  205. </table>
  206. <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>
  207. <p><strong>Benefits of the approach</strong> include:</p>
  208. <ol>
  209. <li>Faster code reading/understanding due to small size</li>
  210. <li>Easier and safer modification due to isolated code</li>
  211. </ol>
  212. <p>There's a drawback, too: new approach requires learning.</p>
  213. <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>
  214. </div>
  215. </div>
  216. <div id="disqus_thread"></div>
  217. <script>
  218. var disqus_config = function () {
  219. this.page.url = "https://opengamestudio.org/en/news/2016-august-recap.html";
  220. this.page.identifier = "2016-august-recap.html";
  221. };
  222. (function() { // DON'T EDIT BELOW THIS LINE
  223. var d = document, s = d.createElement('script');
  224. s.src = 'https://opengamestudio.disqus.com/embed.js';
  225. s.setAttribute('data-timestamp', +new Date());
  226. (d.head || d.body).appendChild(s);
  227. })();
  228. </script>
  229. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  230. <div id="footer">
  231. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  232. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  233. </div>
  234. </center>
  235. </body>
  236. </html>