Skip to content

Refactor demo apps: standardize naming and improve code organization#590

Merged
oblomov-dev merged 4 commits intostandardfrom
claude/refactor-apps-guidelines-X87rF
Mar 15, 2026
Merged

Refactor demo apps: standardize naming and improve code organization#590
oblomov-dev merged 4 commits intostandardfrom
claude/refactor-apps-guidelines-X87rF

Conversation

@oblomov-dev
Copy link
Copy Markdown
Member

Summary

Refactored multiple demo application classes to improve code consistency, naming conventions, and overall structure. The changes focus on standardizing type naming, reorganizing method visibility, and improving code readability.

Key Changes

Type Naming Standardization

  • Renamed all custom types to follow ty_s_* (struct) and ty_t_* (table) naming convention
    • s_suggestion_itemsty_s_suggestion
    • s_suggestion_items_cityty_s_city
    • s_employeety_s_employee
    • suggestion_itemty_s_suggestion_item
    • combobox_itemty_s_combobox_item

Data Member Reorganization

  • Moved client reference to PROTECTED section for consistent access across methods
  • Renamed screen structure from screen to s_screen for clarity
  • Renamed table variables to use t_* prefix (e.g., mt_suggestiont_suggestion)
  • Removed redundant _sel table variants where possible

Method Refactoring

  • Renamed interface methods to remove z2ui5_ prefix for cleaner code:
    • z2ui5_on_initon_init
    • z2ui5_on_eventon_event
    • z2ui5_on_renderingview_display
  • Moved methods to PROTECTED section for better encapsulation
  • Consolidated popup methods into single responsibility methods (popup_value_suggestion, popup_value_employee)

Code Quality Improvements

  • Replaced single-quoted strings with backtick notation for consistency
  • Improved method organization by moving initialization logic into on_init
  • Simplified event handling flow in on_event
  • Removed unused variables and redundant code
  • Enhanced code formatting and indentation consistency

Affected Classes

  • z2ui5_cl_demo_app_009 (major refactoring)
  • z2ui5_cl_demo_app_008 (method reorganization)
  • z2ui5_cl_demo_app_010 (structure improvements)
  • z2ui5_cl_demo_app_002 (type naming)
  • z2ui5_cl_demo_app_004 (data organization)
  • z2ui5_cl_demo_app_006 (data organization)

Implementation Details

  • All functional behavior remains unchanged; this is purely a refactoring
  • Type definitions now consistently use the ty_ prefix pattern
  • Client reference is stored once in main and reused across methods
  • String literals standardized to backtick notation for ABAP 7.4+ compatibility

https://claude.ai/code/session_015wbHyKFwZgLaodzg7BdXoq

claude and others added 4 commits March 15, 2026 17:22
- app002: rename TYPES to ty_s_ prefix (ty_s_suggestion_item, ty_s_combobox_item)
- app004: move view_main (non-bound) from PUBLIC to PROTECTED section
- app006: move check_ui5 and key (non-bound) from PUBLIC to PROTECTED section
- app008: restructure with on_init/on_event/view_display; fix single quotes → backticks;
  fix && concatenation → string templates; fix shownavbutton → check_app_prev_stack();
  move check_strip_active/strip_type to PROTECTED section
- app009: lowercase class name in IMPLEMENTATION; rename methods to canonical names
  (on_init, on_event, view_display, popup_f4_suggestion, popup_f4_employee);
  rename types to ty_s_/ty_t_ prefix; rename attributes (s_screen, t_suggestion etc.);
  move popup methods and non-bound t_employees to PROTECTED; remove dead mv_view_popup
  code; fix single quotes → backticks; fix CLEAR → VALUE #(); fix view->stringify()
- app010: lowercase class name; extract on_init/view_display; fix single quotes → backticks;
  fix blank lines; use check_app_prev_stack() for shownavbutton

https://claude.ai/code/session_015wbHyKFwZgLaodzg7BdXoq
- CLAUDE.md: add rule that a method with only one statement must not be
  extracted — call that statement directly from the dispatcher instead
- app008: remove trivial on_init that only called view_display(); call
  view_display() directly from main

https://claude.ai/code/session_015wbHyKFwZgLaodzg7BdXoq
@oblomov-dev oblomov-dev merged commit 97e8e8c into standard Mar 15, 2026
6 checks passed
@oblomov-dev oblomov-dev deleted the claude/refactor-apps-guidelines-X87rF branch March 15, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants