Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

288 linhas
8.9KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <style>
  6. #header
  7. {
  8. background: #2BA6E3;
  9. padding: 0.7em;
  10. text-align: left;
  11. }
  12. #header a
  13. {
  14. color: white;
  15. text-decoration: none;
  16. padding: 0.5em 1em 0.5em 1em;
  17. }
  18. #lang
  19. {
  20. float: right;
  21. }
  22. .news_item
  23. {
  24. background: #FFFFFF;
  25. width: 720px;
  26. padding: 1em;
  27. margin-top: 2em;
  28. margin-bottom: 2em;
  29. border: 1px solid #E0E0E0;
  30. text-align: left;
  31. }
  32. .news_item_contents
  33. {
  34. color: #444;
  35. line-height: 1.5em;
  36. }
  37. .news_item_date
  38. {
  39. margin-bottom: 2em;
  40. color: #aaa;
  41. }
  42. html
  43. {
  44. font-family: sans-serif;
  45. }
  46. body
  47. {
  48. background: #FAFAFA;
  49. }
  50. code, pre
  51. {
  52. font-family: monospace, serif;
  53. font-size: 1em;
  54. color: #7f0a0c;
  55. }
  56. img
  57. {
  58. width: 720px;
  59. }
  60. a
  61. {
  62. color: #3A91CB;
  63. text-decoration: none;
  64. }
  65. table
  66. {
  67. border-collapse: collapse;
  68. }
  69. table, th, td
  70. {
  71. border: 1px solid #aaa;
  72. padding: 0.5em;
  73. margin-top: 0.5em;
  74. margin-bottom: 0.5em;
  75. }
  76. </style>
  77. </head>
  78. <body>
  79. <div id="header">
  80. <strong id="title">Open Game Studio</strong>
  81. <a href="../../en/news/index.html">News</a>
  82. <a href="../../en/game/index.html">Games</a>
  83. <a href="../../en/tool/index.html">Tools</a>
  84. <a href="../../en/page/about.html">About</a>
  85. <div id="lang">
  86. <a href="../../en/news/2016-august-recap.html">EN</a>
  87. <a href="../../ru/news/2016-august-recap.html">RU</a>
  88. </div>
  89. </div>
  90. <center>
  91. <h1>In the news...</h1>
  92. <div class="news_item">
  93. <h2 class="news_item_title">
  94. <a href="2016-august-recap.html">August 2016 recap</a>
  95. </h2>
  96. <p class="news_item_date">
  97. 2016-09-03 00:00
  98. </p>
  99. <div class="news_item_contents">
  100. <p><img src="../../images/2016-09-03_august-recap.png" alt="OGS Editor with a spherical scene node" /></p>
  101. <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>
  102. <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>
  103. <p>Here is a list of UIQt module components with their description and current code size:<table>
  104. <tr>
  105. <th><strong>№</strong></th>
  106. <th><strong>Component</strong></th>
  107. <th><strong>Description</strong></th>
  108. <th><strong>Size (B)</strong></th>
  109. <th><strong>Size (%)</strong></th>
  110. </tr>
  111. <tr>
  112. <td>1</td>
  113. <td>UIQtAction</td>
  114. <td>Actions (events) for menus</td>
  115. <td>11224</td>
  116. <td>9</td>
  117. </tr>
  118. <tr>
  119. <td>2</td>
  120. <td>UIQtAux</td>
  121. <td>Initializes Qt and main window. Provides widget resolution by name to other components</td>
  122. <td>15518</td>
  123. <td>12</td>
  124. </tr>
  125. <tr>
  126. <td>3</td>
  127. <td>UIQtDock</td>
  128. <td>Widget docks</td>
  129. <td>5273</td>
  130. <td>4</td>
  131. </tr>
  132. <tr>
  133. <td>4</td>
  134. <td>UIQtFileDialog</td>
  135. <td>File selection dialogs</td>
  136. <td>8960</td>
  137. <td>7</td>
  138. </tr>
  139. <tr>
  140. <td>5</td>
  141. <td>UIQtMenu</td>
  142. <td>Menus for main window and pop-ups (like node's add/copy/paste/delete menu)</td>
  143. <td>4566</td>
  144. <td>3</td>
  145. </tr>
  146. <tr>
  147. <td>6</td>
  148. <td>UIQtMenuBar</td>
  149. <td>Menu bar for main window</td>
  150. <td>4222</td>
  151. <td>3</td>
  152. </tr>
  153. <tr>
  154. <td>7</td>
  155. <td>UIQtRunner</td>
  156. <td>Allows to start QApplication</td>
  157. <td>2450</td>
  158. <td>2</td>
  159. </tr>
  160. <tr>
  161. <td>8</td>
  162. <td>UIQtThumbnailDialog</td>
  163. <td>Dialog with thumbnail images</td>
  164. <td>18615</td>
  165. <td>14</td>
  166. </tr>
  167. <tr>
  168. <td>9</td>
  169. <td>UIQtToolBar</td>
  170. <td>Tool bar for main window</td>
  171. <td>4276</td>
  172. <td>3</td>
  173. </tr>
  174. <tr>
  175. <td>10</td>
  176. <td>UIQtTree</td>
  177. <td>Provides complex widgets like Scene tree and Property browser</td>
  178. <td>51216</td>
  179. <td>39</td>
  180. </tr>
  181. <tr>
  182. <td>11</td>
  183. <td>UIQtWidget</td>
  184. <td>Common widget properties like focus and visibility</td>
  185. <td>5465</td>
  186. <td>4</td>
  187. </tr>
  188. </table></p>
  189. <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>
  190. <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>
  191. <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>
  192. <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>
  193. <p>Here is a list of current UIQtTree features:</p>
  194. <table>
  195. <tr>
  196. <th>**№**</th>
  197. <th>**Feature**</th>
  198. <th>**Description**</th>
  199. <th>**Size (B)**</th>
  200. <th>**Size (%)**</th>
  201. </tr>
  202. <tr>
  203. <td>1</td>
  204. <td>Base</td>
  205. <td>Allows to construct item hierarchy, modify it, and display it</td>
  206. <td>26966</td>
  207. <td>52</td>
  208. </tr>
  209. <tr>
  210. <td>2</td>
  211. <td>Item open state</td>
  212. <td>Keeps track of collapsed/expanded item properties</td>
  213. <td>3094</td>
  214. <td>6</td>
  215. </tr>
  216. <tr>
  217. <td>3</td>
  218. <td>Item renaming</td>
  219. <td>Allows to rename an item</td>
  220. <td>3471</td>
  221. <td>7</td>
  222. </tr>
  223. <tr>
  224. <td>4</td>
  225. <td>Item selection</td>
  226. <td>Allows to get/set selected item</td>
  227. <td>2338</td>
  228. <td>5</td>
  229. </tr>
  230. <tr>
  231. <td>5</td>
  232. <td>Item value</td>
  233. <td>Provides 2nd and the rest columns for items, used by Property browser</td>
  234. <td>1307</td>
  235. <td>3</td>
  236. </tr>
  237. <tr>
  238. <td>6</td>
  239. <td>Item value editing</td>
  240. <td>Allows to edit item values with a default editor widget</td>
  241. <td>1996</td>
  242. <td>4</td>
  243. </tr>
  244. <tr>
  245. <td>7</td>
  246. <td>Item value editing with combobox</td>
  247. <td>Provides combobox editor</td>
  248. <td>5819</td>
  249. <td>11</td>
  250. </tr>
  251. <tr>
  252. <td>8</td>
  253. <td>Item value editing with spinner</td>
  254. <td>Provides spinbox editor</td>
  255. <td>5290</td>
  256. <td>10</td>
  257. </tr>
  258. <tr>
  259. <td>9</td>
  260. <td>Menu</td>
  261. <td>Provides pop-up menu</td>
  262. <td>1248</td>
  263. <td>2</td>
  264. </tr>
  265. </table>
  266. <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>
  267. <p><strong>Benefits of the approach</strong> include:</p>
  268. <ol>
  269. <li>Faster code reading/understanding due to small size</li>
  270. <li>Easier and safer modification due to isolated code</li>
  271. </ol>
  272. <p>There's a drawback, too: new approach requires learning.</p>
  273. <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>
  274. </div>
  275. </div>
  276. <div id="footer">
  277. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  278. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  279. The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
  280. </div>
  281. </center>
  282. </body>
  283. </html>