Skip to content

obinexus/obix-legacy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OBIX Heart UI/UX Library

"From Data to Experience — A UI/UX Library built with the OBIX Philosophy."

React TypeScript MIT License TDD

Overview

The OBIX Heart UI/UX Library is a React-standard, framework-friendly UI and UX library built on the Data-Oriented Adapted (DOA) breakthrough by Nnamdi Michael Okpala. It integrates seamlessly into React projects and modern frontends, providing:

Component-first design with data adaptation at the core
Data-driven UI interactions through systematic transformation layers
Composable, testable architecture aligned with OBIX philosophy
Quality-over-quantity POC methodology with TDD-driven development

This library is part of the OBIX verified data-adapted UI/UX framework:
📦 Main Repository: https://github.com/obinexus/obix
🔬 POC Source: https://github.com/obinexus/proof-of-concept


The Data-Oriented Adapted (DOA) Breakthrough

At the core of OBIX Heart is the Data-Oriented Adapted (DOA) model — a breakthrough architectural pattern introduced by Nnamdi Michael Okpala that revolutionizes how UI components interact with data through systematic adaptation layers.

Core DOA Principles

DOA treats UI as a data transformation pipeline:

Raw State → Data Mapper → Adapted Data → UI View → Feedback Loop

Rather than binding UI to business logic prematurely, the DOA approach:

  • Models UI components around pure data flow with immutable state transformations
  • Enables adaptive UX where interfaces reshape themselves around changing data requirements
  • Promotes testability and separation of concerns through explicit adapter contracts
  • Provides 1:1 correspondence between functional and object-oriented paradigms

DOA Implementation Architecture

// Data Model Layer - Immutable state representation
interface DataModel<T> {
  withState(transformer: (state: T) => T): DataModel<T>;
  getState(): T;
}

// Behavior Model Layer - Operations on data models  
interface BehaviorModel<T, R> {
  applyTransition(name: string, state: T, ...args: any[]): T;
  process(data: DataModel<T>): ValidationResult<R>;
}

// DOA Adapter Layer - Translation between paradigms
interface DOAAdapter<T, R> {
  adapt(dataModel: DataModel<T>): R;
  getDataModel(): DataModel<T>;
  getBehaviorModel(): BehaviorModel<T, R>;
}

This architecture ensures components behave identically regardless of whether they are defined using functional or object-oriented programming patterns, maintaining perfect behavioral correspondence.


React Component Standards & OBIX Integration

What is a React Component?

A React Component is a function or class that takes props as input and returns UI (JSX) as output. Components are the fundamental building blocks of React applications, encapsulating both UI structure and behavior logic.

// Basic component contract
type ReactComponent = (props: Props) => JSX.Element | React.ComponentClass<Props>

OBIX Heart supports both component paradigms with guaranteed behavioral equivalence through the DOA adapter layer.

Component Architecture Patterns

Functional Components (Modern React Standard)

Functional components are pure functions that use hooks for state management and lifecycle integration:

// Functional Component Structure
function MyComponent(props: ComponentProps): JSX.Element {
  // Hooks for state and effects
  const [state, setState] = useState(initialState);
  useEffect(() => { /* lifecycle logic */ }, [dependencies]);
  
  // Return JSX representation
  return <div>{/* UI elements */}</div>;
}

// Arrow function alternative
const MyComponent = (props: ComponentProps) => {
  const [state, setState] = useState(initialState);
  return <div>{/* UI elements */}</div>;
};

Key Features:

  • useState Hook: Manages component-local state with immutable updates
  • useEffect Hook: Handles side effects and lifecycle events
  • Custom Hooks: Encapsulate reusable stateful logic
  • Pure Function Semantics: Predictable output based on props input

Object-Oriented Components (Class-Based)

OOP components use class MyComponent extends React.Component with state, lifecycle methods, and render():

// OOP Component Structure  
class MyComponent extends React.Component<Props, State> {
  constructor(props: Props) {
    super(props);
    this.state = { /* initial state */ };
  }
  
  // Lifecycle methods
  componentDidMount() { /* setup logic */ }
  componentDidUpdate(prevProps: Props, prevState: State) { /* update logic */ }
  componentWillUnmount() { /* cleanup logic */ }
  
  // Event handlers
  handleEvent = (event: Event) => {
    this.setState({ /* state updates */ });
  }
  
  // Required render method
  render(): JSX.Element {
    return <div>{/* UI elements */}</div>;
  }
}

Key Features:

  • this.state: Component-local state with this.setState() updates
  • Lifecycle Methods: Explicit hooks for component lifecycle phases
  • Method Binding: Event handlers bound to component instance
  • Class Instance Semantics: Object-oriented encapsulation patterns

OBIX 1:1 Behavioral Correspondence Guarantee

Core Principle: Both functional and OOP components must exhibit identical behavior when wrapped by DOA adapters, ensuring paradigm-independent correctness.

Adapter-Mediated Equivalence

// Functional Component with DOA
const FunctionalCounter = createFunctionalComponent(
  { count: 0 }, // Initial state
  {
    increment: (state, amount = 1) => ({ count: state.count + amount }),
    decrement: (state, amount = 1) => ({ count: state.count - amount })
  },
  { behaviorId: 'counter', cachingEnabled: true }
);

// OOP Component with DOA
class CounterComponent {
  increment(state: CounterState, amount = 1) {
    return { count: state.count + amount };
  }
  
  decrement(state: CounterState, amount = 1) {
    return { count: state.count - amount };
  }
  
  process(data: DataModel<CounterState>) {
    return new ValidationResult(true, data);
  }
}

const OOPCounter = createOOPComponent(
  new CounterComponent(),
  { count: 0 }, // Initial state  
  { behaviorId: 'counter-oop', cachingEnabled: true }
);

Behavioral Verification Protocol

The DOA adapter layer mathematically guarantees equivalent behavior through systematic verification:

// Verification Test Suite
describe("1:1 Behavioral Correspondence", () => {
  it("should produce identical outputs for identical inputs", () => {
    const functionalResult = FunctionalCounter.adapt(
      FunctionalCounter.getDataModel().withState(state => ({ ...state, count: 5 }))
    );
    
    const oopResult = OOPCounter.adapt(
      OOPCounter.getDataModel().withState(state => ({ ...state, count: 5 }))
    );
    
    expect(functionalResult).toEqual(oopResult);
  });
  
  it("should maintain state immutability across paradigms", () => {
    const functionalState = FunctionalCounter.getDataModel().getState();
    const oopState = OOPCounter.getDataModel().getState();
    
    // Apply same transformation
    const functionalNext = FunctionalCounter.getBehaviorModel()
      .applyTransition("increment", functionalState, 3);
    const oopNext = OOPCounter.getBehaviorModel()
      .applyTransition("increment", oopState, 3);
    
    expect(functionalNext).toEqual(oopNext);
    expect(functionalNext).not.toBe(functionalState); // Immutability preserved
  });
});

Adapter Contract Enforcement

The DOA layer enforces formal contracts that abstract away paradigm differences:

interface DOAContract<S, R> {
  // State transformation must be pure and immutable
  stateTransformation: (current: S, action: Action) => S;
  
  // Validation must be consistent across paradigms  
  validation: (state: S) => ValidationResult<R>;
  
  // Behavioral equivalence under identical inputs
  behavioralEquivalence: (input: S) => R;
}

This systematic approach ensures that component choice (functional vs. OOP) becomes a developer preference rather than an architectural constraint, while maintaining mathematical rigor in state management and transformation protocols.

Mathematical Foundation: The 1:1 behavioral correspondence is formally verified through the equivalence models described in Nnamdi Okpala's Formal Mathematical Reasoning System and Automaton State Minimization and AST Optimization papers. The DOA adapter layer implements automaton state minimization principles to ensure identical state transition behavior across paradigms, with cost function governance preventing architectural drift beyond sustainable thresholds.


Quality over Quantity — POC Development Philosophy

In the OBIX POC methodology, we emphasize high quality of core primitives over broad feature proliferation:

Quality Assurance Framework

Every component and pattern must:

  • Be backed by clear data adaptation principles with formal verification
  • Fit naturally into React composition patterns without coupling violations
  • Be covered by comprehensive unit and integration tests with >95% coverage
  • Demonstrate measurable performance characteristics under DOA transformation

The POC does not aim for extensive component libraries; instead, it focuses on:

  • Tight correctness through mathematical validation of state transformations
  • Developer ergonomics with intuitive APIs that enforce DOA principles
  • Clear data flow semantics with explicit adapter contracts and validation
  • Architectural sustainability within cost function governance thresholds

Cost Function Governance Integration

Components are evaluated against the Sinphasé governance model:

Component_Cost = Σ(complexity_i × weight_i) + coupling_penalty + temporal_pressure ≤ 0.5

When components exceed cost thresholds, they undergo architectural refactoring rather than feature reduction, maintaining quality while optimizing complexity.


TDD Methodology in OBIX Heart

Test Driven Development (TDD) is a first-class architectural principle in OBIX Heart development, integrated with DOA validation:

1️⃣ Test-First Component Development

Every component starts with failing tests that define DOA contracts:

describe("ObixButton with DOA", () => {
  it("should adapt data correctly through transformation layer", () => {
    const initialData = { label: "Click me", disabled: false };
    const adapter = createButtonAdapter(initialData);
    
    expect(adapter.adapt).toBeDefined();
    expect(adapter.getDataModel().getState()).toEqual(initialData);
  });
  
  it("should maintain state immutability through interactions", () => {
    const adapter = createButtonAdapter({ clicks: 0 });
    const newState = adapter.getBehaviorModel().applyTransition("click", adapter.getDataModel().getState());
    
    expect(newState).not.toBe(adapter.getDataModel().getState());
    expect(newState.clicks).toBe(1);
  });
});

2️⃣ DOA Layer Testing Strategy

Testing follows the three-layer verification approach:

  • Data Adaptation Layer: Test pure data transformations independently
  • UI Rendering Layer: Test component rendering as separate contracts
  • User Interaction + Feedback Loop: Test complete data flow cycles

3️⃣ Continuous Architectural Validation

it("should maintain DOA principles under component evolution", () => {
  const component = createComponent();
  const costAnalysis = analyzeCost(component);
  
  expect(costAnalysis.complexity).toBeLessThan(0.5);
  expect(costAnalysis.couplingViolations).toEqual([]);
});

4️⃣ Refactoring Toward Simplicity

TDD drives continuous refactoring toward simpler, more transparent data flows while maintaining behavioral equivalence across paradigms.


React Standard Integration

OBIX Heart is architected to feel 100% natural in React ecosystems:

Standard React Component Usage

import { ObixButton, ObixList, useObixAdapter } from "@obix/heart";

function MyComponent() {
  const buttonAdapter = useObixAdapter({
    initialState: { label: "Submit", loading: false },
    transitions: {
      startLoading: (state) => ({ ...state, loading: true }),
      finishLoading: (state) => ({ ...state, loading: false })
    }
  });
  
  return (
    <ObixButton 
      adapter={buttonAdapter}
      onClick={() => buttonAdapter.getBehaviorModel().applyTransition("startLoading")}
    >
      {buttonAdapter.getDataModel().getState().label}
    </ObixButton>
  );
}

Hooks-Based DOA Integration

const useObixAdapt = (data, options = {}) => {
  const [adapter, setAdapter] = useState(() => 
    DOAAdapterImpl.createFunctional(
      new DataModelImpl(data),
      options.transitions || {},
      options.processFunction || (data => data),
      options
    )
  );
  
  return adapter;
};

Component Composition Patterns

function DataDrivenList({ items, transformations }) {
  const listAdapter = useObixAdapter({
    initialState: { items, selectedItems: [] },
    transitions: transformations
  });
  
  return (
    <ObixList 
      adapter={listAdapter}
      renderItem={(item, index) => (
        <ObixListItem key={index} data={item} />
      )}
    />
  );
}

Installation & Quick Start

Installation

npm install @obix/heart
# or
yarn add @obix/heart

Basic Usage

import React from 'react';
import { ObixButton, createFunctionalComponent } from '@obix/heart';

// Define component with DOA principles
const Counter = createFunctionalComponent(
  { count: 0 }, // Initial state
  {
    increment: (state, amount = 1) => ({ count: state.count + amount }),
    decrement: (state, amount = 1) => ({ count: state.count - amount })
  },
  {
    behaviorId: 'counter',
    cachingEnabled: true,
    tracingEnabled: true
  }
);

function App() {
  return (
    <div>
      <p>Count: {Counter.getDataModel().getState().count}</p>
      <ObixButton onClick={() => Counter.adapt("increment")}>
        Increment
      </ObixButton>
    </div>
  );
}

API Reference

Core Components

ObixButton

Data-adapted button component with immutable state management.

interface ObixButtonProps {
  adapter: DOAAdapter<ButtonState, ButtonResult>;
  onClick?: (event: MouseEvent) => void;
  children: React.ReactNode;
}

ObixList

Optimized list component with state-aware rendering and data adaptation.

interface ObixListProps<T> {
  adapter: DOAAdapter<ListState<T>, ListResult<T>>;
  renderItem: (item: T, index: number) => React.ReactNode;
  virtualizeThreshold?: number;
}

Core Hooks

useObixAdapter

Creates and manages DOA adapters with React lifecycle integration.

function useObixAdapter<S, R>(options: {
  initialState: S;
  transitions?: Record<string, StateTransition<S>>;
  processFunction?: (data: DataModel<S>) => ValidationResult<R>;
  behaviorId?: string;
}): DOAAdapter<S, R>

Utility Functions

createFunctionalComponent

Factory for functional components following DOA principles.

createOOPComponent

Factory for object-oriented components with DOA compatibility.


Architecture & Performance

State Minimization

OBIX Heart implements Nnamdi Okpala's automaton state minimization for optimal performance:

  • Equivalent state identification and merging for reduced memory footprint
  • Transition optimization between states with preserved behavior
  • Structural sharing for efficient immutable operations

The implementation follows the formal AST-automaton minimization process defined in Okpala's research, where equivalent states are identified using the equivalence relation p ∼ q ⟺ ∀w ∈ Σ*, δ*(p, w) ∈ F ⟺ δ*(q, w) ∈ F. This mathematical foundation ensures components achieve optimal performance while maintaining behavioral correctness across both functional and object-oriented paradigms.

Memory Efficiency

  • Immutable data models prevent unexpected state mutations
  • Efficient clone operations that only copy changed properties
  • Result caching for identical inputs with LRU eviction
  • Lazy evaluation of computed properties

The memory optimization strategy implements the AST optimization techniques described in Okpala's research, including node reduction to eliminate unnecessary nodes in state transition trees, path optimization to minimize state checks, and memory efficiency protocols that significantly reduce allocation overhead. These optimizations are derived from the tennis score tracking case study, which demonstrated substantial resource improvements while maintaining complete functional accuracy.

Development Guidelines

  1. Always start with failing tests that define DOA contracts
  2. Maintain cost function compliance - components exceeding thresholds trigger refactoring
  3. Preserve immutability - all state changes must go through adapter transformations
  4. Document data flow - every component should have clear adaptation semantics

Contributing

We welcome contributions that align with OBIX philosophy and DOA principles:

  1. Fork the repository and create feature branches
  2. Write failing tests first following TDD methodology
  3. Implement DOA-compliant components with adapter patterns
  4. Ensure cost function compliance with architectural analysis
  5. Submit PRs with comprehensive test coverage and documentation

Development Setup

git clone https://github.com/obinexus/obix-heart
cd obix-heart
npm install
npm test
npm run dev

Note: The OBIX Heart library implements formal verification protocols that require systematic testing validation. All development workflows must maintain compliance with cost function governance thresholds defined in the Sinphasé methodology.


LICENSE

MIT License - see LICENSE file for details.


Acknowledgments

This library implements Nnamdi Michael Okpala's breakthrough research in:

  • Data-Oriented Adapted (DOA) architectural patterns
  • Automaton state minimization for UI optimization
  • Single-pass compilation principles applied to component architecture
  • Mathematical verification of behavioral equivalence across paradigms

Mathematical Foundation Papers

The OBIX Heart library is built upon the following peer-reviewed research by Nnamdi Michael Okpala:

  1. "Formal Mathematical Reasoning System" - Establishes the theoretical foundation for cost function governance, function equivalence validation, dynamic-to-static transformation protocols, and verification standard integration within safety-critical systems.

  2. "Automaton State Minimization and AST Optimization" - Defines the formal AST-automaton minimization process that enables optimal component performance through equivalent state identification and transition optimization.

  3. "Extended Automaton-AST Minimization and Validation" - Provides advanced equivalence class construction algorithms and AST-aware state splitting protocols for complex component hierarchies.

  4. "State Machine Minimization: An Application-Based Case Study on Games of Tennis" - Demonstrates practical application of automaton minimization principles to real-world state management scenarios, directly applicable to UI component optimization.

These papers establish the mathematical rigor that distinguishes OBIX Heart from conventional React component libraries. The DOA adapter layer implements formal verification protocols derived from these theoretical frameworks, ensuring NASA-STD-8739.8 compliance for safety-critical applications.

OBIX Heart represents practical application of theoretical computer science to modern UI/UX development, ensuring both mathematical rigor and developer experience excellence.


Summary

The OBIX Heart UI/UX Library is a practical expression of Nnamdi Okpala's mathematical research in automaton state minimization and formal verification:

🎯 Mathematically Verified UI/UX Framework with formal behavioral correspondence proofs
🎯 Automaton State Minimization for optimal component performance and memory efficiency
🎯 Cost Function Governance preventing architectural complexity beyond proven thresholds
🎯 NASA-STD-8739.8 Compliance supporting safety-critical distributed system requirements

This library guides developers, contributors, and reviewers toward systematic verification protocols while ensuring alignment to OBIX principles and the DOA breakthrough. Every component implements formal mathematical validation rather than heuristic design patterns, distinguishing OBIX Heart from conventional React component libraries through rigorous theoretical foundations.


Part of the OBINexus Verified Data-Adapted Framework | Computing from the Heart