Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

302 Zeilen
9.8KB

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