I would also question the use of the term "polymorphic" to describe the more generalized
I think that using commands to send messages to parents is probably a dangerous choice
2. This isn't really about defining components — a hot button word with some people (go read the elm-dev thread) — so much as it is about defining embeddings of one TEA-shaped unit within another.Side note on TEA: In Elm 0.16, TEA was all about being composable.
In any event, I recommend that those interested in ways to structure large Elm programs go look at this. It doesn't radically change anything but it could be a better way to express the composition of TEA-shaped units.
--
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 elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Having read the reddit thread about just starting big and breaking things down, it reminds of arguments I've heard for years about how monolithic programs are easier to work with.
Abstraction barriers are what make big programs possible. I don't think there is any magic in Elm that changes this fundamental lesson of 60 years of software development.
The rest of the world has looked at TEA and seen value in it and is looking to extend it.
The remark that composing TEA-shaped units isn't what Elm is designed for raises the question of whether we should then be expecting Cmd.map and friends to be going away since that would seem to be exactly what they are designed for.
Having read the reddit thread about just starting big and breaking things down, it reminds of arguments I've heard for years about how monolithic programs are easier to work with. They are. That's how we end up with them. It's almost always easier to tack a little more onto an existing ball of mud. If you've never worked in a statically-typed language then maybe Elm's type checking seems like a revelation, but it isn't so revolutionary as to throw out the experience that even static type-checking only gets you so far. Everything that can change the model can violate the constraints on the model that fall beyond the capabilities of the type system. Everything that sees the full model is a potential dependency for each and every piece of the model. Abstraction barriers are what make big programs possible. I don't think there is any magic in Elm that changes this fundamental lesson of 60 years of software development. It may make you feel you can move the boundaries relative to what some other languages afford, but if your architecture comes down to saying at the surface we have these few concepts but inside that we just have a big ball of type-checked mud, that's not really an architecture.
It's certainly reasonable to say that there is a point where pursuing fractal TEA is overkill and not buying one much but extra plumbing work.
But it is also exactly the case of things like the sign up form where being able to say "Here is a sign up form. It has a model, messages, update, and view. You embed it in the rest of your app like this."
The goal in a composable architecture is to have "like this" fit enough of a pattern that a programmer coming into an embedding situation knows what to expect.
"Everything ought to have the same API" is a much harder claim to defend. It sounds wrong at face value, and I haven't seen any evidence (in this thread or elsewhere) to convince me that it's a wise goal to pursue. :)
checkbox : (Bool -> msg) -> Bool -> Html msg
My point that there's a simple way to scale Elm applications by abstracting at the function level has gone uncontested for awhile in this thread. I think at this point I've said my piece and might as well move on.
It's cool for people to have philosophical goals separate from the goal of a nice scaling experience, but I honestly don't think I have much to contribute to those discussions. :)
--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/Lo6bG96zotI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
My point that there's a simple way to scale Elm applications by abstracting at the function level has gone uncontested for awhile in this thread. I think at this point I've said my piece and might as well move on.
It's cool for people to have philosophical goals separate from the goal of a nice scaling experience, but I honestly don't think I have much to contribute to those discussions. :)
we learned that a Model-View-Update triplet is the wrong unit of composition for Elm applications.
I don't haha...I just defended their use a few posts ago, complete with the specific example of the reusable signup form.
> How do you propose to split the functionality one has in a highly complex app with a lot of pages without using those triplets?
I don't haha...I just defended their use a few posts ago, complete with the specific example of the reusable signup form.
--
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 elm-discuss+unsubscribe@googlegroups.com.
How about the case where one has calls to a server involved? for example a weather widget or some kind of "Quote of the day" widget, a stocks ticker, etc.
How does one handles side-effects (http, random, time etc) with this pattern?
--
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 elm-discuss+unsubscribe@googlegroups.com.
so, the Model-View-Update triplet is NOT the wrong unit of composition for Elm applications? :)
> How do you propose to split the functionality one has in a highly complex app with a lot of pages without using those triplets?
I don't haha...I just defended their use a few posts ago, complete with the specific example of the reusable signup form.
"just write one monster model" approach
--
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 elm-discuss+unsubscribe@googlegroups.com.
I've seen agile teams that could generate lots of small changes but when faced with needing to do something big found themselves profoundly stuck.
the distillation of the don't use nested TEA argument when people have asked what to do instead has tended to be "use functions" which as I've noted doesn't mean much in a functional language.
As for C++ example I cited, there is nothing Elm is bringing to the table that makes it superior to C++ in the case I described. C++ is fully type-checked.
You are right if everyone make their UI from scratch, but how about others who wants to use existing library? For instance, date picker is a popular widget. We expect this widget to do lot of complex things behind the scene. But it requires state management (e.g. selected month). Without nested TEA, how can we use this library? [...] elm-sortable-table is a good example (I wonder why nobody mention it, btw). Calling update function is not needed. You can use it just like <input> element. I hope UI libraries that uses this pattern will increase.
Terms like "component is proven to be an anti-pattern" sounds too negative for me.
It sounds like "Elm proposes DIY every time, no reusable UI ever!", even if you mean "no need to make everything a component for building app, there are actually not so many reusable UI parts in practice".
I'm curious what makes it sound that way, since as you noted, that is not the point I'm making.
--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/Lo6bG96zotI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss+unsubscribe@googlegroups.com.
I don't know if others feels like me or not. But at least for me, "no components" sounds a bit confusing (it is in official guide too). As you explained the context behind the term "component" is quite huge. I use the word "component" just to say "reusable UI", so "no component" sounds like "no reusable UI". But isn't sortable-table a component? For those who understand the context, it is not a component, but I don't know how others feel (especially who come from JS world).
Also, "no components, no nesting TEA" does not answer the problem discussed here. So how can we do instead?
I'm curious what makes it sound that way, since as you noted, that is not the point I'm making.I don't know if others feels like me or not. But at least for me, "no components" sounds a bit confusing (it is in official guide too).
Also, "no components, no nesting TEA" does not answer the problem discussed here. So how can we do instead? Maybe introducing sortable-table pattern is more constructive for this discussion. I think it is a variant of TEA, managing its own state, but still keeping the form of "reusable view". So great!
I'm curious what makes it sound that way, since as you noted, that is not the point I'm making.I don't know if others feels like me or not. But at least for me, "no components" sounds a bit confusing (it is in official guide too).I view it as destructive so, you're not alone in seeing something not OK with that.
Other than the update trick, it's more or less the same thing as the old MUV triplets.
You can even use the pattern to do nesting.
Can you think of a way to use this overloaded word in a way where the people in the discussion are not confused by it, even though they think it means different things?
I covered how to grow Elm application code bases, and Evan covered reuse.
What is the remaining problem? :)
The problem is that this approach makes it impossible (as far as I could see) to implement the components that need side effects (like the old RandomGif list)
--
--
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 elm-discuss+unsubscribe@googlegroups.com.
I'll reiterate that thinking about application organization as "composing TEA-shaped units" is neither officially recommended nor what Elm is designed for...
> How do you propose to split the functionality one has in a highly complex app with a lot of pages without using those triplets?
I don't haha...I just defended their use a few posts ago, complete with the specific example of the reusable signup form.
- Later I pointed out an example of when it would be useful to use Html.map and Cmd.map to make a reusable signup form, and for that use case it happened to make sense to have a separate model, view, and update.
this level of doublespeak is really uncool
Crucially, between 0.16 and today, we learned that a Model-View-Update triplet is the wrong unit of composition for Elm applications.
- Earlier I said "between 0.16 and today, we learned that a Model-View-Update triplet is the wrong unit of composition for Elm applications...composing individual functions was both simpler and consistently led to a much better experience. I've laid out my advice for specifically how to do that here."
My point that there's a simple way to scale Elm applications by abstracting at the function level has gone uncontested for awhile in this thread
this level of doublespeak is really uncool
many of us have tried this, and found that composing individual functions was both simpler and consistently led to a much better experience.
I thought I've understood this but I'm more and more confused by what you're saying:Crucially, between 0.16 and today, we learned that a Model-View-Update triplet is the wrong unit of composition for Elm applications.
init update and subscribe are actually function. Looks like I still miss something. Are you trying to say that Cmd.map is not function or what?
on different topic:many of us have tried this, and found that composing individual functions was both simpler and consistently led to a much better experience.
Not even pointing out all nonsense: I just don't see any of them here just yet. I hope they will shop up.
Please don't start sending links to same Reddit thread once again.
rtfeldman [3 days ago]
the difference is that `thebritician/elm-autocomplete` is managing its own state because there is absolutely no possible other way to implement that library
it's the last resort, not the default
--
The structure camp says (in many more words) "I've seen your alternative and it isn't a real alternative. It's a pathway that decades of software industry experience indicates leads to creating big balls of mud."
To the extent that we live in a world where we all say "you're free to develop software however you see fit", we can often take the attitude. "That's interesting. It wouldn't work for me but I see why you are making those choices."
Sorry again for confusing.
We did spend the first 6 months or so of our project following the advice to not use nested TEA components. Our experience was that the perceived complexity of the app grew exponentially to the point where it was difficult to make progress. We refactored into a nested TEA structure and are far happier since (the change was made at the start of the year).
Reusable view components
We view these as distinct from the mini-apps that I mentioned earlier.
What I'm saying is that individual functions, as opposed to a group of functions and data structures (model, view, update, msg, etc) is the right unit of composition.
No na to zatím nemám :) jsem Funkcionalni lama :)
I can't do this :) I'm not that skilled in functional programming
Třeba se to vyřeší samo a nevezmete mě. Alespoň pak naboucham nějaké zkušenosti do zásoby na příští kolo ;)
Maybe it will resolve itself and will not hire me. At least I will have time to gain more experience on next round.
So Marek's library is for organizing entire app, not about using external library.
If you have time, would you mind describing how the app works?
Maybe you've noticed that I haven't commented your example with reusability. That was on purpose because telling when and on what you should use it is completely different topic. For sure it can be used for integrating community components. It can be used anytime you're using Cmd.map Html.map and Sub.map. That's actually beauty of abstraction that it can be applied regardless of your domain. Same way s you can List.map view over List of data to turn them into view you can use this to map date picker's api to app and anything else. My intention is not telling anyone when and on what to use it. It's just super thin helper for doing (a, Cmd b) -> (c, Cmd e) with the use of functions.
"That's actually beauty of abstraction that it can be applied regardless of your domain."
It's just super thin helper for doing (a, Cmd b) -> (c, Cmd e) with the use of functions.
andThen : (model -> (model, Cmd msg)) -> (model, Cmd msg) -> (model, Cmd msg)andThen update (model, cmd) =let(newModel, newCmd) =update modelinnewModel ! [ cmd, newCmd ]
as well as providing a fully integrated UI which includes all of the features, we will also allow individual features to be embedded within particular pages e.g. an article might have a discussion embedded at the end, but that same discussion mini-app is also included in a view more closely resembling Slack with a sidenav etc...Each mini-app is then responsible for it's own lifecycle (e.g. Loading/Loaded/Error).
I feel like this discussion has covered a few different scaling techniques and I feel like there's a good time to use all of them. Perhaps it would be good to just catalogue the different approaches along with some examples where people have found them useful in their projects.
I feel like this discussion has covered a few different scaling techniques and I feel like there's a good time to use all of them. Perhaps it would be good to just catalogue the different approaches along with some examples where people have found them useful in their projects.That is a fantastic idea and I totally want to do that now!
I have not seen the reverse happening.
doc = layout6 Symbol.component Footprint.component PackageOverlay.component (SourceEditor.Form.component (SourceEditor.configure Example.sourceEditorConfig)) (PartEditor.Form.component Example.partEditorConfig) ConsignEditor.Form.component (\symbol footprint packageOverlay sourceEditor partEditor consignEditor -> docBody [] [ div [] [ docSection "components" "Components" [ docSubSection "symbol" "Symbol" [ symbol ] , docSubSection "footprint" "Footprint" [ footprint ] , docSubSection "packageoverlay" "PackageOverlay" [ packageOverlay ] , docSubSection "sourceeditor" "SourceEditor" [ sourceEditor ] , docSubSection "parteditor" "PartEditor" [ partEditor ] , docSubSection "consigneditor" "ConsignEditor" [ consignEditor ] ] ] ] )
main = program { init = doc.init ( force Example.symbol , force Example.footprintFlags , force Example.packageOverlayFlags , force Example.sourceEditor , force Example.partEditor , {} ) , subscriptions = doc.subscriptions , update = doc.update , view = doc.view }
To recap:
- Earlier I said "between 0.16 and today, we learned that a Model-View-Update triplet is the wrong unit of composition for Elm applications...composing individual functions was both simpler and consistently led to a much better experience. I've laid out my advice for specifically how to do that here."
- Later I pointed out an example of when it would be useful to use Html.map and Cmd.map to make a reusable signup form, and for that use case it happened to make sense to have a separate model, view, and update.
so, the Model-View-Update triplet is NOT the wrong unit of composition for Elm applications? :)
> How do you propose to split the functionality one has in a highly complex app with a lot of pages without using those triplets?
I don't haha...I just defended their use a few posts ago, complete with the specific example of the reusable signup form.
To recap:
- Earlier I said "between 0.16 and today, we learned that a Model-View-Update triplet is the wrong unit of composition for Elm applications...composing individual functions was both simpler and consistently led to a much better experience. I've laid out my advice for specifically how to do that here."
- Later I pointed out an example of when it would be useful to use Html.map and Cmd.map to make a reusable signup form, and for that use case it happened to make sense to have a separate model, view, and update.
In (1) I am saying that I expect you'll have a better time if you think about building Elm applications in terms of composing individual functions, not in terms of composing Model/View/Update triplets.In (2) I am giving an example of a very specific set of circumstances in which a separate Model/View/Update makes sense.In summary: "Here is a useful but complex tool. Always reach for a simpler one first."
This isn't the first time I've seen a dev misunderstand your statement - Model-View-Update triplet is the wrong unit of composition for Elm applications - and attempt to write an entire SPA without using a triplet. Very painful stuff.
I know that's not what you're advising, but without stating that explicitly, devs are left to fill in the blanks themselves.