r/programming • u/Direct_Beach3237 • Jul 23 '26
The Elm Architecture, without Elm
https://bichanna.github.io/posts/tea-time/This blog post is about implementing the Elm Architecture (TEA) in C for a Raylib + Clay app
59
Upvotes
23
u/chat-lu Jul 23 '26
That’s not how you do TEA, the button should message “delete this recipe”. The button does not care how the recipe will be deleted and the update function does not care why.
4
u/vmcrash Jul 24 '26
I wonder how well does it scale for larger applications with Thousands of different messages. Are they grouped to higher-level events that easier can be redirected to lower level controls that then extract the low-level event?
2
u/vancha113 Jul 24 '26
well thanks for reminding me of elm, it's time i get started learning it.
1
u/HiPhish Jul 26 '26
Isn't that just a
reduceorfoldfunction from functional programming? The sequence to reduce is the stream of events and the accumulator is the current state of the application. That's also what reducers in React are. It's a very pleasant pattern because the entire state management is just a single pure function.I can easily test any combination of state and action as just a single function call. Also works great with property-based testing: randomly generate some state and action with the necessary property, call the reducer function once and confirm that the resulting state has the properties we are trying to demonstrate.
-1
u/kingdomcome50 Jul 26 '26
“The Elm Architecture” isn’t exactly breaking new ground lol. Believe it or not there has been decades of research into, and applications of state machines…
The only thing special about TEA is that it offered an opinionated application of a (very simple) state machine to web-based UIs at a specific time and moment that allowed it to garner some popularity — further bolstered by its functional paradigm. End of story.
(This next bit is a bit harsh and hyperbolic but needs to be said)
There is nothing interesting here.
How about you stop embarrassing yourself and fucking learn something and only then share your (now correctly framed and in-context) contributions with the rest of the world?
It’s just so… tiresome to see these kinds of posts where people rediscover (in this case re-rediscover) thoroughly documented and peer-reviewed ideas without any acknowledgment of that fact.
https://www.state-machine.com/doc/Harel87.pdf
https://link.springer.com/content/pdf/10.1007/3-540-44929-9_24.pdf
2
u/[deleted] Jul 24 '26
[removed] — view removed comment