DX overhaul — adding a slice should be like drinking water #59

Closed
opened 2026-02-21 22:43:22 +00:00 by ash · 0 comments
Owner

Vision

Adding a state change slice, state view slice, or automation slice should be the simplest thing in the world. One-of-a-kind DX. If a new dev can't understand it in 5 minutes, we failed.

Current State

The order-system example is decent but could be simpler. Key friction points to audit:

  • How many lines to define a minimal state change slice?
  • How many types need to be understood upfront?
  • Is the Decider generic signature intimidating? Decider[S, C, E] is 3 type params
  • Are Given/When/Then test helpers discoverable and exported?
  • Missing test files for cancel_order, ship_order examples

Goals

State Change Slice (command → events)

Should feel like:

var CreateOrder = eskit.StateChange[OrderState, CreateOrderCmd]{
    Decide: func(s OrderState, c CreateOrderCmd) ([]Event, error) { ... },
    Evolve: evolve,
}

State View (events → read model)

Should feel like:

var OrderList = eskit.StateView[OrderSummary]{
    EventTypes: []string{"OrderCreated", "OrderShipped"},
    Handle: func(state *OrderSummary, event Event) { ... },
}

Automation (event → command)

Should feel like:

var AutoShip = eskit.Automation{
    Trigger: "PaymentProcessed",
    Execute: func(ctx context.Context, e Event) error { ... },
}

Acceptance

  • Audit current lines-of-code for each slice type
  • Reduce boilerplate to absolute minimum
  • All 3 patterns (state change, state view, automation) have dead-simple examples
  • Test helpers exported and documented
  • README quick-start shows all 3 patterns in <50 lines total
  • Every example file has tests
## Vision Adding a state change slice, state view slice, or automation slice should be the simplest thing in the world. One-of-a-kind DX. If a new dev can't understand it in 5 minutes, we failed. ## Current State The order-system example is decent but could be simpler. Key friction points to audit: - How many lines to define a minimal state change slice? - How many types need to be understood upfront? - Is the Decider generic signature intimidating? `Decider[S, C, E]` is 3 type params - Are Given/When/Then test helpers discoverable and exported? - Missing test files for cancel_order, ship_order examples ## Goals ### State Change Slice (command → events) Should feel like: ```go var CreateOrder = eskit.StateChange[OrderState, CreateOrderCmd]{ Decide: func(s OrderState, c CreateOrderCmd) ([]Event, error) { ... }, Evolve: evolve, } ``` ### State View (events → read model) Should feel like: ```go var OrderList = eskit.StateView[OrderSummary]{ EventTypes: []string{"OrderCreated", "OrderShipped"}, Handle: func(state *OrderSummary, event Event) { ... }, } ``` ### Automation (event → command) Should feel like: ```go var AutoShip = eskit.Automation{ Trigger: "PaymentProcessed", Execute: func(ctx context.Context, e Event) error { ... }, } ``` ## Acceptance - [ ] Audit current lines-of-code for each slice type - [ ] Reduce boilerplate to absolute minimum - [ ] All 3 patterns (state change, state view, automation) have dead-simple examples - [ ] Test helpers exported and documented - [ ] README quick-start shows all 3 patterns in <50 lines total - [ ] Every example file has tests
ash closed this issue 2026-02-22 14:31:44 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ash/eskit#59
No description provided.