Skip to main content

Reusability and Object-Orientation

Large iXML codebases become maintainable only when reuse boundaries are explicit. iXML provides five primary mechanisms for structuring reusable code:

  • Functions: Closed subroutines with local scope.
  • Macros: Open subroutines that share the caller's context.
  • Classes: Array prototypes for object-oriented design.
  • Includes: External code source execution.
  • Client Bindings: SOAP and REST service integration.

Each mechanism has different scoping, performance, and composability characteristics. Choosing the right one is critical for building robust ZeyOS applications.

Decision Framework

NeedRecommended constructWhy
Small, context-aware template fragmentmacro + expandNo context overhead; direct access to surrounding variables makes it natural for output patterns
Reusable logic with clear input/output contractfunction + callContext isolation prevents accidental side effects; parameters and return value create an explicit API
State and behavior that belong togetherclass + newProperties hold state; methods provide behavior; inheritance enables hierarchical reuse
Code in a separate file or ZeyOS resourceincludeNatural module boundary; local context provides isolation between files
External SOAP/REST web serviceClient BindingsAutomatic WSDL/Route parsing; operations become callable functions