Thanks, Josh, That seems to confirm my impression that the answer may be
"don't use commands for subcomponents". Use command-like things in similar
patterns, but don't use commands. And I'd be fine with that if that were
generally embraced. But then we also wouldn't need Cmd.map since commands
would only exist at the top level of any application, so the Elm
architecture seems to be built with an expectation of nesting.

Mark

On Fri, Aug 26, 2016 at 11:52 AM, Josh Adams <[email protected]> wrote:

> On Friday, August 26, 2016 at 1:24:15 PM UTC-5, Mark Hamburg wrote:
>>
>> People create layer cake designs because they help manage systems
>> complexity. What I'm hearing here is that Elm should only be considered for
>> the very topmost layer. If it can't reach deeper, then it needs to compete
>> with the technologies that sit below it because those will try to push
>> upward.
>>
>
> People come to elm with designs that they relied on in languages/systems
> with entirely different semantics.  The core problem people keep bringing
> up here stems I think from a desire to take a not-fit-for-purpose
> 'architecture' and make Elm apps work that way.
>
> You can!  There's some plumbing involved!  You can write functions to help
> with that plumbing or send out Cmd with tasks!  I don't recommend it mostly.
>
> I've seen people with 5-deep nested trees of components that I would write
> flat.  It's a lot less code to do it that way.  The compiler helps manage
> the complexity.  Introducing the layers in these cases increases complexity.
>
> --- THAT PART IS OVER, HERE'S ANOTHER THING
>
> OK, so I do use component hierarchies in some elm applications.  I think
> if you're doing that, it's actually a good thing for each layer to handle
> the 'outbound things' and potentially transform them on the way up the
> chain.  If you don't need to do this, I think you probably don't need the
> hierarchy you built.  As an example, I have a Chat component.  It doesn't
> know that chat happens on websockets.  It sends out a `Maybe OutMsg` in
> response to some updates that is of type `Say String`.  It just says a
> thing.  The parent knows "aha!  The way I say things for him is to call
> this function on the websocket!  And since I set a 'callback' on this
> component I know that his outbound message should be wrapped with
> "sometopic"!"  If I changed the chat app to use longpolling or something,
> the Chat component doesn't need to change - just the piece that manages
> communication.  All the Chat component knows is it wanted to say something.
>
> If you let children output parent messages in some way, rather than their
> own semantics, you make designs that are more rigid that they should be.
>
> - Josh, just adding his random and probably amateur architectural
> ramblings to any thread he can.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to