|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- Title: August 2016 recap
- Date: 2016-09-03 00:00
- Category: News
- Slug: 2016-august-recap
- Lang: en
-
- ![2016-august-recap][screenshot]
-
-
- 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.
-
- **UIQt module** is a collection of UI components backed by Qt. We only use it for Editor UI at the moment.
-
- Here is a list of UIQt module components with their description and current code size:<table>
- <tr>
- <th>**№**</th>
- <th>**Component**</th>
- <th>**Description**</th>
- <th>**Size (B)**</th>
- <th>**Size (%)**</th>
- </tr>
- <tr>
- <td>1</td>
- <td>UIQtAction</td>
- <td>Actions (events) for menus</td>
- <td>11224</td>
- <td>9</td>
- </tr>
- <tr>
- <td>2</td>
- <td>UIQtAux</td>
- <td>Initializes Qt and main window. Provides widget resolution by name to other components</td>
- <td>15518</td>
- <td>12</td>
- </tr>
- <tr>
- <td>3</td>
- <td>UIQtDock</td>
- <td>Widget docks</td>
- <td>5273</td>
- <td>4</td>
- </tr>
- <tr>
- <td>4</td>
- <td>UIQtFileDialog</td>
- <td>File selection dialogs</td>
- <td>8960</td>
- <td>7</td>
- </tr>
- <tr>
- <td>5</td>
- <td>UIQtMenu</td>
- <td>Menus for main window and pop-ups (like node's add/copy/paste/delete menu)</td>
- <td>4566</td>
- <td>3</td>
- </tr>
- <tr>
- <td>6</td>
- <td>UIQtMenuBar</td>
- <td>Menu bar for main window</td>
- <td>4222</td>
- <td>3</td>
- </tr>
- <tr>
- <td>7</td>
- <td>UIQtRunner</td>
- <td>Allows to start QApplication</td>
- <td>2450</td>
- <td>2</td>
- </tr>
- <tr>
- <td>8</td>
- <td>UIQtThumbnailDialog</td>
- <td>Dialog with thumbnail images</td>
- <td>18615</td>
- <td>14</td>
- </tr>
- <tr>
- <td>9</td>
- <td>UIQtToolBar</td>
- <td>Tool bar for main window</td>
- <td>4276</td>
- <td>3</td>
- </tr>
- <tr>
- <td>10</td>
- <td>UIQtTree</td>
- <td>Provides complex widgets like Scene tree and Property browser</td>
- <td>51216</td>
- <td>39</td>
- </tr>
- <tr>
- <td>11</td>
- <td>UIQtWidget</td>
- <td>Common widget properties like focus and visibility</td>
- <td>5465</td>
- <td>4</td>
- </tr>
- </table>
-
- **UIQt module refactoring** 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.
-
- 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.
-
- **Feature based development approach** 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 [quantitative complexity](http://kornerr.blogspot.com/2012/04/complexity-conservation-law-complexity.html) manifestation.
-
- 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.
-
- Here is a list of current UIQtTree features:
-
- <table>
- <tr>
- <th>**№**</th>
- <th>**Feature**</th>
- <th>**Description**</th>
- <th>**Size (B)**</th>
- <th>**Size (%)**</th>
- </tr>
- <tr>
- <td>1</td>
- <td>Base</td>
- <td>Allows to construct item hierarchy, modify it, and display it</td>
- <td>26966</td>
- <td>52</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Item open state</td>
- <td>Keeps track of collapsed/expanded item properties</td>
- <td>3094</td>
- <td>6</td>
- </tr>
- <tr>
- <td>3</td>
- <td>Item renaming</td>
- <td>Allows to rename an item</td>
- <td>3471</td>
- <td>7</td>
- </tr>
- <tr>
- <td>4</td>
- <td>Item selection</td>
- <td>Allows to get/set selected item</td>
- <td>2338</td>
- <td>5</td>
- </tr>
- <tr>
- <td>5</td>
- <td>Item value</td>
- <td>Provides 2nd and the rest columns for items, used by Property browser</td>
- <td>1307</td>
- <td>3</td>
- </tr>
- <tr>
- <td>6</td>
- <td>Item value editing</td>
- <td>Allows to edit item values with a default editor widget</td>
- <td>1996</td>
- <td>4</td>
- </tr>
- <tr>
- <td>7</td>
- <td>Item value editing with combobox</td>
- <td>Provides combobox editor</td>
- <td>5819</td>
- <td>11</td>
- </tr>
- <tr>
- <td>8</td>
- <td>Item value editing with spinner</td>
- <td>Provides spinbox editor</td>
- <td>5290</td>
- <td>10</td>
- </tr>
- <tr>
- <td>9</td>
- <td>Menu</td>
- <td>Provides pop-up menu</td>
- <td>1248</td>
- <td>2</td>
- </tr>
- </table>
-
- Here's an example of UIQtTree Menu feature file: [TREE_MENU](https://bitbucket.org/ogstudio-history/mjin/src/0c4cc3c3213f4687c0f3bd6a5426a6054cadd79b/f/TREE_MENU.cpp?at=Studio+0.10&fileviewer=file-view-default).
-
- **Benefits of the approach** include:
-
- 0. Faster code reading/understanding due to small size
- 0. Easier and safer modification due to isolated code
-
-
- There's a drawback, too: new approach requires learning.
-
- 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.
-
- [screenshot]: {attach}/images/2016-09-03_august-recap.png
|