Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

301 rinda
9.7KB

  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="utf-8" />
  4. <!-- Set the viewport width to device width for mobile -->
  5. <meta name="viewport" content="width=device-width" />
  6. <title>August 2016 recap</title>
  7. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/normalize.css" />
  8. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/foundation.min.css" />
  9. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/style.css" />
  10. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/pygments.css" />
  11. <script src="http://opengamestudio.org/theme/js/custom.modernizr.js"></script>
  12. <!-- So Firefox can bookmark->"abo this site" -->
  13. <link href="feeds/all.atom.xml" rel="alternate" title="Opensource Game Studio" type="application/atom+xml">
  14. </head>
  15. <body>
  16. <!-- Nav Bar -->
  17. <nav>
  18. <!-- Show menu items and pages -->
  19. <div class="row">
  20. <div class="large-12 columns top-bar">
  21. <h1><a href="http://opengamestudio.org">Opensource Game Studio</a></h1>
  22. </div>
  23. </div>
  24. <div class="row top-menu">
  25. <div class="large-12 columns">
  26. <a href="pages/projects.html" class="menu-button secondary">Projects</a>
  27. <a href="pages/about.html" class="menu-button secondary">About</a>
  28. </div>
  29. </div>
  30. </nav>
  31. <!-- End Nav -->
  32. <!-- Main Page Content and Sidebar -->
  33. <div class="row">
  34. <!-- Main Blog Content -->
  35. <div class="large-9 columns">
  36. <article>
  37. <header>
  38. <h3 class="article-title"><a href="http://opengamestudio.org/2016-august-recap.html" rel="bookmark"
  39. title="Permalink to August 2016 recap">August 2016 recap</a></h3>
  40. </header>
  41. <h6 class="subheader" title="2016-09-03T00:00:00+03:00">Сб 03 Сентябрь 2016
  42. <a class="button secondary small translation-button" href="http://opengamestudio.org/2016-august-recap-ru.html">ru</a>
  43. </h6> <p><img alt="2016-august-recap" src="http://opengamestudio.org/2016-09-03_august-recap.png" /></p>
  44. <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>
  45. <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>
  46. <p>Here is a list of UIQt module components with their description and current code size:<table>
  47. <tr>
  48. <th><strong>№</strong></th>
  49. <th><strong>Component</strong></th>
  50. <th><strong>Description</strong></th>
  51. <th><strong>Size (B)</strong></th>
  52. <th><strong>Size (%)</strong></th>
  53. </tr>
  54. <tr>
  55. <td>1</td>
  56. <td>UIQtAction</td>
  57. <td>Actions (events) for menus</td>
  58. <td>11224</td>
  59. <td>9</td>
  60. </tr>
  61. <tr>
  62. <td>2</td>
  63. <td>UIQtAux</td>
  64. <td>Initializes Qt and main window. Provides widget resolution by name to other components</td>
  65. <td>15518</td>
  66. <td>12</td>
  67. </tr>
  68. <tr>
  69. <td>3</td>
  70. <td>UIQtDock</td>
  71. <td>Widget docks</td>
  72. <td>5273</td>
  73. <td>4</td>
  74. </tr>
  75. <tr>
  76. <td>4</td>
  77. <td>UIQtFileDialog</td>
  78. <td>File selection dialogs</td>
  79. <td>8960</td>
  80. <td>7</td>
  81. </tr>
  82. <tr>
  83. <td>5</td>
  84. <td>UIQtMenu</td>
  85. <td>Menus for main window and pop-ups (like node's add/copy/paste/delete menu)</td>
  86. <td>4566</td>
  87. <td>3</td>
  88. </tr>
  89. <tr>
  90. <td>6</td>
  91. <td>UIQtMenuBar</td>
  92. <td>Menu bar for main window</td>
  93. <td>4222</td>
  94. <td>3</td>
  95. </tr>
  96. <tr>
  97. <td>7</td>
  98. <td>UIQtRunner</td>
  99. <td>Allows to start QApplication</td>
  100. <td>2450</td>
  101. <td>2</td>
  102. </tr>
  103. <tr>
  104. <td>8</td>
  105. <td>UIQtThumbnailDialog</td>
  106. <td>Dialog with thumbnail images</td>
  107. <td>18615</td>
  108. <td>14</td>
  109. </tr>
  110. <tr>
  111. <td>9</td>
  112. <td>UIQtToolBar</td>
  113. <td>Tool bar for main window</td>
  114. <td>4276</td>
  115. <td>3</td>
  116. </tr>
  117. <tr>
  118. <td>10</td>
  119. <td>UIQtTree</td>
  120. <td>Provides complex widgets like Scene tree and Property browser</td>
  121. <td>51216</td>
  122. <td>39</td>
  123. </tr>
  124. <tr>
  125. <td>11</td>
  126. <td>UIQtWidget</td>
  127. <td>Common widget properties like focus and visibility</td>
  128. <td>5465</td>
  129. <td>4</td>
  130. </tr>
  131. </table></p>
  132. <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>
  133. <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>
  134. <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>
  135. <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>
  136. <p>Here is a list of current UIQtTree features:</p>
  137. <table>
  138. <tr>
  139. <th>**№**</th>
  140. <th>**Feature**</th>
  141. <th>**Description**</th>
  142. <th>**Size (B)**</th>
  143. <th>**Size (%)**</th>
  144. </tr>
  145. <tr>
  146. <td>1</td>
  147. <td>Base</td>
  148. <td>Allows to construct item hierarchy, modify it, and display it</td>
  149. <td>26966</td>
  150. <td>52</td>
  151. </tr>
  152. <tr>
  153. <td>2</td>
  154. <td>Item open state</td>
  155. <td>Keeps track of collapsed/expanded item properties</td>
  156. <td>3094</td>
  157. <td>6</td>
  158. </tr>
  159. <tr>
  160. <td>3</td>
  161. <td>Item renaming</td>
  162. <td>Allows to rename an item</td>
  163. <td>3471</td>
  164. <td>7</td>
  165. </tr>
  166. <tr>
  167. <td>4</td>
  168. <td>Item selection</td>
  169. <td>Allows to get/set selected item</td>
  170. <td>2338</td>
  171. <td>5</td>
  172. </tr>
  173. <tr>
  174. <td>5</td>
  175. <td>Item value</td>
  176. <td>Provides 2nd and the rest columns for items, used by Property browser</td>
  177. <td>1307</td>
  178. <td>3</td>
  179. </tr>
  180. <tr>
  181. <td>6</td>
  182. <td>Item value editing</td>
  183. <td>Allows to edit item values with a default editor widget</td>
  184. <td>1996</td>
  185. <td>4</td>
  186. </tr>
  187. <tr>
  188. <td>7</td>
  189. <td>Item value editing with combobox</td>
  190. <td>Provides combobox editor</td>
  191. <td>5819</td>
  192. <td>11</td>
  193. </tr>
  194. <tr>
  195. <td>8</td>
  196. <td>Item value editing with spinner</td>
  197. <td>Provides spinbox editor</td>
  198. <td>5290</td>
  199. <td>10</td>
  200. </tr>
  201. <tr>
  202. <td>9</td>
  203. <td>Menu</td>
  204. <td>Provides pop-up menu</td>
  205. <td>1248</td>
  206. <td>2</td>
  207. </tr>
  208. </table>
  209. <p>Here's an example of UIQtTree Menu feature file: <a href="https://bitbucket.org/ogstudio-history/mjin/src/0c4cc3c3213f4687c0f3bd6a5426a6054cadd79b/f/TREE_MENU.cpp?at=Studio+0.10&amp;fileviewer=file-view-default">TREE_MENU</a>.</p>
  210. <p><strong>Benefits of the approach</strong> include:</p>
  211. <ol>
  212. <li>Faster code reading/understanding due to small size</li>
  213. <li>Easier and safer modification due to isolated code</li>
  214. </ol>
  215. <p>There's a drawback, too: new approach requires learning.</p>
  216. <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>
  217. <p class="subheader">Category: <a href="http://opengamestudio.org/category/news.html">News</a>
  218. </p>
  219. </article>
  220. </div>
  221. <!-- End Main Content -->
  222. <!-- Sidebar -->
  223. <aside class="large-3 columns">
  224. <!--k
  225. <h5 class="sidebar-title">Site</h5>
  226. <ul class="side-nav">
  227. <li><a href="http://opengamestudio.org/archives.html">Archives</a>
  228. <li><a href="http://opengamestudio.org/tags.html">Tags</a>
  229. <li><a href="http://opengamestudio.org/feeds/all.atom.xml" rel="alternate">Atom feed</a></li>
  230. </ul>
  231. <h5 class="sidebar-title">Categories</h5>
  232. <ul class="side-nav">
  233. <li><a href="http://opengamestudio.org/category/news.html">News</a></li>
  234. </ul>
  235. -->
  236. <h5 class="sidebar-title">Ads</h5>
  237. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  238. <!-- ogs2 -->
  239. <ins class="adsbygoogle"
  240. style="display:block"
  241. data-ad-client="ca-pub-4473792248813084"
  242. data-ad-slot="9024247127"
  243. data-ad-format="auto"></ins>
  244. <script>
  245. (adsbygoogle = window.adsbygoogle || []).push({});
  246. </script>
  247. </aside> <!-- End Sidebar -->
  248. </div> <!-- End Main Content and Sidebar -->
  249. <!-- Footer -->
  250. <footer class="row">
  251. <div class="large-12 columns">
  252. <hr />
  253. <div class="row">
  254. <div class="large-7 columns">
  255. <p>Proudly powered by <a href="http://getpelican.com">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.</p>
  256. </div>
  257. </div>
  258. </div>
  259. <script type="text/javascript">
  260. var _gaq = _gaq || [];
  261. _gaq.push(['_setAccount', 'UA-3773114-1']);
  262. _gaq.push(['_trackPageview']);
  263. (function() {
  264. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  265. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  266. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  267. })();
  268. </script>
  269. </footer>