DEV Community

Discussion on: I am the author of Elm in Action. Ask Me Anything!

Collapse
 
sebastiansebald profile image
Sebastian Sebald

Where do you see the pros + cons of TEA? Especially, compared to Redux (used in combination with immutables).

Collapse
 
rtfeldman profile image
Richard Feldman

I got into React very early after Facebook open-sourced it, but I switched to Elm before Redux came out...so I've never actually used Redux. :)

I think the following is the most honest way for me to answer the question of pros + cons:

The Elm Architecture in Elm

It's the only game in town. If you want to build UIs in Elm, the Elm Architecture is the only way to do so.

Pros: the entire ecosystem is optimized around it; no fragmentation
Cons: it's not well suited to doing major manual DOM manipulation

The Elm Architecture in JS

I've never tried this. JS is a totally different language, and I don't think it would be useful for me to guess what it might theoretically feel like to use Elm Architecture in JS. A better person to ask would be someone who's tried precisely this, and especially someone who's also tried Redux. :)

If the subtext here is "can I get many of Elm's benefits by using the Elm Architecture in JS?" the answer is unfortunately "not even remotely close." In my opinion almost all of Elm's benefits come from its compiler and library ecosystem, and you can't access either from JS.

Collapse
 
sebastiansebald profile image
Sebastian Sebald

Thanks you very much for your answer. No, I do not want to use the Elm Architecture in JS :)

To be more precise, I was wondering how the "update" function scales in the Elm Architecture, since I do not believe that Elm developers are using one big case statement for all possible messages. I think this is solved very well in Redux by composing reducers. I really dig the way all those small (pure) functions handle part of the application state. All the Elm example I saw didn't had that many messages, but I guess if your app grows you will also use some sort of composition to break the updates in smaller parts.

Thread Thread
 
rtfeldman profile image
Richard Feldman

Ah! I posted my thoughts on this over on /r/elm - hope that's useful!