8 | | * The goal of this task is to remove some code smells from controllers: |
9 | | * Inconsistent naming in event and handlers. |
10 | | * Inconsistent location of controllers - some related controllers are in sepaerate files, some are nested in the corresponding view, others - not, etc. |
11 | | * Menu items have {{{clicked}}} method instead of firing an R3 event. For some items it is trivial to switch to R3 Logic. |
12 | | * Not all menu items will be refactored. |
13 | | * Code duplication due to copy-paste. |
14 | | * No new functionality is going to be added. |
| 8 | This task is about refactoring the logic operations in the application. The problems related to that include (but are not limited to): |
| 9 | * There are operations that do not use R3 logic. |
| 10 | * There is code duplication (especially in the menu items and bound controls in HUDs). |
| 11 | * There is no convention on naming the events and handlers. |
| 12 | * There is no convention on placing (and grouping) the logic classes. |
| 13 | |
| 14 | After this iteration there should be a convention for placing, grouping and naming events and handlers. All existing R3 logics should follow that convention. A lot of the code smells should be eliminated. There might still be old Logics (due to weekly time-boxing). |
17 | | * Rename all nested enums that contain event IDs to {{{EventIds}}}. |
18 | | * In logic enums, names of all items should begin with "ON_", followed by the event ID, where possible. |
19 | | * For example, the event CLICK can be handled by ON_CLICK. |
20 | | * Check for inconsistent names - for example, {{{FRAME_REMOVED}}} is not a good name if the frame is removed during the handling of the event. {{{FRAME_REMOVE}}} is a better name. |
21 | | * In {{{main.app.commons}}} logics should not be in separated subpackage. Instead, move each logic enum to the package with the corresponding views. |
22 | | * For halo buttons, extract logics and group them by functionality. |
23 | | * For example, create {{{org.sophie2.main.app.halos.grouping.GroupHalosLogic}}} which handles events from all halo buttons related to grouping. |
24 | | * Refactor the align buttons: Reuse the code where possible. |
25 | | * In menu items deprecate the method {{{clicked}}}. |
26 | | * Create a new event CLICKED that should be fired when a menu item is clicked. |
27 | | * For all menu items, that just fire R3 event, remove the {{{clicked}}} method and change the filter in the controllers - it should listen for {{{MenuItem.EventIds.CLICKED}}}. |
| 17 | * Create a convention for naming, placing and grouping EventIds, OperationDefs and entries in OperationDefs, apply it and start following it. |
| 18 | * Describe the convention in the [wiki:UNPLANNED_LOGIC_REFACTORING_R0#Design] section of this page. |
| 19 | * Identify and remove duplicate code. |
| 20 | * (Optional) Refactor old logic classes to use LogicR3. |