October 29, 2025
Purity Police vs State Squad
UIs Are Not Pure Functions of the Model – React.js and Cocoa Side by Side (2018)
React vs Cocoa sparks purity brawl: devs clap back
TLDR: An old essay says user interfaces aren’t simple “pure” formulas, comparing Apple’s Cocoa to React’s describe-and-render style. Commenters erupted: many say React isn’t pure anyway, some praise its building-block style, Elm fans defend purity but admit real apps need state; the debate matters for how we design future tools.
A 2018 think-piece pits Apple’s Cocoa style (old-school app building) against React, asking: are user interfaces just “pure” math-like functions, or messy, stateful beasts? The comments lit up like Friday night Reddit. One skeptic snapped that calling React “MVC” (an old pattern of splitting code into parts) makes no sense, while another insisted React isn’t even pure—yet its Lego-like building blocks and write-HTML-inside-JavaScript trick (JSX) are why it won the web. Cue the purity police vs practicality crew. Fans of ultra-strict Elm bragged its screens are 100% pure, then admitted reality check: browsers hide state like cursor focus and scrolling, so full purity cracks under pressure. Meanwhile, framework historians wondered if we’re quietly crawling back to classes and objects, ditching the functions-only hype. The original article paints Cocoa as a “grab a brush and paint the screen” approach, while React is more “describe the picture and let the engine handle it” (React, meet Elm). The crowd split between romantics who love the ideal and realists who trust the paintbrush. Memes flew about “render as wishful thinking” and “state is the final boss.” In the end, the thread reads like tech’s favorite soap opera: purity vs reality, with developers choosing teams and sharpening snarky one-liners
Key Points
- •The article contrasts React’s premise of UIs as pure functions of data with Cocoa’s MVC approach that treats screens as accumulators.
- •React’s render() is compared to Cocoa’s drawRect:, with React returning HTML and Cocoa drawing into a graphics context.
- •Complex UIs require abstraction into reusable components; the article advocates splitting UIs into non-leaky, reusable pieces.
- •Composition is highlighted as combining abstractions to create new ones, illustrated with FancyBox/UserBox code and Cocoa’s NSScrollView/NSTableView.
- •React Native is noted as elevating the projection concept beyond the browser, reinforcing the comparison of architectures.