Changes between Version 4 and Version 5 of UNPLANNED_LOGIC_REFACTORING_R0


Ignore:
Timestamp:
08/25/09 13:18:32 (16 years ago)
Author:
boyan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UNPLANNED_LOGIC_REFACTORING_R0

    v4 v5  
    66 
    77== Overview == 
    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. 
     8This 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 
     14After 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). 
    1515 
    1616== Task requirements == 
    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. 
    2821 
    2922== Task result == 
     23 * Convention for Logics, described in the design section of this page. 
    3024 * Source code 
    3125 
    3226== Implementation idea == 
    33  * Use eclipse's "Open Type Hierarchy" to view all {{{OperationDef}}}s (all R3 controllers), all {{{MenuItem}}}s, etc. 
     27 * It seems sensible that all nested ids for events should be named EventIds. Since they are accessed by the wrapper class, it is clear what event they are for. E.g. MenuItem.EventIds.CLICKED. 
     28 * OperationDef members that handle an event might be named starting with ON_ (e.g. ON_SET_SCREEN_MODE). 
     29 * In the MenuItem there is code duplication on the clicked method. It should become final and fire a CLICKED event. 
    3430 
    3531== Related == 
    36  * [wiki:UNPLANNED_MAIN_WINDOW_REFACTORING_R0] 
    37  * [wiki:GROUP_BOOK_MODEL_REDESIGN_R0] 
     32[wiki:UNPLANNED_MAIN_WINDOW_REFACTORING_R0][[BR]] 
     33[wiki:GROUP_BOOK_MODEL_REDESIGN_R0] 
    3834 
    3935== How to demo == 
    40  * The task has no visible result. 
     36 * This is a refactoring task related to internals and will not be demonstrated. 
    4137 
    4238= Design =