~/talk

Catching Cute Monsters with Immutable Patterns from Functional Programming

Talkat UtahJS Conf 2017 · on Wednesday, 2017-09-27· [functional-programming, javascript]
slides:none on file

A toy monster-collection app is built in vanilla JavaScript (webpack used) to compare object-oriented mutating code with immutable functional patterns; an initial bug shows leveling owned monsters unexpectedly mutates an opponent because both trainers share the same array reference, producing an unexpected tie. The fix uses Object.assign and spread for new objects and map/filter/reduce to produce new arrays and to sum levels; the final deterministic functions return new trainers/monsters and the battle result then matches the expected winner.

AI-written summary · about

  1. 0:00Intro
  2. 0:15Overview
  3. 2:38Requirements
  4. 4:07Coding
  5. 13:45Visual Debugging
  6. 16:05Functionalism
  7. 19:38Object Assign
  8. 23:06Object Spread
  9. 31:29Final Code
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.